Repository navigation
fix: preserve session forks during parent request preparation - #173489
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves the last prepared session-fork snapshot while the same parent run and transport prepare its replacement. Example: Advisor verifies a review while run fork-parent prepares a request containing Next parent request.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current-main session-fork preparation gap, has owner-backed direction, and introduces no actionable defect found in this review. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe embedded runner captures prepared provider requests in bounded process memory; background session forks replay the captured prefix and later publications through the provider transport with current authority checks and tool execution disabled. flowchart TD
A[Parent model request] --> B[Session fork wrapper]
B --> C[Prepared snapshot]
B --> D[Provider transport]
E[Background review or verification] --> F[Current authority checks]
F --> C
C --> D
D --> G[Read only answer]
Technical reviewBest possible solution: Keep snapshot replacement in the existing fork owner while preserving same-run availability, bounded retention, and reset revocation. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing-snapshot interval, and the added test enters it while payload preparation is suspended; the author reports the corresponding baseline failure, but this review ran no target code. Is this the best way to solve the issue? The patch fixes premature retirement at the producer, retains the existing replacement and cleanup mechanisms, and adds no parallel state owner or public API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b4fb60242fef. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +4, Tests +53. Total +57 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 15, 2026, 5:50 PM ET / 21:50 UTC (Revision 2). |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
## What Problem This Solves Fixes repeated plugin steering reaching the model twice, and rejected native guidance being retained as if it had been delivered. ## User Impact Plugins can retry steering without injecting the same guidance twice, including after a successor run starts. A native steer rejected before dispatch leaves no guidance in subsequent model context and can be retried after plugin reload. No configuration, schema, or stored-row shape change is required. ## Why This Change Was Made Transcript idempotency alone did not protect the active-run input queue. The existing run registration now joins pending/accepted admissions after authority validation, and the plugin host checks the durable session/key owner before dispatch. Stored steering receipts replay the original run ID, matching `src/gateway/server-methods/inflight.ts:38-51`; older rows without a receipt return terminal `duplicate`. Rejected queue reservations are released. Codex previously appended internal guidance before the final physical-send authority check. It now retains preceding tool-result mirroring and inbound user persistence, but appends internal plugin guidance only after native acceptance or accepted-unconfirmed delivery. Accepted history can still be recorded if the plugin is subsequently disposed; session/storage identity guards remain. This prevents rejected guidance from poisoning both replay and same-key retry without adding stored fields. The independent fork snapshot repair moved to #173489. Advisor cancellation and duplicate-fallback handling are in #173459. ## Evidence - Baseline `5678421c757`: sequential/concurrent duplicate-key regressions persisted one row but admitted two model-input messages. - Successor-run regression: before the durable check, the same key was accepted by a later run rather than deduplicated. - Native regression: before the producer fix, pre-wire disposal left a hidden transcript row, included it in `SessionManager` model context, and caused a reloaded plugin's retry to return `duplicate`. Afterward, rejected guidance is absent from both transcript and context; retry reaches native `turn/steer` once. Accepted-then-disposed guidance still persists once. - Focused steering, native admission/authority/settlement, recorder, and recorder-persistence tests passed. Changed-file oxfmt/oxlint, scoped tsgo, Madge (0 cycles), and diff checks passed. - The pre-review-fix combined raw-evidence campaign tested integration `04a5747760d1e9655b73fac511ddb81fad7a3c97`: **80 PASS / 5 FAIL → 86 PASS / 0 FAIL / 0 UNPROVED**. Shared case/invariant pairs: **59 PASS / 5 FAIL → 64 PASS / 0 FAIL**. Totals include added successor/channel coverage rather than an identical inventory. - That campaign proves same-run and successor-run idempotency, abort/overlap handling, display isolation, and built-in/native minutes verification. The later rejected-guidance producer fix is separately covered by the focused native regression above, not claimed as part of that campaign. - Focused native follow-up tested `0903019c1131cfa29a81b4e192c3353fb65a3def` (integration `998ff42a15f` plus the display fix): **36 PASS / 0 FAIL / 0 UNPROVED**. Live Codex tool-call, minutes, abort, overlap, and same-key within/across runs passed; every accepted steer row preceded its first provider request. A controlled native-transport probe separately proved pre-wire rejection leaves no row or wire request, then same-key retry delivers exactly once. The controlled rejection probe is not claimed as live-daemon fault injection. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Fixes Advisor guidance arriving after an aborted run, or remaining queued from a stale review after a new user turn starts. ## User Impact Aborting work also cancels its in-flight Advisor review and verification. Starting a new user turn drops unfinished advice based on the preceding turn instead of delivering it later. A duplicate steering outcome never creates fallback guidance. Normal run-end fallback remains supported. ## Why This Change Was Made The lifecycle subscription treated aborted terminal events like ordinary completion, ignoring their `aborted` flag. The controller also retained in-flight reviews when a new user run replaced the previous one. These transitions now cancel the stale review at the owning controller, preventing both active delivery and fallback queueing. Duplicate keys are terminal no-ops rather than unavailable steering, so the fallback path now leaves them alone. ## Evidence - Reproduced on `5678421c757`: aborted `end` and `error` events left the review signal active; regression assertions failed with `expected false to be true`. - Reproduced active delivery followed by another pending review spanning a new user turn; its cancellation assertion failed on the baseline. - A duplicate-result regression also demonstrated an unwanted fallback queue entry before its repair. - All 51 Advisor tests passed, including cancellation, duplicate handling, normal run-end fallback, tool settlement, verification, and interval accounting. Combined owner checks covered 127 distinct tests; changed-file oxfmt/oxlint, scoped tsgo, Madge (0 cycles), and diff checks passed. - Final raw-evidence campaign combined this head `1fac8ffa671`, core head `5677912be70` (#173458), and display fix `07c940c6959` (#173460); tested integration `04a5747760d1e9655b73fac511ddb81fad7a3c97`. - Executable invariants: **before 80 PASS / 5 FAIL; after 86 PASS / 0 FAIL / 0 UNPROVED**. Shared case/invariant pairs improved **59 PASS / 5 FAIL → 64 PASS / 0 FAIL**; totals include different commissioning/channel coverage and the new successor-run case. - The accepted abort left zero queued notes. The overlapping user turn retained one active correction and zero queued copies. Built-in minutes review completed verification and delivered once. Provider requests, SQLite rows, and events independently establish these outcomes. - A/B behavior stayed unchanged: Advisor-on 4 tool calls / 2 repeated actions, solved; off 8 / 7, unresolved. Actual Codex tool/minutes and late-snapshot Telegram persistence/display/recipient checks passed. No active-session compaction occurred; that RPC remained refused. - The fork slice from the tested core revision is now isolated in #173489; #173458 retains steering deduplication and the later native rejected-guidance producer repair. Co-authored-by: Ayaan Zaidi <[email protected]>
|
Landed as 4d13205. A session fork's prepared snapshot is now kept until its same-run replacement is ready, so a verify fork started while the next parent request is being prepared no longer fails. Reset/delete still revoke. Proof: two regressions failing before; built-in real-clock minutes review and verify delivered in the raw-evidence campaign; exact-head CI green. |
…aw#173489) ## What Problem This Solves Fixes background session-fork verification failing while the parent prepares its next model request. ## User Impact Advisor can finish a review and its verification across a parent-request preparation boundary instead of failing with a missing prepared-parent error. No configuration or storage migration is required. ## Why This Change Was Made The fork owner removed the current prepared snapshot as soon as another parent request began, before asynchronous payload preparation published its replacement. A review could finish inside that gap while verification found no snapshot. Keep the last committed snapshot for the same run and transport until atomic replacement. New runs/transports still retire the previous snapshot; reset/delete revocation and existing TTL, count, and byte bounds remain intact. Ordinary run-end disposal already preserves provider resources, so no attempt-stream-settle change is needed. This independent fork slice was extracted from openclaw#173458; steering idempotency and rejected-guidance delivery remain there. ## Evidence - On baseline `4bf119f2359`, `keeps review and verification available while the next parent request is being prepared` failed at the verification call with `Cache-parity session fork requires a parent turn prepared by this OpenClaw runtime. Send a normal message first.` - The sibling reset regression proves a pending preparation cannot restore a reset parent. - On this extracted branch, 32 focused tests passed across the fork owner and embedded fork integration suites. Changed-file formatting/lint, scoped tsgo, and diff checks passed. - The exact fork patch was included in the raw-evidence combined campaign tested at `04a5747760d1e9655b73fac511ddb81fad7a3c97`: **before 80 PASS / 5 FAIL; after 86 PASS / 0 FAIL / 0 UNPROVED**. On shared case/invariant pairs: **59 PASS / 5 FAIL → 64 PASS / 0 FAIL**; totals include differing commissioning/channel coverage. - The real-clock built-in minutes case completed review, verification, and one hidden delivery after a foreground tool crossed the minute threshold. Actual Codex minutes also passed. Assertions use provider requests, SQLite transcript rows, and tool/event ordering rather than Advisor's log summary. Co-authored-by: Ayaan Zaidi <[email protected]>
…aw#173458) ## What Problem This Solves Fixes repeated plugin steering reaching the model twice, and rejected native guidance being retained as if it had been delivered. ## User Impact Plugins can retry steering without injecting the same guidance twice, including after a successor run starts. A native steer rejected before dispatch leaves no guidance in subsequent model context and can be retried after plugin reload. No configuration, schema, or stored-row shape change is required. ## Why This Change Was Made Transcript idempotency alone did not protect the active-run input queue. The existing run registration now joins pending/accepted admissions after authority validation, and the plugin host checks the durable session/key owner before dispatch. Stored steering receipts replay the original run ID, matching `src/gateway/server-methods/inflight.ts:38-51`; older rows without a receipt return terminal `duplicate`. Rejected queue reservations are released. Codex previously appended internal guidance before the final physical-send authority check. It now retains preceding tool-result mirroring and inbound user persistence, but appends internal plugin guidance only after native acceptance or accepted-unconfirmed delivery. Accepted history can still be recorded if the plugin is subsequently disposed; session/storage identity guards remain. This prevents rejected guidance from poisoning both replay and same-key retry without adding stored fields. The independent fork snapshot repair moved to openclaw#173489. Advisor cancellation and duplicate-fallback handling are in openclaw#173459. ## Evidence - Baseline `4bf119f2359`: sequential/concurrent duplicate-key regressions persisted one row but admitted two model-input messages. - Successor-run regression: before the durable check, the same key was accepted by a later run rather than deduplicated. - Native regression: before the producer fix, pre-wire disposal left a hidden transcript row, included it in `SessionManager` model context, and caused a reloaded plugin's retry to return `duplicate`. Afterward, rejected guidance is absent from both transcript and context; retry reaches native `turn/steer` once. Accepted-then-disposed guidance still persists once. - Focused steering, native admission/authority/settlement, recorder, and recorder-persistence tests passed. Changed-file oxfmt/oxlint, scoped tsgo, Madge (0 cycles), and diff checks passed. - The pre-review-fix combined raw-evidence campaign tested integration `04a5747760d1e9655b73fac511ddb81fad7a3c97`: **80 PASS / 5 FAIL → 86 PASS / 0 FAIL / 0 UNPROVED**. Shared case/invariant pairs: **59 PASS / 5 FAIL → 64 PASS / 0 FAIL**. Totals include added successor/channel coverage rather than an identical inventory. - That campaign proves same-run and successor-run idempotency, abort/overlap handling, display isolation, and built-in/native minutes verification. The later rejected-guidance producer fix is separately covered by the focused native regression above, not claimed as part of that campaign. - Focused native follow-up tested `0903019c1131cfa29a81b4e192c3353fb65a3def` (integration `998ff42a15f` plus the display fix): **36 PASS / 0 FAIL / 0 UNPROVED**. Live Codex tool-call, minutes, abort, overlap, and same-key within/across runs passed; every accepted steer row preceded its first provider request. A controlled native-transport probe separately proved pre-wire rejection leaves no row or wire request, then same-key retry delivers exactly once. The controlled rejection probe is not claimed as live-daemon fault injection. Co-authored-by: Ayaan Zaidi <[email protected]>
…#173459) ## What Problem This Solves Fixes Advisor guidance arriving after an aborted run, or remaining queued from a stale review after a new user turn starts. ## User Impact Aborting work also cancels its in-flight Advisor review and verification. Starting a new user turn drops unfinished advice based on the preceding turn instead of delivering it later. A duplicate steering outcome never creates fallback guidance. Normal run-end fallback remains supported. ## Why This Change Was Made The lifecycle subscription treated aborted terminal events like ordinary completion, ignoring their `aborted` flag. The controller also retained in-flight reviews when a new user run replaced the previous one. These transitions now cancel the stale review at the owning controller, preventing both active delivery and fallback queueing. Duplicate keys are terminal no-ops rather than unavailable steering, so the fallback path now leaves them alone. ## Evidence - Reproduced on `4bf119f2359`: aborted `end` and `error` events left the review signal active; regression assertions failed with `expected false to be true`. - Reproduced active delivery followed by another pending review spanning a new user turn; its cancellation assertion failed on the baseline. - A duplicate-result regression also demonstrated an unwanted fallback queue entry before its repair. - All 51 Advisor tests passed, including cancellation, duplicate handling, normal run-end fallback, tool settlement, verification, and interval accounting. Combined owner checks covered 127 distinct tests; changed-file oxfmt/oxlint, scoped tsgo, Madge (0 cycles), and diff checks passed. - Final raw-evidence campaign combined this head `1fac8ffa671`, core head `5677912be70` (openclaw#173458), and display fix `07c940c6959` (openclaw#173460); tested integration `04a5747760d1e9655b73fac511ddb81fad7a3c97`. - Executable invariants: **before 80 PASS / 5 FAIL; after 86 PASS / 0 FAIL / 0 UNPROVED**. Shared case/invariant pairs improved **59 PASS / 5 FAIL → 64 PASS / 0 FAIL**; totals include different commissioning/channel coverage and the new successor-run case. - The accepted abort left zero queued notes. The overlapping user turn retained one active correction and zero queued copies. Built-in minutes review completed verification and delivered once. Provider requests, SQLite rows, and events independently establish these outcomes. - A/B behavior stayed unchanged: Advisor-on 4 tool calls / 2 repeated actions, solved; off 8 / 7, unresolved. Actual Codex tool/minutes and late-snapshot Telegram persistence/display/recipient checks passed. No active-session compaction occurred; that RPC remained refused. - The fork slice from the tested core revision is now isolated in openclaw#173489; openclaw#173458 retains steering deduplication and the later native rejected-guidance producer repair. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes background session-fork verification failing while the parent prepares its next model request.
User Impact
Advisor can finish a review and its verification across a parent-request preparation boundary instead of failing with a missing prepared-parent error. No configuration or storage migration is required.
Why This Change Was Made
The fork owner removed the current prepared snapshot as soon as another parent request began, before asynchronous payload preparation published its replacement. A review could finish inside that gap while verification found no snapshot.
Keep the last committed snapshot for the same run and transport until atomic replacement. New runs/transports still retire the previous snapshot; reset/delete revocation and existing TTL, count, and byte bounds remain intact. Ordinary run-end disposal already preserves provider resources, so no attempt-stream-settle change is needed.
This independent fork slice was extracted from #173458; steering idempotency and rejected-guidance delivery remain there.
Evidence
5678421c757,keeps review and verification available while the next parent request is being preparedfailed at the verification call withCache-parity session fork requires a parent turn prepared by this OpenClaw runtime. Send a normal message first.04a5747760d1e9655b73fac511ddb81fad7a3c97: before 80 PASS / 5 FAIL; after 86 PASS / 0 FAIL / 0 UNPROVED. On shared case/invariant pairs: 59 PASS / 5 FAIL → 64 PASS / 0 FAIL; totals include differing commissioning/channel coverage.