- SYNC_PROJECTS: Always use server scripts instead of falling back to stale local scripts when server returns empty array - runProjectScript: Pass T3CODE_WORKTREE_PATH via options.env to avoid stale closure after SET_THREAD_BRANCH dispatch - runProjectScript: Check hasReachedTerminalLimit before creating a new terminal to prevent orphaned server-side PTY processes
Unified · Split
| @@ -667,6 +667,7 @@ export default function ChatView() { · 666 unmodified lines | ||
| 667 | 667 | const baseTerminalId = activeThread.activeTerminalId; |
| 668 | 668 | const isBaseTerminalBusy = activeThread.runningTerminalIds.includes(baseTerminalId); |
| 669 | 669 | const shouldCreateNewTerminal = Boolean(options?.preferNewTerminal) || isBaseTerminalBusy; |
| 670 | + if (shouldCreateNewTerminal && hasReachedTerminalLimit) return; | |
| 670 | 671 | const targetTerminalId = shouldCreateNewTerminal |
| 671 | 672 | ? `terminal-${crypto.randomUUID()}` |
| 672 | 673 | : baseTerminalId; |
| @@ -727,7 +728,7 @@ export default function ChatView() { · 54 unmodified lines | ||
| 727 | 728 | }); |
| 728 | 729 | } |
| 729 | 730 | }, |
| 730 | − [activeProject, activeThread, activeThreadId, api, dispatch, gitCwd], | |
| 731 | + [activeProject, activeThread, activeThreadId, api, dispatch, gitCwd, hasReachedTerminalLimit], | |
| 731 | 732 | ); |
| 732 | 733 | const saveProjectScript = useCallback( |
| 733 | 734 | async (input: NewProjectScriptInput) => { |
| @@ -1350,6 +1351,7 @@ export default function ChatView() { · 616 unmodified lines | ||
| 1350 | 1351 | if (setupScript) { |
| 1351 | 1352 | void runProjectScript(setupScript, { |
| 1352 | 1353 | cwd: result.worktree.path, |
| 1354 | + env: { T3CODE_WORKTREE_PATH: result.worktree.path }, | |
| 1353 | 1355 | }); |
| 1354 | 1356 | } |
| 1355 | 1357 | } catch (err) { |
| @@ -481,10 +481,7 @@ export function reducer(state: AppState, action: Action): AppState { · 480 unmodified lines | ||
| 481 | 481 | ); |
| 482 | 482 | const nextProjects = action.projects.map((project) => { |
| 483 | 483 | const previous = previousByCwd.get(project.cwd); |
| 484 | − const scripts = | |
| 485 | − project.scripts.length > 0 | |
| 486 | − ? normalizeProjectScripts(project.scripts) | |
| 487 | − : normalizeProjectScripts(previous?.scripts ?? []); | |
| 484 | + const scripts = normalizeProjectScripts(project.scripts); | |
| 488 | 485 | return { |
| 489 | 486 | ...project, |
| 490 | 487 | model: resolveModelSlug(previous?.model ?? project.model), |