Repository navigation
fix: deduplicate steering without replaying rejected guidance - #173458
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 deduplicates keyed steering and prevents rejected Codex guidance from entering later model context. Example: A plugin sends “Use the corrected result.” twice with idempotency key same-review.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs current steering defects, addresses the previous retry finding, and has no remaining actionable finding from this review. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherPlugin guidance passes through the host adapter and shared active-run queue to the selected runtime, while the transcript owner records accepted guidance for subsequent context. flowchart TD
A[Plugin workflow] --> B[Host steering adapter]
B --> C[Stored input lookup]
B --> D[Run admission owner]
D --> E[Runtime steering]
E --> F[Canonical transcript]
F --> C
Technical reviewBest possible solution: Retain the shared admission deduplication and record internal native guidance only after accepted or uncertain delivery. Do we have a high-confidence way to reproduce the issue? Fetched-main source permits duplicate queue admission and persistence before native rejection; the submitted baseline regressions report both failures, but this review executed no target code. Is this the best way to solve the issue? The repair uses the existing admission and transcript owners, releases rejected reservations, and preserves live authority checks before runtime effects. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4f5bdeb0dfe8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +78, Tests +148, Docs +8. Total +234 across 9 files. Added test files: 0. View PR surface stats
LabelsLabel 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 (2 earlier review cycles)
Reviewed October 15, 2026, 5:59 PM ET / 21:59 UTC (Revision 3). |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
5677912 to
509937c
Compare
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
## 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 - On baseline `5678421c757`, `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]>
## 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 815a0bd. |
…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 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 terminalduplicate. 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
5678421c757: sequential/concurrent duplicate-key regressions persisted one row but admitted two model-input messages.SessionManagermodel context, and caused a reloaded plugin's retry to returnduplicate. Afterward, rejected guidance is absent from both transcript and context; retry reaches nativeturn/steeronce. Accepted-then-disposed guidance still persists once.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.0903019c1131cfa29a81b4e192c3353fb65a3def(integration998ff42a15fplus 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.