fix: normalize worktree filter separators; skip pre-typing on terminal reattach
Windows resolves paths with backslashes, so the configured-worktreesDir prefix match failed there; both sides now normalize to forward slashes. Reopening the onboarding install terminal reattaches to the still-live PTY, so the pre-typed command is only written into a session with empty history. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
6378909671
commit
8babb9b8b6
2 files changed
+10
-6
No files matched your search
@@ -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. */
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user