Repository navigation
fix(state): retire fixture reader validation before removal - #188767
Conversation
Retire root-scoped agent validation after draining fixture handles so queued observations of deleted paths cannot revoke a successor fixture after inode reuse. Keep production close and reader authority checks unchanged; exercise the actual cleanup helper in the queued-observation regression.
|
🦞👀 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 maintainer review before merge. What this changesRetire fixture-owned database validation after draining handles and before removing temporary files. Example: A removed fixture's queued filesystem observation arrives after a successor fixture reuses its physical database identity.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a concrete fixture lifecycle defect using the existing retirement owner; no actionable code or security findings remain, and exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherTest-state cleanup drains session work and database handles before deleting fixture directories; validation retirement removes the retained pathname observations that ordinary runtime close deliberately preserves. flowchart TD
A[Test fixture cleanup] --> B[Drain session work]
B --> C[Close database handles]
C --> D[Retire root validation]
D --> E[Close shared state]
E --> F[Remove fixture files]
Technical reviewBest possible solution: Use the existing root-scoped retirement operation after asynchronous drainage in both fixture cleanup paths. Do we have a high-confidence way to reproduce the issue? Source inspection establishes that current-main cleanup drains handles but retains pathname validation; the PR reports deterministic red/green coverage, although the original native timing failure did not recur naturally and no tests were run during this review. Is this the best way to solve the issue? This is the smallest complete repair: reuse the existing retirement owner at both removal boundaries and strengthen the existing regression without adding state, retries, or weaker reader checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cf83a69f74ee. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +6. Total +6 across 2 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 30, 2026, 6:35 PM ET / 22:35 UTC. |
…w#188767) Retire root-scoped agent validation after draining fixture handles so queued observations of deleted paths cannot revoke a successor fixture after inode reuse. Keep production close and reader authority checks unchanged; exercise the actual cleanup helper in the queued-observation regression.
What Problem This Solves
Fixes fixture teardown that can cause intermittent
Session reader validation does not match its current physical ownerfailures in later session-sharing tests. Related: #184243. This is a maintainer-requested investigation and fixture lifecycle repair.User Impact
No production behavior changes. Tests retire the previous fixture's validation authority before removing its files. Actual owner replacement and revoked-authority checks still fail closed.
Why This Change Was Made
Normal database close intentionally preserves physical validation and its directory observation. The test-state cleanup helper drained native/worker handles but removed the directory without retiring that retained validation. A queued observation of the removed pathname could invalidate a later fixture's receipt when Linux reused the inode. The reader then correctly refused the revoked receipt.
Use the existing root-scoped fixture-retirement owner after the async drain in both fixture cleanup paths. The existing deterministic queued-observation regression now invokes the actual cleanup helper instead of the lower-level retirement API. Runtime disposal and agent removal already revoke validation explicitly; no retry or weaker reader guard is introduced.
Evidence
PR head:
eaa44e17fc8d3b2f964834193ec97346ce23b156.4d2a9f8bb4c47da0daae7fd820cab33fa450ef7b: the actual cleanup helper leaves the observer active. It passes with the repair, including delivery of the retired observer's queued callback and preservation of the successor receipt.--maxWorkers=1 --repeats=19, alongside a bounded CPU/I/O worker (SHA-256 work and repeated 64 KiB synthetic-file overwrites). Host one-minute load 65.9–91.0. Command wall time 454.37 seconds including cold worker preparation. The original paged-title case and both replaced-source refusal cases passed all repetitions.session-store-runtime.stats.test.tsconsumer passed on the rebased PR head (1 test; 42.15-second Vitest wall including transforms). The final zero-growth regression rerun also passed (2 selected cases).pnpm tsgo:test:root: passed. Changed-file oxlint, oxfmt, and diff whitespace checks passed. Test-line ratchet passed with net delta 0 (the inherited tree is 1,042 lines above its ceiling; this patch adds none).The original native Bun/Linux timing failure did not recur naturally in the initial baseline run. The regression deterministically proves the fixture-lifecycle defect and its revocation mechanism; it does not claim to exclude every unrelated ownership race.
Runtime production LOC delta: 0. Test cleanup helper: +6 net lines; regression: 0 net lines. CPU/allocation microbenchmarks and whole-Gateway load measurements are not applicable to this harness-only repair. No live server was accessed. No schema, stored format, runtime authorization, or configuration changes.