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
This commit is contained in:
1 parent
1327646d42
commit
07669d7d1c
2 files changed
+4
-5
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user