From fc4cb836fe09cd3c2efbdaa7a856192e8be258dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=82CHES?= Date: Fri, 20 Mar 2026 10:27:34 -0600 Subject: [PATCH] fix: return "dispatched" after doctor heal to prevent session race (#1580) (#1610) After dispatchDoctorHeal fires pi.sendMessage({ triggerTurn: true }), the function fell through to return "continue". The auto-loop treated "continue" as "proceed to next unit", called newSession() while the session manager was still processing the heal turn, and the 30s timeout killed auto-mode. Returning "dispatched" causes the auto-loop to break, letting the heal turn complete and trigger its own handleAgentEnd to resume the loop. Closes #1580 Co-authored-by: Claude Opus 4.6 (1M context) --- src/resources/extensions/gsd/auto-post-unit.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resources/extensions/gsd/auto-post-unit.ts b/src/resources/extensions/gsd/auto-post-unit.ts index 7c8743e5c..a7c1ee682 100644 --- a/src/resources/extensions/gsd/auto-post-unit.ts +++ b/src/resources/extensions/gsd/auto-post-unit.ts @@ -194,6 +194,7 @@ export async function postUnitPreVerification(pctx: PostUnitContext, opts?: PreV const reportText = formatDoctorReport(report, { scope: doctorScope, includeWarnings: true }); const structuredIssues = formatDoctorIssuesForPrompt(actionable); dispatchDoctorHeal(pi, doctorScope, reportText, structuredIssues); + return "dispatched"; } catch (e) { debugLog("postUnit", { phase: "doctor-heal-dispatch", error: String(e) }); }