Skip to content

fix(ci): recognize recorded mirror generations after inode reuse - #160192

Closed
vincentkoc wants to merge 1 commit into
mainfrom
fix/mirror-disposal-generation
Closed

vincentkoc wants to merge 1 commit into
mainfrom
fix/mirror-disposal-generation

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Related: #160010

Source-mirror recovery treated a directory inode as a generation ID. If the filesystem reused that inode after disposal, a valid successor was mistaken for the old slot and recovery refused to retire the old disposal record.

Under the existing allocation lock, recovery now validates the recorded generation first. A valid successor preserves its slot, contents and lock while only the exact old disposal record is removed. Same-generation disposal still requires the original identity; unknown replacements retain the existing refusals. Production +7/-9; tests +62/-0.

Validation at 080d21c85a1f6e3ac5fd7ce5d77404e537e2d1cc: deterministic real-filesystem regression failed all four receipt/lock combinations against the original source and passed with this change. All 13 relevant recovery/replacement tests passed (22.61 s wrapper); scripts typechecking, production typed lint, formatting and whitespace passed. Complete bounded Testbox comparison took 58.64 s. A fresh P0–P2 review found no actionable defect.

The fixture retains and reallocates the actual empty inode; the production allocator generates the new ID and receipt. It also holds a real SQLite slot lock during successor recovery. No production receipt, success response, or filesystem identity is mocked.

@vincentkoc vincentkoc self-assigned this Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 2:23 AM ET / 06:23 UTC.

ClawSweeper review

What this changes

The PR changes Crabbox source-mirror recovery to retire an old disposal record when a verified successor reuses its slot inode, and adds four filesystem regression cases.

Merge readiness

✅ Ready for maintainer review

Current main still uses inode identity before checking the recorded mirror generation, so this PR addresses a distinct remaining recovery defect. The focused change and regression scenarios show no actionable introduced bug.

Priority: P2
Reviewed head: 080d21c85a1f6e3ac5fd7ce5d77404e537e2d1cc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused recovery repair has credible production-path regression evidence and no identified correctness or security blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR reports that a real-filesystem fixture failed on the original recovery code and passed after the fix: it interrupts production mirror disposal, reuses the actual inode through production allocation, then exercises wrapper recovery with real SQLite lock states. The reviewer inspected that entrypoint and fixture but did not execute them; no stored-data format changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR reports that a real-filesystem fixture failed on the original recovery code and passed after the fix: it interrupts production mirror disposal, reuses the actual inode through production allocation, then exercises wrapper recovery with real SQLite lock states. The reviewer inspected that entrypoint and fixture but did not execute them; no stored-data format changes.
Evidence reviewed 8 items Introduced recovery change: The pinned PR delta validates the present slot through its recorded generation before comparing it with the old disposal identity.
Current-main behavior: Fetched main still compares the slot inode first; an inode-reusing successor can therefore reach the old-slot recovery path. Main also lacks the new inode-reuse regression case.
Ownership checks: The slot reader rejects unknown metadata and validates a receipt's key and slot identity; disposal removal rereads the exact old record before unlinking it.
Findings None None.
Security None None.

How this fits together

Crabbox prepares source copies for remote tests and reuses private mirror slots between runs. After an interrupted disposal, staging recovery reads the slot, receipt, and disposal record to decide what can be removed without disturbing a later allocation.

flowchart LR
A[Source checkout] --> B[Mirror allocation]
B --> C[Slot and receipt]
C --> D[Interrupted disposal]
D --> E[Recovery under allocation lock]
E --> F{Verified successor?}
F -->|Yes| G[Retire old record]
F -->|No| H[Check old slot identity]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +62, Other -2. Total +60 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 62 0 +62
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 7 9 -2
Total 2 69 9 +60

Review metrics

Metric Value Why it matters
Inode-reuse regression cases 4 combinations The cases vary old receipt presence and successor lock state at the recovery boundary.

Technical review

Best possible solution:

Keep generation-aware cleanup in the staging recovery owner while preserving receipt validation, the allocation lock, and refusal of unknown or same-generation replacements.

Do we have a high-confidence way to reproduce the issue?

Yes. The added fixture preserves an actual old slot inode, reallocates it with a production-generated successor receipt, and invokes the staging recovery wrapper; the PR reports baseline failure and patched success, though this read-only review did not rerun it.

Is this the best way to solve the issue?

Yes. Checking the recorded generation under the existing allocation lock addresses inode reuse while retaining identity checks for the old generation and refusals for unknown replacements.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3b8ed47b09e6.

Labels

Label changes:

  • add P2: This is a bounded Crabbox recovery bug with a fresh-capsule fallback, not a core-runtime emergency.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR reports that a real-filesystem fixture failed on the original recovery code and passed after the fix: it interrupts production mirror disposal, reuses the actual inode through production allocation, then exercises wrapper recovery with real SQLite lock states. The reviewer inspected that entrypoint and fixture but did not execute them; no stored-data format changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: This is a bounded Crabbox recovery bug with a fresh-capsule fallback, not a core-runtime emergency.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR reports that a real-filesystem fixture failed on the original recovery code and passed after the fix: it interrupts production mirror disposal, reuses the actual inode through production allocation, then exercises wrapper recovery with real SQLite lock states. The reviewer inspected that entrypoint and fixture but did not execute them; no stored-data format changes.

Evidence

What I checked:

  • Introduced recovery change: The pinned PR delta validates the present slot through its recorded generation before comparing it with the old disposal identity. (scripts/crabbox-staging.mts:1765, 080d21c85a1f)
  • Current-main behavior: Fetched main still compares the slot inode first; an inode-reusing successor can therefore reach the old-slot recovery path. Main also lacks the new inode-reuse regression case. (scripts/crabbox-staging.mts:1765, 3b8ed47b09e6)
  • Ownership checks: The slot reader rejects unknown metadata and validates a receipt's key and slot identity; disposal removal rereads the exact old record before unlinking it. (scripts/crabbox-staging.mts:700, 080d21c85a1f)
  • Production-boundary regression: The added cases drive production allocation and the recovery wrapper with the actual directory inode, production-generated receipts, and locked and unlocked SQLite slots. The PR body reports baseline failures and patched passes; this review did not execute the tests. (test/scripts/crabbox-staging.test.ts:823, 080d21c85a1f)
  • Documented fallback: The remote-proof guide says protected or interrupted mirror slots remain guarded and a run uses fresh staging when no slot can be safely reclaimed. Public docs: docs/reference/test/remote-proof.md. (docs/reference/test/remote-proof.md:214, 080d21c85a1f)
  • Feature history: Recent history shows Peter Steinberger working on source-mirror allocation and reuse; earlier history identifies Shakker with abandoned-staging recovery. These are routing signals, not proof of introduction of the exact failing line. (scripts/crabbox-staging.mts, c5b5d5ac952f)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc

Copy link
Copy Markdown
Member Author

Implemented and verified on main through #160187, squash commit 4001998. The landed tree matches the reviewed canonical repair; this narrower PR is incorporated and can be closed.

@vincentkoc vincentkoc closed this Sep 28, 2026
@RomneyDa
RomneyDa deleted the fix/mirror-disposal-generation branch October 22, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant