Skip to content

fix: retire cancelled SQLite snapshot copies - #185443

Merged
steipete merged 1 commit into
mainfrom
solid2/fix-native-snapshot-cancellation
Oct 27, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/fix-native-snapshot-cancellation

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes snapshot-cleanup failures when a SQLite read is cancelled while its native child is preparing a private copy.

User Impact

Cancelled reads retire their private snapshots without leaving an unretirable directory or surfacing an unknown-token cleanup error. The source database stays untouched.

Why This Change Was Made

The native copy child created another staging directory beneath the surviving staging owner’s tokenized directory. Killing that child between directory creation and token creation left a nested directory the owner could not safely retire. The child now fills the directory the surviving owner already allocated. Failed copy attempts discard only their known payload files before a retry; directory and token retirement stay with the existing owner.

Direct snapshot modes, cancellation deadlines, SIGKILL behavior, source-family validation, and reader fences retain their existing contracts. No configuration, schema, or migration change is required.

Evidence

Check Result
Real staging owner/native child cancellation on base Failed with unknown snapshot token ownership after deterministic interruption
Final owning-boundary regression and cleanup/retry cases Nine passed across the two affected files, including both native cancellation modes, failed-cleanup preservation, bounded retries, and caller-owned overwrite retry; 142.47 s Vitest / 162.79 s wrapper (worker preparation 121.7 s)
Copy and native resource tests 33 passed, including existing-destination source retry, unchanged source families, reader fencing, cancellation isolation, and lost-port cleanup; 29.20 s Vitest / 35.67 s wrapper
Production and SQLite test types Passed via core and state-logging typecheck leaves
Existing direct cancellation/deadline cases Four passed, including both abort modes and sync/async SIGKILL deadlines; 28.02 s Vitest / 55.11 s wrapper
Focused lint, formatting, diff check Passed
Independent review Canonical P2 review scoped-clean; complete production diff also manually reviewed
Exact real-Gateway hovercard replay Local setup timeout at 120 seconds during Gateway startup, before browser assertions; 335.25 s Vitest. The original token error did not recur, but the local attempt did not prove the flow. The exact test subsequently passed in CI as recorded below. Shared-host load was 105.39 / 106.67 / 88.25 on 32 logical CPUs. No timeout increase or rerun.
Exact-head real-Gateway CI Run 40449279334: both real-Gateway shards passed; the original native catalog hovercard test passed in 10,622 ms. Security passed.
Inherited CI failure The sole failed root is Claude native session catalog > shows catalog header affordances only for hover or keyboard-visible focus in mocked shard 2/7. That exact test also fails on completed scheduled main run 40445322734. The tested merge leaves the mocked UI and harness trees unchanged. Landing uses the native inherited-failure route; CI remains failed.

Changed-file LOC: production 2,854 → 2,927 (+73); tests 1,901 → 2,008 (+107). The added runtime code makes the existing ownership distinction explicit; the regression drives the real worker boundary without a production test seam.

Found while validating #185369. No CI runtime reduction is claimed for this correctness repair.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 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.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T04:23:32.549548Z 3a2f5ba PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes cancelled SQLite copy children use their surviving owner's allocated directory so cleanup can retire it safely.

Example: A SQLite inspection is cancelled after its native copy child starts staging files.

  • Before: An incompletely initialized nested directory can prevent cleanup with an unknown snapshot token ownership error.
  • After: The surviving owner retires its allocated directory after the copy child exits.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused ownership repair with meaningful real-process regression coverage and no actionable findings; supplied behavior evidence is harness-based and one exact-head UI failure remains unattributed.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied evidence exercises real staging and copy children through the production owner, while the local Gateway replay failed setup.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Cancelling a SQLite inspection can leave private snapshot files that cleanup cannot retire and surface an unknown-token error.
Reason: This maintainer-authored repair restores the existing cancellation and cleanup contract without adding settings, dependencies, or persisted schemas.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a concrete snapshot ownership failure still present on main. No actionable introduced defect was found; the failed UI visibility check remains unattributed.

Priority: P2
Reviewed head: 3a2f5bad0011c0686795c62af007c0796794e1db

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The reported local Gateway replay stopped during setup; passing hosted real-Gateway jobs do not independently establish that they injected cancellation at the changed allocation boundary.
Agent review details

How this fits together

SQLite inspection callers request private snapshots through the staging owner, which allocates token-protected directories, supervises native copy children, and retires their files after readers and children finish.

flowchart TD
  A[SQLite inspection caller] --> B[Snapshot staging owner]
  B --> C[Surviving token session]
  B --> D[Native copy child]
  E[Source SQLite database] --> D
  D --> F[Owner allocated private snapshot]
  C --> F
  B --> G[Joined cleanup and retirement]
Loading

Technical review

Best possible solution:

Keep directory and token retirement with the existing surviving owner while copy children manage only their payload files.

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

The base source shows the nested allocation and token-retirement mismatch, and the PR records a deterministic real-process base failure; no target code was executed during this review.

Is this the best way to solve the issue?

The patch fixes the allocation producer using existing lifecycle owners, preserves direct-worker contracts, and retains bounded retry and cleanup-error behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e5aa4489f728.

Provenance checked

  • Surviving native resource and token custody keeps the original intent (9c93bc3: Retain native children, source snapshots, and cleanup ownership through worker loss and cancellation.)
  • Preparation failure cleanup and retry precedence keeps the original intent (7e3ba7f: Retry transient source-family changes only after cleanup succeeds, preserving cleanup failures.)
  • Shared copy generator and filesystem copy behavior keeps the original intent (9a01463: Share coherent SQLite acquisition across copy drivers while preserving source identities and independent private images.)
  • Admission invalidation before private-file deletion keeps the original intent (9d495c3: Retire cached admission facts before native snapshot deletion.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Raw commit 7e3ba7f adds src/infra/sqlite-readonly-location.ts:540 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7e3ba7fd8286; files: src/infra/sqlite-readonly-location.ts)

PR surface

Source +73, Tests +107. Total +180 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 118 45 +73
Tests 3 108 1 +107
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 226 46 +180

Review metrics

Metric Value Why it matters
Production versus test changes Production +118/-45; tests +108/-1 Growth expresses the existing directory ownership distinction and adds real-process cancellation coverage without a production test seam.

Labels

Label changes:

  • add P2: Repairs cleanup failures and leaked private snapshot directories after cancelled SQLite inspections, with limited impact on ordinary successful reads.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Repairs cleanup failures and leaked private snapshot directories after cancelled SQLite inspections, with limited impact on ordinary successful reads.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Classify the failed Claude session header visibility assertion against a matching baseline or a concrete diff-caused trigger.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 27, 2026, 12:37 AM ET / 04:37 UTC.

@steipete
steipete merged commit 76894b3 into main Oct 27, 2026
153 of 157 checks passed
@steipete
steipete deleted the solid2/fix-native-snapshot-cancellation branch October 27, 2026 04:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant