Repository navigation
fix: owner corrections queue behind reused child commands - #180228
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 changesReplace conclusively settled predecessor recovery claims so owner corrections can steer a reused child command. Example: Alice sends a correction while a reused child session is executing work dispatched through sessions_send.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a current command-admission bug with a focused fix; no actionable defects remain in the reviewed diff. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAgent command admission persists source and delivery custody in the session store; steering checks those facts before delivering corrections to the active execution. flowchart LR
A[Parent sessions_send] --> B[Command admission]
B --> C[Recovery claim cleanup]
C --> D[Canonical session store]
E[Owner correction] --> F[Steering authorization]
D --> F
F --> G[Active child execution]
Technical reviewBest possible solution: Use the existing cleanup owner to replace only settled predecessor custody while retaining tombstones and current-source authorization. Do we have a high-confidence way to reproduce the issue? The current-main admission predicate explains the stale-claim failure, and supplied built-Gateway traces demonstrate the trigger; this read-only review did not execute target code. Is this the best way to solve the issue? The patch fixes the claim producer through existing cleanup and persistence owners, with distinct settled, unresolved, and terminal-pending regressions and no unnecessary parallel machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ff72a99a13bf. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +54, Tests +117. Total +171 across 4 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 HistoryReviewed October 22, 2026, 12:19 AM ET / 04:19 UTC (Revision 3). |
|
@clawsweeper re-review Current head The body now embeds inspectable terminal evidence for all requested author proof: the original parent sessions_send → held child → owner correction → actual read → original-execution final red/green; forbidden-requester rejection without inheriting Alice’s claim; public users.setRole revocation preventing checkpoint-file access and the next provider request; and stable v2026.10.5 / Five regression cases, owning test types, scoped typed lint, formatting, whitespace and fresh independent P0–P2 review pass. All fixtures are synthetic and all processes joined. The body preserves the combined-red-build qualification, corrected fixture/readback assertions, Doctor diagnostic warning and scripted-provider limits. Hosted CI remains the broad gate; no live Gateway change or security-owner approval is claimed. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…80228) * fix: keep owner corrections steering reused child commands * test(agents): verify requester isolation after settled claims
Closes #180225. Related: #177698, #175763, #176245.
What Problem This Solves
A user tries to redirect a task that is already running—for example, “Use the revised file instead”—but the assistant keeps working from the old instructions and leaves the correction waiting for a later turn.
This fixes one cause of that delay: when an existing child session is reused for new work, bookkeeping from its finished task can incorrectly prevent the new task from receiving human corrections.
User Impact
The user's correction can reach the task already in progress at its next supported steering point, rather than waiting until that task finishes. The user can adjust the ongoing work without stopping it and starting over.
Work that genuinely still needs recovery or has an undelivered result keeps its existing protection. This change requires no configuration or migration and grants no additional permissions.
Why This Change Was Made
Command admission could decline to replace an older delivery claim, return the unchanged entry, and still start the new execution. Steering then rejected that execution as
stale-claim, reported asreply-owner-ended.Retire only a conclusively terminal predecessor with no outstanding delivery or recovery custody, using the existing cleanup owner. Publish the newly admitted claim only while the exact captured predecessor and session incarnation remain current. Keep the predecessor's terminal tombstone and remove its old request fingerprint. This is a focused follow-up to the merged consolidation, rather than another copy of the earlier steering repairs.
Evidence
098bb2e7916bced14070987feffbd5d842ddf1b2changes only the regression test. Production runtime captures remain pinned to208a8ca6c25499441d57b71e53ef495e5375b9ca. This follow-up changes only the existing regression: new requester facts replace settled predecessor facts, while unresolved and terminal-pending claims retain their predecessor facts.Inspect built Gateway captures, authority controls, stable-upgrade results and setup qualifications
Production source and built runtime:
208a8ca6c25499441d57b71e53ef495e5375b9ca, built on80b012dc04ae4c79936956db68a0ead1e3e462e2. New repository changes only strengthen the existing test; runtime proof remains qualified to production head208a8ca.All identities, conversations, files, credentials and inference are synthetic. These are actual built Gateway processes, public WebSocket RPC, actual
sessions_send, actual agent tool execution, and a scripted loopback HTTP provider. No operator state, private transcripts, real provider account, nonpublic endpoint, or live Gateway restart is used. Public captures below omit endpoint addresses and generated identifiers. Fixture processes were stopped and joined.Existing positive red/green capture (reused)
The pre-fix combined runtime
0bff6fe211deea8b5f7296a1a784ae4e93665768is the recorded red case, not a claim that current upstream was rebuilt. The exact focused runtime208a8cais green. The state was installed with the canonical writer while each isolated Gateway was stopped. The original child is held at its first provider response; a parent executes realsessions_send, the owner sends a normal Control UIqueueMode: "steer"correction, and the resumed child performs a real read checkpoint.Selected complete public terminal captures retained from the original run:
Before
After
The green next request contains the correction while the original run is still active, and the original run emits the final marker. There is no extra child execution. The existing original collector without the UI steering flag remains excluded from causal proof; it is not included above.
New forbidden-requester isolation
Alice and Bob are separately authenticated synthetic proxy identities. Both have
operator.read/operator.write, and the configured writer role permits only their own sessions (sessions.others: "none"). Alice publicly creates the parent and child; the child receives a settled predecessor via an offline canonical write. After real parentsessions_sendadmits a replacement claim, Bob targets Alice's child. The existing authorization guard hides that foreign session with “Session … was not found.” This proves forbidden inheritance from Alice's retained claim; it does not claim that an otherwise authorized collaborative participant must be rejected.The allowed Alice control verifies the actual checkpoint-file read and its result in the next provider request. A filesystem access-time witness is initialized to a fixed old value; no fixture code reads the checkpoint outside the agent tool. Its change in this control establishes that the witness detects the read on this host.
New revocation before provider/tool I/O
A compatible Alice correction is accepted while her first provider response remains held. An independent synthetic admin calls public
users.setRoleto revoke Alice's role before the response is released. The original execution then terminates with error; it neither accesses the checkpoint file nor issues another provider request. Previously accepted HTTP I/O is allowed to settle; the proof concerns subsequent effects.The same driver and I/O witness are used for the allowed control and revoked case. Gateway event streams did not expose tool-start events in this fixture, so tool-event counts from earlier exploratory attempts are not used as proof; the final captures use actual filesystem access and provider-request counts.
Stable persisted-state upgrade
Stable release
v2026.10.5, build1b58cb9a1b4f4353e1add63c8506db4d890962e8, runs first. Its publicsessions.createcreates a parent and three child controls with explicitparentSessionKey,spawnDepth: 1, the selected model and runtime; its canonical compiled session writer seeds settled, unresolved and terminal-pending predecessor claims. This is a synthetic compatibility dataset, not historical production data.The stable Gateway and writer are stopped and joined before the candidate's documented
doctor --fix --non-interactivemigration. Candidate startup then loads all three controls. The runtime keeps their session IDs, lifecycle revisions, labels, creator metadata, predecessor fingerprints and required tombstones. Both outstanding-custody controls remain ineligible for settled-source replacement. Real parent-to-child correction then completes in the original execution on the upgraded dataset.Post-completion readback on that same retained fixture:
[ { "kind": "settled", "sameSession": true, "validMetadataPreserved": true, "custodyPreserved": false, "terminalTombstonePreserved": true }, { "kind": "unresolved", "sameSession": true, "validMetadataPreserved": true, "custodyPreserved": true }, { "kind": "terminal-pending", "sameSession": true, "validMetadataPreserved": true, "custodyPreserved": true, "terminalTombstonePreserved": true } ]For the settled case
custodyPreserved: falsemeans it has no unresolved custody to preserve; the settled claim is intentionally replaced. Its predecessor tombstone remains and completion adds a new tombstone. The unresolved and terminal-pending controls retain their complete selected custody fields and remain protected. This exercises persisted-state compatibility through Doctor and runtime replacement, not the installed package updater or service manager.Setup qualifications: an initial direct runtime swap correctly refused schema 25 and requested Doctor. An exploratory sibling used only grouping-parent metadata (
spawnDepth: 0); its unattested root recovery claim was deliberately retired by normal startup recovery, so it was invalid for the child-custody assertion. The corrected dataset uses the same public child-creation shape as the original parent/child reproduction, not a mutation to runtime policy. The final upgrade execution passed its behavior assertions but initially failed an overly strict equality assertion because completion appended its own tombstone. A corrected read-only inspection of the same fixture verified preservation by membership plus exact equality for the unaffected fields; this is not a product rerun. Failed setup/assertion logs remain retained. Doctor emitted an original-state capture warning from inherited diagnostic output; its canonical pre-migration backups and migration completed. This evidence proves data/runtime compatibility, not the warning's repair or a complete backup-capture audit.Repository regression and checks
The existing command-admission table now seeds predecessor requester facts. Settled admission must expose the newly admitted requester's facts through the canonical reader; unresolved and terminal-pending admission must retain the predecessor requester. This supplements the actual Gateway isolation proof and does not replace it. Five tests pass in 18.40 seconds of Vitest (41.54 seconds wrapper, including cold compiler preparation). Owning agents-root test types, scoped typed lint, formatting and whitespace checks pass. Fresh independent shared-helper P0–P2 review reports
scoped-cleanwith no findings; its assessment covered supplied source snapshots and did not execute the product proof.Retained proof inputs
openclaw-normal-enter-settled-proof.mjs: SHA-256726ae503597d9af0574ab58b85a7a544d2ce6dcdbf886552d719cb89d693019f(retained current input bytes; no historical signature or attestation).gateway-authority-proof.mjs: SHA-256280afe1f9ebf508af00085ef861b5fed07fb8644743fa85cdffffa8f2e6a32c1(retained current input bytes; no historical signature or attestation).gateway-upgrade-proof.mjs: SHA-256e779f215e71dee613a482bf2126e47a5bb942b870c6e6f962807ee8132ca502d(retained current input bytes; no historical signature or attestation).stable-seed.mjs: SHA-2560989134fe854d9ad8cd851ec2a4c70d36ccb5faf6185126e4110c5890f6eadaa(retained current input bytes; no historical signature or attestation).upgrade-inspect.mjs: SHA-2568d26bd8688712e294328ddfda0363fda92ee840e1751375c76d7b0934d44ac8f(retained current input bytes; no historical signature or attestation).