Repository navigation
fix(agents): resume Code Mode through gateway restarts - #116605
Conversation
13a5059 to
b1e5e86
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 9:07 PM ET / July 31, 2026, 01:07 UTC. ClawSweeper reviewWhat this changesThe PR adds a recovery-only Gateway flag that preserves Code Mode Merge readinessKeep this PR open for explicit maintainer review. The patch appears to narrowly preserve a checkpoint-proven Code Mode tool surface only for authenticated main-session restart recovery, and the provided QA evidence exercises a real Gateway restart; however, it changes a recovery-time Gateway protocol contract and session continuation behavior. Likely related people: Priority: P1 Review scores
Verification
How this fits togetherMain-session restart recovery reads an interrupted run’s persisted transcript and checkpoint, then asks the Gateway to resume that provider turn. This change conveys a trusted recovery fact into the agent tool-surface planner so the resumed turn retains its original Code Mode controls while subsequent turns still use the reloaded configuration. flowchart LR
A[Interrupted Code Mode run] --> B[Persisted replay-safe checkpoint]
B --> C[Gateway restart recovery]
C --> D[Authenticated recovery request]
D --> E[Tool-surface planner]
E --> F[Code Mode exec and wait controls]
F --> G[Resumed provider turn]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +54, Tests +148, Other +4. Total +206 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the recovery-only override, with the authenticated preflight boundary and focused restart tests, then have a maintainer confirm the intended compatibility contract before merge. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the submitted recovery policy and focused tests define the persisted aborted Is this the best way to solve the issue? Yes: preserving the original Code Mode surface only for an authenticated, checkpoint-proven recovery turn is narrower than changing the reloaded Code Mode default or adding a user-facing configuration exception. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 3a6ee79a72e4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* fix(agents): preserve Code Mode restart recovery * chore(protocol): regenerate Swift agent params
* origin/main: fix(ai): prevent websocket cache clobber on concurrent acquire (openclaw#116216) test(ui): settle custodian mobile layout assertions (openclaw#116613) fix(agents): resume Code Mode through gateway restarts (openclaw#116605)
What Problem This Solves
Fixes an issue where an in-flight replay-safe Code Mode run could fail after a Gateway restart when reloaded configuration disabled Code Mode for new turns. Recovery either rejected the current Code Mode abort record or resumed the existing provider turn with the ordinary shell
execschema.Why This Change Was Made
Restart recovery now recognizes the current exact Code Mode abort contract and carries a trusted internal fact that preserves the original
exec/waitcontrol surface for that one checkpoint-proven provider turn. The override is rejected unless it arrives from authenticated backend main-session restart recovery.User Impact
Replay-safe Code Mode work can survive a Gateway restart without silently failing or receiving the wrong tool schema, while newly started turns still honor the reloaded Code Mode setting.
Evidence
gateway-restart-inflight-run: passed against the patched Gateway with mock OpenAI provider, real Gateway restart, config reload disabling Code Mode, and terminalRESTART-CODE-MODE-WAIT-OKreply.node scripts/run-vitest.mjs src/agents/main-session-restart-recovery.test.ts: 148 passed.node scripts/run-vitest.mjs src/agents/tool-surface-plan.test.ts: 13 passed.node scripts/run-vitest.mjs src/gateway/server-methods/agent-request-preflight.test.ts: 17 passed.pnpm check:changed -- <18 changed files>: passed core/coreTests formatting, API/boundary guards, dead-code scan, core and core-test typechecks, lint, and architecture guards.