History

Fix stale scripts sync, worktree env closure, and terminal limit check

- 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

Cursor Agent committed 9 months ago

Commit 07669d71 parent 13276462 files · +4 −5Browse files

Unified · Split

2 files
  1. apps/web/src/components/ChatView.tsx +3 −1
  2. apps/web/src/store.ts +1 −4
apps/web/src/components/ChatView.tsx+3−1
@@ -667,6 +667,7 @@ export default function ChatView() { · 666 unmodified lines
667667 const baseTerminalId = activeThread.activeTerminalId;
668668 const isBaseTerminalBusy = activeThread.runningTerminalIds.includes(baseTerminalId);
669669 const shouldCreateNewTerminal = Boolean(options?.preferNewTerminal) || isBaseTerminalBusy;
670+ if (shouldCreateNewTerminal && hasReachedTerminalLimit) return;
670671 const targetTerminalId = shouldCreateNewTerminal
671672 ? `terminal-${crypto.randomUUID()}`
672673 : baseTerminalId;
@@ -727,7 +728,7 @@ export default function ChatView() { · 54 unmodified lines
727728 });
728729 }
729730 },
730− [activeProject, activeThread, activeThreadId, api, dispatch, gitCwd],
731+ [activeProject, activeThread, activeThreadId, api, dispatch, gitCwd, hasReachedTerminalLimit],
731732 );
732733 const saveProjectScript = useCallback(
733734 async (input: NewProjectScriptInput) => {
@@ -1350,6 +1351,7 @@ export default function ChatView() { · 616 unmodified lines
13501351 if (setupScript) {
13511352 void runProjectScript(setupScript, {
13521353 cwd: result.worktree.path,
1354+ env: { T3CODE_WORKTREE_PATH: result.worktree.path },
13531355 });
13541356 }
13551357 } catch (err) {
apps/web/src/store.ts+1−4
@@ -481,10 +481,7 @@ export function reducer(state: AppState, action: Action): AppState { · 480 unmodified lines
481481 );
482482 const nextProjects = action.projects.map((project) => {
483483 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);
488485 return {
489486 ...project,
490487 model: resolveModelSlug(previous?.model ?? project.model),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t