diff --git a/apps/server/src/project/AgentSessionScanner.ts b/apps/server/src/project/AgentSessionScanner.ts index dd78482f8a..7badf75194 100644 --- a/apps/server/src/project/AgentSessionScanner.ts +++ b/apps/server/src/project/AgentSessionScanner.ts @@ -86,14 +86,13 @@ const decoder = new TextDecoder(); * transcripts look exactly like user sessions, but re-importing the app's own * sandboxes as projects is never right. Matches this server's configured * worktrees directory plus the conventional `.t3/worktrees` layout, which - * also catches sandboxes from other T3 homes on the same machine. + * also catches sandboxes from other T3 homes on the same machine. Separators + * are normalized so the prefix match holds on Windows too. */ function isT3ManagedWorktree(resolvedPath: string, worktreesDir: string): boolean { - const withSeparator = `${resolvedPath}/`; - return ( - withSeparator.startsWith(`${worktreesDir}/`) || - /[/\\]\.t3[/\\]worktrees[/\\]/.test(withSeparator) - ); + const normalized = `${resolvedPath.replaceAll("\\", "/")}/`; + const worktreesPrefix = `${worktreesDir.replaceAll("\\", "/")}/`; + return normalized.startsWith(worktreesPrefix) || normalized.includes("/.t3/worktrees/"); } /** Extract `cwd` from a session-meta record, tolerating the shapes each CLI writes. */ diff --git a/apps/web/src/components/onboarding/WelcomeWizard.tsx b/apps/web/src/components/onboarding/WelcomeWizard.tsx index 3e584606bd..3e2852ccd4 100644 --- a/apps/web/src/components/onboarding/WelcomeWizard.tsx +++ b/apps/web/src/components/onboarding/WelcomeWizard.tsx @@ -673,6 +673,11 @@ function AgentInstallTerminal({ if (opened._tag !== "Success") return; preparedRef.current = true; if (command.length === 0) return; + // Closing and reopening the drawer reattaches to the still-live PTY + // (Done never kills the session). A session with history already got + // its command — pre-typing again would duplicate it, or feed stdin to + // whatever is running. + if (opened.value.history.length > 0) return; // Pre-type without the trailing carriage return; the user submits. await writeTerminal({ environmentId,