Skip to content

Commit 9974bfe

Browse files
committed
Fix infinite restart loop when effectiveCwd is undefined
When resolveThreadWorkspaceCwd returns undefined but the active session has a persisted cwd, the comparison 'effectiveCwd !== activeSession?.cwd' always evaluates to true, triggering a restart. However, startProviderSession skips passing cwd when effectiveCwd is falsy, and ProviderService.startSession backfills the old cwd from the persisted binding, creating the same mismatch on the next turn — an infinite restart loop. Fix: only consider cwd as changed when effectiveCwd is defined, so an unresolved workspace does not cause spurious restarts.
1 parent fcb4421 commit 9974bfe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/server/src/orchestration/Layers/ProviderCommandReactor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ const make = Effect.gen(function* () {
334334
thread.session && thread.session.status !== "stopped" && activeSession ? thread.id : null;
335335
if (existingSessionThreadId) {
336336
const runtimeModeChanged = thread.runtimeMode !== thread.session?.runtimeMode;
337-
const cwdChanged = effectiveCwd !== activeSession?.cwd;
337+
const cwdChanged = effectiveCwd !== undefined && effectiveCwd !== activeSession?.cwd;
338338
const sessionModelSwitch =
339339
currentProvider === undefined
340340
? "in-session"

0 commit comments

Comments
 (0)