Repository navigation
Conversation
…rd against stale reservations A same-process interruption (e.g. a context-window overflow compaction retry) left a stale restart-recovery delivery claim and abortedLastRun with no gateway restart having occurred. Turn admission then re-dispatched restart recovery and stamped a system notice asserting the previous turn was "interrupted by a gateway restart", so the model reported a phantom restart to the user. Two defects: 1. The resume notice text hardcoded a gateway-restart claim regardless of the actual interruption cause. 2. A stale delivery claim alone (no live recovery reservation) was enough to re-dispatch restart recovery. Fix: - Persist a typed cause on the recovery reservation (mainRestartRecovery. cause): "gateway_restart" for a genuine shutdown/startup mark, unset (unknown) otherwise. The marking paths (shutdown + startup-orphan) attribute their cycles; in-process aborts never create a cycle. - Build the resume notice from the cause: keep the restart-specific wording only for a verified gateway restart; use cause-agnostic neutral wording otherwise, so no restart is ever claimed without evidence. - Gate the admission re-dispatch path on durable restart evidence (a recovery cycle or a restart fence). A stale claim with no evidence no longer re-dispatches restart recovery. The foreground-claim path is left intact (it coordinates ownership and does not emit the notice). Tests: cause mapping on shutdown marking, neutral wording for a pre-upgrade reservation without a persisted cause, stale-claim admission no-redispatch, and an overflow-path regression asserting the overflow recovery path never writes a restart-recovery reservation or the aborted marker.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🟡 Changes recommended
Foreground claims can create state that later passes the new restart-evidence gate and schedules the recovery this change intends to suppress.
2 open findings
What changed in this PR
Adds cause-aware restart recovery to prevent false gateway-restart notices and attempts to suppress stale recovery claims.
Changes:
- Persists interruption causes and selects restart-specific or neutral recovery wording.
- Gates recovery redispatch on durable restart evidence.
- Updates recovery fixtures and regressions.
| File | Description |
|---|---|
src/gateway/server.startup-recovery-webchat.test.ts |
Seeds restart causes in webchat recovery tests. |
src/config/sessions/main-session-recovery.types.ts |
Defines persisted recovery causes. |
src/config/sessions.ts |
Exports the cause type. |
src/auto-reply/reply/reply-turn-admission.ts |
Adds the restart-evidence gate. |
src/auto-reply/reply/reply-turn-admission.recovery.test.ts |
Tests stale-claim admission. |
src/agents/main-session-recovery/main-session-restart-recovery.test.ts |
Tests cause persistence and notice wording. |
src/agents/main-session-recovery/main-session-restart-recovery-marking.ts |
Attributes marked cycles to gateway restarts. |
src/agents/main-session-recovery/main-session-restart-dispatch.ts |
Builds cause-specific recovery notices. |
src/agents/main-session-recovery/main-session-recovery-types.ts |
Propagates causes through recovery commands. |
src/agents/main-session-recovery/main-session-recovery-state.ts |
Persists causes in cycles and reservations. |
src/agents/main-session-recovery/main-session-parent-recovery.test-harness.ts |
Updates parent-recovery fixtures. |
src/agents/embedded-agent-runner/run/overflow-context-recovery.test.ts |
Adds overflow-state assertions. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…un found Upstream tests that fail alone on the base a1ccb69 and pass alone on bare v2026.10.5 because they assert behaviour the fork changes on purpose. Each pin passes here and fails with the fork code reverted to 10.5's. - main-session-recovery-yield: the kept dead-generation fence rule (Alex, 2026-10-21) settles the other-generation fence, so the claim is not_required. - ingress-monitor.admission: openclaw#132409 keeps the claim fenced through the stall watchdog. 10.5 moved this test here from the deleted ingress-monitor.inspection.test.ts, whose fork pin the carry dropped. - server.health-store-scheduling: openclaw#89526 re-collects health when a config publication lands mid-collection; the test waits for in-flight collections before counting reads. - telegram-recovery-notice-send: fork #13 claims a restart only for a cycle with cause gateway_restart. - gateway-tool.assembly: a non-owner turn sees a refusing gateway stub (owner-only tool stubs); the real tool stays off its authorized surface. - run.plugin-runtime-refresh: the fork's silent-stop nudge adds a third attempt for message-tool-only turns; media and provenance assertions are unchanged.
|
The maintained fork already contains the cause-aware notices and seeded overflow coverage. Rechecked
This is source verification, not a fresh test run or deployment claim. Update, November 2: the historical PR repair is now published at 8b25ce4cbf30. Its nine-file candidate passed 244 focused tests, negative/restoration controls, type-aware lint, affected compiler checks, the normal commit hook and complete-candidate source review. The earlier eight-file unvalidated status is superseded. The current PR description gives exact commands, counts and the broader guard failures reproduced on unchanged |
Keep interrupted delivery claims recoverable when the cause is unknown. Pass unknown through live reconciliation and select neutral model and user notices; reserve gateway-restart wording for recorded gateway restarts. Cover foreground-owner release and second admission with real recovery owners, and seed the overflow fixture before comparing the complete session row. Validation: 244 focused tests passed, with matched negative and restoration controls. Scoped type-aware lint, affected types and the normal pre-commit hook passed. Broader inherited guard failures are recorded in the PR evidence.
|
Closing - not pursuing this fork branch (stale upgrade-v2026.9.9 base). |


What problem this solves
Interrupted requests could be described as gateway restarts when the cause was unknown. The old admission guard also treated foreground-created recovery state as restart evidence, so it did not settle the release/second-admission case raised in review.
User impact
Unknown or missing causes now produce neutral model and user notices. Interrupted delivery claims remain recoverable; a completed recovery clears the aborted marker before the next reply proceeds. This repairs the historical
upgrade-v2026.9.9fork branch. It is not an upstream submission or a live deployment claim.Why this change was made
8b25ce4cbf30 removes the cause-based admission shortcut, records
unknownfor live orphan reconciliation, and carries the recorded cause into the user notice. Startup marking still recordsgateway_restart.The release/second-admission cases use the real claim, release, retry and settlement owners. For both missing and unknown causes they assert one recovery dispatch, terminal
status: "done",abortedLastRun: false, and no restart notice. Restoring the old guard loses the interrupted delivery claim in the missing-cycle negative control.The overflow fixture now seeds a real session row, requires it to exist, and compares the complete row after recovery. Injecting a marker mutation makes that assertion fail.
Evidence
Current head:
7703be67f03f, parent8b25ce4cbf30dcf2d902bde7b3bdc4ab4aadcedf. The latest commit changes onlytest/telegram-recovery-notice-send.test.ts(14 insertions, 9 deletions); production files and dependencies are unchanged. Committed fixture SHA-25611ad6a1b0479991ca143fff3969bf33e2839c07d25ca2ee7811ffd78453e4582matches the tested bytes; the normal commit hook passed without changing them. The PR merge base is543080ee633c991f32a056cefbef57c59b99269e; current target-branch tip is9eea409c6eb4f88de5db0cd9955d5284cc0e5222.259 passed, 0 failed, four focused files, 271.16 seconds wall time on the current committed tree. Linux, Node
24.21.0, pnpm12.5.1, frozen lockfile, one worker. Main recovery: 230; admission: 13; overflow: 1; queued Telegram transport: 15.Earlier production negative controls at unchanged
8b25ce4: old admission guard 1 failed / 2 matched passes; forced restart marking 2 failed / 1 matched pass; old notice path 2 failed / 2 matched passes. The seeded overflow assertion failed when a marker mutation was injected. That last control proves assertion sensitivity, not a pre-fix production regression. All nine files were hash-restored, then the 244-test suite passed again.Transport control: unchanged
8b25ce4reproduced 12 passed / 1 failed on the stale wording assertion. The corrected fixture against the exact oldedfa861notice owner produced 2 expected failures / 13 matched passes: missing and unknown causes failed; explicit restart and existing transport fences passed. All nine production-candidate files were hash-restored, then the four-file 259-test run passed. Exact visible and requested message sequences remain asserted after a real serialized queue wait.Type-aware lint on the changed fixture: 0 errors, 0 warnings. All four canonical root-test compiler partitions passed. The earlier nine-file lint, production types and affected agents/messaging compiler proofs remain attached to unchanged production bytes. Fresh source review of the fixture found no actionable P0-P2 defects; no human approval vote is claimed.
Broader checks remain red. The normal changed-file check passed 11 steps, then failed the
722 > 720test-root boundary; the same guard failed on the exact unchanged8b25ce4tree. The later checks in that sequence did not run. Each failure reproduced on unchangededfa861: configuration documentation counts/hash; test-root boundary722 > 720; one plugin compatibility removal entry; Knip6.32.2reported the same 12 production and 3 full-tree entries on both trees, with 0 script entries. No budget, assertion, compatibility policy or CI gate was weakened. Separate test compiler passes do not mean the test-root boundary passed.CI run 41368321599 finished failed at
2026-11-02 00:53 UTCon8b25ce4cbf30: 26 successful jobs, 12 failed, 137 cancelled and 24 skipped. The 12 failures include the aggregate CI gate. The transport fixture missed by the earlier focused suite is corrected in7703be67f03f: the queued Telegram notice test omitted the recovery cause but still expected restart wording; the received neutral wording matches the intended contract. That shard had 8,630 passed, 1 failed and 3 skipped. The earlier 244-test run did not cover this file; the current 259-test run does. The production dependency audit reports 18 high-or-higher advisories, including one critical; the lockfile blob is identical in the parent, target tip and new head. Configuration baseline drift, stale bundled-channel metadata, dead-code findings and lint/boundary failures in ten unchanged source paths also remain. The CodeQL, Critical Quality, OpenGrep, Workflow Sanity and three Periphery workflows passed. No rerun or gate bypass was requested. Full-repository and live installed-runtime proof remain incomplete; this evidence does not establish upstream [Bug]: Failover classifier defaults a 400 with a redaction-destroyed body to format, forcing a model-swap recovery instead of overflow recovery openclaw/openclaw#183005 recovery.Current-head CI run 41372029527 finished failed at
2026-11-02 01:37:53 UTC: 33 successful jobs, 12 failed, 130 cancelled and 24 skipped. The failures include the aggregate CI gate. The repaired transport-owning shard passed. A separate embedded-agent shard reported 1,224 passed / 3 failed: plugin-refresh media fixtures expected two attempts and observed three atrun.plugin-runtime-refresh.integration.test.ts:324. That fixture and its production sources are unchanged by the transport-only commit; the cause is still under investigation. Lint, metadata, boundary, dependency and baseline checks also remain red. No manual rerun or dispatch was requested; local focused proof does not establish full CI success.Focused command and inherited failures
The current four-file run followed transport negative controls and restoration. Peak process-tree memory was 4,940,468,224 bytes, with zero OOM kills. All validation stayed within one 2-CPU/8-GiB scope; the root-test compiler peaked at 7,195,684,864 bytes with zero OOM kills.
Inherited configuration documentation counts: core
2474 > 2473, channel3796 > 3786, plugin4432 > 4431, plus generated hash drift. Plugin compatibility reportsdeprecated-session-store-beta5-apieligible for removal after2026-10-12; this PR does not change that public contract.Knip's normal three-scan checker ran under one 2-CPU/8-GiB scope: candidate 131.27 seconds, unchanged-head control 127.30 seconds, identical findings and verified restoration. The package and both native bindings were checked against official npm integrity before execution.
The earlier broad review compared with the advanced target tip and included old index states. Its unrelated-file and INDEX-only findings were reconciled before reviewing the staged complete candidate against the actual merge base. Candidate bytes did not change during this correction.
The maintained fork's separately recorded cause-aware notices and seeded fixture remain distinct evidence. These historical-branch tests neither validate that entire maintained fork nor make this branch ready to cherry-pick onto current upstream main.