Skip to content

Commit e15c50d

Browse files
committed
fix(server): restart continuation checks before repeating side effects
A server restart can cut a turn while a command is still running, and the command can outlive the server (on Windows the provider's child process is orphaned and finishes). "Continue where you left off." gave the resumed agent no hint of that, so it could start a deploy, push or script a second time. The restart continuation prompt now says the last turn was cut short and that a command it started may have finished or still be running, and asks the agent to confirm a state-changing action did not take effect and is not still running before repeating it, or to say so when it cannot tell. Claude Opus 5.5, Claude Code
1 parent bf270e7 commit e15c50d

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎apps/server/src/orchestration-v2/RestartContinuation.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,9 @@ it.effect("continues a cut run past queued follow-ups, which stay held", () =>
915915
...cut,
916916
runs: [...cut.runs, queuedFollowUp],
917917
} as unknown as OrchestrationV2ThreadProjection);
918-
assert.deepEqual(texts, ["Continue where you left off."]);
918+
assert.deepEqual(texts, [
919+
"Continue where you left off. Your last turn was cut short, so a command or other action it started may have finished or may still be running. Before you repeat one that changes state, confirm it did not take effect and is not still running; if you cannot tell, say so instead of repeating it.",
920+
]);
919921
}),
920922
);
921923

@@ -945,7 +947,9 @@ it.effect("continues a resumed queued run that ran after an earlier continuation
945947
...cut,
946948
runs: [...cut.runs, finishedContinuation],
947949
} as unknown as OrchestrationV2ThreadProjection);
948-
assert.deepEqual(texts, ["Continue where you left off."]);
950+
assert.deepEqual(texts, [
951+
"Continue where you left off. Your last turn was cut short, so a command or other action it started may have finished or may still be running. Before you repeat one that changes state, confirm it did not take effect and is not still running; if you cannot tell, say so instead of repeating it.",
952+
]);
949953
}),
950954
);
951955

‎apps/server/src/orchestration-v2/RestartContinuation.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import {
3030
restartContinuationNote,
3131
} from "./RestartBackgroundNote.ts";
3232

33-
const CONTINUE_PROMPT = "Continue where you left off.";
33+
const CONTINUE_PROMPT =
34+
"Continue where you left off. Your last turn was cut short, so a command or other action it started may have finished or may still be running. Before you repeat one that changes state, confirm it did not take effect and is not still running; if you cannot tell, say so instead of repeating it.";
3435

3536
const MAX_CONTINUATION_CHAIN = 3;
3637
const CONTINUATION_LOOP_WINDOW_MS = 5 * 60 * 1_000;

0 commit comments

Comments
 (0)