diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 0e0a05ad90..833ba3c5d5 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -667,6 +667,7 @@ export default function ChatView() { const baseTerminalId = activeThread.activeTerminalId; const isBaseTerminalBusy = activeThread.runningTerminalIds.includes(baseTerminalId); const shouldCreateNewTerminal = Boolean(options?.preferNewTerminal) || isBaseTerminalBusy; + if (shouldCreateNewTerminal && hasReachedTerminalLimit) return; const targetTerminalId = shouldCreateNewTerminal ? `terminal-${crypto.randomUUID()}` : baseTerminalId; @@ -727,7 +728,7 @@ export default function ChatView() { }); } }, - [activeProject, activeThread, activeThreadId, api, dispatch, gitCwd], + [activeProject, activeThread, activeThreadId, api, dispatch, gitCwd, hasReachedTerminalLimit], ); const saveProjectScript = useCallback( async (input: NewProjectScriptInput) => { @@ -1350,6 +1351,7 @@ export default function ChatView() { if (setupScript) { void runProjectScript(setupScript, { cwd: result.worktree.path, + env: { T3CODE_WORKTREE_PATH: result.worktree.path }, }); } } catch (err) { diff --git a/apps/web/src/store.ts b/apps/web/src/store.ts index 8cc75e235b..1e790fbea8 100644 --- a/apps/web/src/store.ts +++ b/apps/web/src/store.ts @@ -481,10 +481,7 @@ export function reducer(state: AppState, action: Action): AppState { ); const nextProjects = action.projects.map((project) => { const previous = previousByCwd.get(project.cwd); - const scripts = - project.scripts.length > 0 - ? normalizeProjectScripts(project.scripts) - : normalizeProjectScripts(previous?.scripts ?? []); + const scripts = normalizeProjectScripts(project.scripts); return { ...project, model: resolveModelSlug(previous?.model ?? project.model),