Repository navigation
fix(state): refuse cached plugin reads after database quarantine - #173671
Conversation
A refused shared-state acquisition invalidated cached handles but left physical schema facts available to the plugin-state row cache. Retire those facts at the existing terminal-refusal owner so a quarantined database cannot become readable through that cache after schema inspection. Strengthen the existing quarantine test with a real read-only schema inspection and canonical refusal, and retain its rejection checks for lookup, lookupMany and register while adding entries/count coverage. Omitting only the new revocation reproduces a lookup resolving true; restoring it passes all 23 cases. No new latch, cache or repeated hot SQL. Settle the existing startup catalog owner before sampling the Gateway visitor run's shared retention counter, and again before exact disposal comparison. All output, positive retention and release assertions stay. This narrow fixture repair also appears in broad PRs #173523 and #173481. Proof: pnpm test src/plugin-state/plugin-state-store.test.ts --maxWorkers=1 passes 23 cases (115.57s wrapper-reported wall); its forced negative control fails at the rejection assertion (64.73s). The changed Gateway file passes all 5 cases with one worker (243.58s pnpm wall, mostly cold transforms). Core production and both owning test typegraphs, targeted typed lint, boundary lint, formatting and diff checks pass. Final P2: scoped-clean. Additional reader/retention and architecture checks continue in parallel; PR CI owns broad proof. No retries, longer timeouts or assertions removed.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR revokes physical schema facts after terminal database refusal and strengthens quarantine and Gateway lease tests. Example: Plugin state contains key k with value true, and schema inspection precedes a persisted quarantine refusal.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it repairs a current quarantine/cache inconsistency at the shared admission owner, with no introduced defect found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherPlugin-state callers use cached observations or reader workers; the shared database admission owner determines whether physical schema facts remain valid and propagates terminal refusal. flowchart TD
A[Plugin state caller] --> B[Plugin state facade]
B --> C[Cached observations]
C --> D[Physical schema admission]
B --> E[Reader workers]
E --> F[Shared state database]
G[Quarantine refusal owner] --> D
G --> E
Technical reviewBest possible solution: Retire schema facts at the existing terminal-refusal owner while preserving canonical quarantine recovery and reader routing. Do we have a high-confidence way to reproduce the issue? Source establishes the stale-schema-facts path, and the supplied regression reports the expected failure when only revocation is removed; no target code was executed during this review. Is this the best way to solve the issue? The patch repairs invalidation at its existing producer using an established revocation primitive, without adding another latch, repeated SQL, or competing state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 49ecf7082730. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests +21. Total +24 across 3 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 Reviewed October 15, 2026, 11:08 PM ET / October 16, 2026, 03:08 UTC. |
Main bd5f760 (#170534) landed the pre-sample startup-catalog join that fixes the reported visitor retention assertion. Its PR records all five plugin borrowing cases passing. Drop our already-covered Gateway hunk, resolving the differing-comment merge conflict without integrating unrelated main changes or weakening an assertion. The final PR delta is only the two quarantine files. Their reviewed source and regression are byte-identical to the proven candidate; retain the 52 focused safety/reader/retention/quarantine-cleanup passes, types, lint, full architecture and scoped-clean P2. The earlier five Gateway passes remain prior-candidate evidence; main owns that fixture repair.
…nclaw#173671) * fix(state): refuse cached plugin reads after database quarantine A refused shared-state acquisition invalidated cached handles but left physical schema facts available to the plugin-state row cache. Retire those facts at the existing terminal-refusal owner so a quarantined database cannot become readable through that cache after schema inspection. Strengthen the existing quarantine test with a real read-only schema inspection and canonical refusal, and retain its rejection checks for lookup, lookupMany and register while adding entries/count coverage. Omitting only the new revocation reproduces a lookup resolving true; restoring it passes all 23 cases. No new latch, cache or repeated hot SQL. Settle the existing startup catalog owner before sampling the Gateway visitor run's shared retention counter, and again before exact disposal comparison. All output, positive retention and release assertions stay. This narrow fixture repair also appears in broad PRs openclaw#173523 and openclaw#173481. Proof: pnpm test src/plugin-state/plugin-state-store.test.ts --maxWorkers=1 passes 23 cases (115.57s wrapper-reported wall); its forced negative control fails at the rejection assertion (64.73s). The changed Gateway file passes all 5 cases with one worker (243.58s pnpm wall, mostly cold transforms). Core production and both owning test typegraphs, targeted typed lint, boundary lint, formatting and diff checks pass. Final P2: scoped-clean. Additional reader/retention and architecture checks continue in parallel; PR CI owns broad proof. No retries, longer timeouts or assertions removed. * test(gateway): defer startup custody fixture repair to main Main f35773f (openclaw#170534) landed the pre-sample startup-catalog join that fixes the reported visitor retention assertion. Its PR records all five plugin borrowing cases passing. Drop our already-covered Gateway hunk, resolving the differing-comment merge conflict without integrating unrelated main changes or weakening an assertion. The final PR delta is only the two quarantine files. Their reviewed source and regression are byte-identical to the proven candidate; retain the 52 focused safety/reader/retention/quarantine-cleanup passes, types, lint, full architecture and scoped-clean P2. The earlier five Gateway passes remain prior-candidate evidence; main owns that fixture repair.
…3671) * fix(state): refuse cached plugin reads after database quarantine A refused shared-state acquisition invalidated cached handles but left physical schema facts available to the plugin-state row cache. Retire those facts at the existing terminal-refusal owner so a quarantined database cannot become readable through that cache after schema inspection. Strengthen the existing quarantine test with a real read-only schema inspection and canonical refusal, and retain its rejection checks for lookup, lookupMany and register while adding entries/count coverage. Omitting only the new revocation reproduces a lookup resolving true; restoring it passes all 23 cases. No new latch, cache or repeated hot SQL. Settle the existing startup catalog owner before sampling the Gateway visitor run's shared retention counter, and again before exact disposal comparison. All output, positive retention and release assertions stay. This narrow fixture repair also appears in broad PRs #173523 and #173481. Proof: pnpm test src/plugin-state/plugin-state-store.test.ts --maxWorkers=1 passes 23 cases (115.57s wrapper-reported wall); its forced negative control fails at the rejection assertion (64.73s). The changed Gateway file passes all 5 cases with one worker (243.58s pnpm wall, mostly cold transforms). Core production and both owning test typegraphs, targeted typed lint, boundary lint, formatting and diff checks pass. Final P2: scoped-clean. Additional reader/retention and architecture checks continue in parallel; PR CI owns broad proof. No retries, longer timeouts or assertions removed. * test(gateway): defer startup custody fixture repair to main Main bd5f760 (#170534) landed the pre-sample startup-catalog join that fixes the reported visitor retention assertion. Its PR records all five plugin borrowing cases passing. Drop our already-covered Gateway hunk, resolving the differing-comment merge conflict without integrating unrelated main changes or weakening an assertion. The final PR delta is only the two quarantine files. Their reviewed source and regression are byte-identical to the proven candidate; retain the 52 focused safety/reader/retention/quarantine-cleanup passes, types, lint, full architecture and scoped-clean P2. The earlier five Gateway passes remain prior-candidate evidence; main owns that fixture repair. (cherry picked from commit e51c322) Co-authored-by: RomneyDa <[email protected]>
Related: #168635, #168999, #173534
What Problem This Solves
Plugin-state reads can return cached values after shared-state database acquisition has refused a persisted quarantine.
User Impact
Quarantined plugin state remains unavailable through the keyed-store cache. The existing repair owner, reader-pool routing and ordinary cache performance are preserved.
Why This Change Was Made
The terminal-refusal owner invalidated cached handles without retiring physical schema facts that acquisition could publish before discovering quarantine. Those facts could still authorize the plugin-state row cache. Revoke them at that existing owner; introduce no new latch, cache, schema, dependency or hot-path SQL.
The lookup/lookupMany cache shortcut was added in
841272e230d0(#168999), before the latest hourly's 22-commit window. Its failure-latch/schema-admission guards intended to preserve quarantine refusals. Earlier #168635 explicitly accepted that "A cached observation may retain its last committed value after a terminal database refusal is recorded" as a follow-up; the later lookup guard and existing quarantine test require fail-closed reads. This repair completes canonical revocation without removing the cache or weakening that contract. The suggested extension cleanup and ambient UI memory-type commits do not change these owners.The existing quarantine test forces the unsafe acquisition shape with a real read-only schema inspection followed by canonical refusal. It retains lookup, lookupMany and register rejection assertions and adds entries/count checks. The final change is only these two quarantine files (+22/−1 lines).
Evidence
161bd95c1d22reproduced it: 22 passed / 1 failed, resolving[{ ok: true, value: true }]instead of rejecting.truewhen only the new revocation is omitted (64.73 s wrapper). With revocation restored, all 23 cases pass:pnpm test src/plugin-state/plugin-state-store.test.ts --maxWorkers=1(115.57 s wrapper-reported wall, including artifact-lock cleanup wait).pnpm check:architecturepasses, including zero runtime/Madge cycles, SQL generation and Kysely/legacy-store guards. Independent P0–P2 review is scoped-clean.bd5f760aecae(fix(agents): honor exact NO_REPLY and drop fabricated turn-ending replies #170534) already fixes the separately reported Gateway retention-sampling fixture. Its diff and body (five borrowing cases passed) were verified; that covered hunk is omitted here. Dropping it resolves the differing-comment merge conflict without rebasing unrelated main changes. The two retained files are byte-identical to the proven/reviewed candidate; their proof is reused.Exact-head PR CI supplies broad proof. The first run belongs to prior head
00874bc3ae59; it is not claimed as CI for the conflict-repair head. No CI rerun, timeout increase, skip or assertion removal. The follow-up push changes source solely to remove the landed peer fix and resolve a real merge conflict.