Repository navigation
fix(state): name the owner that revoked a session reader's receipt - #204702
Conversation
Co-authored-by: obviyus <[email protected]>
|
🦞👀 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. |
Co-authored-by: obviyus <[email protected]>
|
Codex review: blocked before merge. What this changesThis PR records which database lifecycle owner revoked a validation receipt and includes that reason in session-reader failures. Example: A lease release revokes the receipt captured for agent:main:race before worker dispatch.
Review scores
ProductKind: Maintenance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR adds useful diagnostics for an unresolved receipt refusal, and source review found no discrete introduced correctness defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherSession-history readers borrow physical database validation from the agent database owner; lifecycle invalidation clears shared validity, and the worker refuses receipts that no longer match its connection. flowchart LR
A[Database lifecycle owners] --> B[Validation receipt]
B --> C[History read admission]
C --> D[Reader worker]
D --> E[Physical owner check]
E --> F[Read result or named refusal]
Technical reviewBest possible solution: Keep attribution within the existing receipt owner and preserve the current refusal semantics while using subsequent failures to identify the underlying cause. Do we have a high-confidence way to reproduce the issue? The capture-to-dispatch revocation path is explicit in source and the added real-worker test; the intermittent scheduled Bun failure itself remains unreproduced and its revoker unknown. Is this the best way to solve the issue? The focused diagnostic approach is appropriate: one shared field and one revocation operation serve existing owners without adding retries, weakening validation, or guessing at an unverified cause. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 28d42b7c570c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +97, Tests +88. Total +185 across 37 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 Reviewed November 24, 2026, 10:14 AM ET / 15:14 UTC. |
|
Maintainer override: the only red job is not caused by this PR.
|
|
Landed as 51f5626.
|
…penclaw#204702) ## What Problem This Solves `src/agents/cli-runner/history-boundary.test.ts > CLI history account > keeps refusing a legacy record that could hide an account switch` fails in about 6.5% of scheduled `main` runs (5 of about 76 since 2026-11-21, always in Bun `infra` shards) with: `Session reader validation does not match its current physical owner` The refusal said only that the receipt no longer matched. It did not say whether the receipt was revoked, by whom, or whether the file changed, so every failure was a dead end. It never reproduced locally (Node, pinned Bun, 1-CPU Linux, 4 concurrent copies). ## Change - Each agent-database validation receipt carries a shared `revokedBy` cell. Every revocation goes through `revokeAgentDatabaseValidation(validation, revoker)`, which records the first revoker before it clears `valid`. - `invalidateOpenClawAgentDatabaseValidation` now takes a required revoker name, and every caller names itself (lease release without a confirmed close, failed close, disposal, maintenance write, successor receipt, file identity change, and so on). - The worker's refusal now reads `Session reader validation does not match its current physical owner: <reason>`. The reason is `the receipt was revoked by <owner>`, or it names the agent or file identity mismatch. - No retry and no behavior change: the same reads are refused at the same point. ## What I tested about the cause - Revoking the captured receipt in the `prepareRead` hook (after capture, before dispatch) reproduces the exact CI refusal. That is the mechanism. The new test pins it and the named reason. - A real writer close inside that window does not give this error; it revokes the read itself (`Session history database read was revoked`). So an ordering fix for the previous write's close on the same path would not address the CI failure, and none is included. - Closing an unrelated, deleted database inside the window did not revoke the live receipt in this setup. - The cause therefore remains unknown. With this change, the next CI failure names the owner that revoked the receipt. ## Evidence - New `src/config/sessions/session-transcript-worker.receipt-race.test.ts`: passes, and asserts the full refusal text including the revoker. - Touched test files (23) pass; `pnpm tsgo:core` and `pnpm tsgo:test:src` pass; oxfmt and oxlint clean on changed files. - Upgrade: a receipt sealed at clean close by an older release has no `revokedBy` cell. `agentDatabaseValidationKey.read` (the one decode point for stored and restored receipts) gives it a cell once. A new test in `openclaw-agent-db-validation-cache.test.ts` revokes and reports such a receipt; without the fix it throws `Invalid atomic access index`. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
src/agents/cli-runner/history-boundary.test.ts > CLI history account > keeps refusing a legacy record that could hide an account switchfails in about 6.5% of scheduledmainruns (5 of about 76 since 2026-11-21, always in Buninfrashards) with:Session reader validation does not match its current physical ownerThe refusal said only that the receipt no longer matched. It did not say whether the receipt was revoked, by whom, or whether the file changed, so every failure was a dead end. It never reproduced locally (Node, pinned Bun, 1-CPU Linux, 4 concurrent copies).
Change
revokedBycell. Every revocation goes throughrevokeAgentDatabaseValidation(validation, revoker), which records the first revoker before it clearsvalid.invalidateOpenClawAgentDatabaseValidationnow takes a required revoker name, and every caller names itself (lease release without a confirmed close, failed close, disposal, maintenance write, successor receipt, file identity change, and so on).Session reader validation does not match its current physical owner: <reason>. The reason isthe receipt was revoked by <owner>, or it names the agent or file identity mismatch.What I tested about the cause
prepareReadhook (after capture, before dispatch) reproduces the exact CI refusal. That is the mechanism. The new test pins it and the named reason.Session history database read was revoked). So an ordering fix for the previous write's close on the same path would not address the CI failure, and none is included.Evidence
src/config/sessions/session-transcript-worker.receipt-race.test.ts: passes, and asserts the full refusal text including the revoker.pnpm tsgo:coreandpnpm tsgo:test:srcpass; oxfmt and oxlint clean on changed files.revokedBycell.agentDatabaseValidationKey.read(the one decode point for stored and restored receipts) gives it a cell once. A new test inopenclaw-agent-db-validation-cache.test.tsrevokes and reports such a receipt; without the fix it throwsInvalid atomic access index.