Skip to content

fix(native): the archive, tombstone and export bounds make room instead of refusing (HACK-2576) - #1137

Draft
roodboi wants to merge 5 commits into
fix/native-retained-run-and-cache-boundsfrom
fix/native-archive-chain-bounds
Draft

roodboi wants to merge 5 commits into
fix/native-retained-run-and-cache-boundsfrom
fix/native-archive-chain-bounds

Conversation

@roodboi

@roodboi roodboi commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

HACK-2576: the chain behind #1136, stacked on #1136's branch. Each step used to refuse at its bound with no hack way out.

What it does at each bound:

  • Archive (256, run/graph-archive): retention::make_archive_room, called by archive_with under the caller's lease, exports the oldest archived removed runs and then prunes them, with the same proofs graph export and graph prune make. Each run keeps its consumed-ID tombstone.
    • An interrupted prune is resumed: its tombstone is written and its receipt may already be gone.
    • An interrupted export is redone; its .pending file is kept as -recovery, as graph reconcile-export does.
  • Tombstones (4096, run/graph-consumed): the oldest tombstones of fully pruned runs (no archive left) are removed.
    • Why that is safe: a tombstone only makes a fresh start with that id refuse. The CLI makes every fresh id from 128 random bits at that start, and a restore needs the run's receipt, which pruning already removed.
    • What changes: inspecting such an id then reports graph_unreserved, and a stale startup record of the CLI for it is retired as never reserved. Nothing of the run is left either way.
  • Exports (exports/graphs): an export of a fully pruned run is diagnostics, like the 7-day host-command records. It is kept 7 days, at most 256 of them, oldest first. An export a prune still needs, a .pending file and recovery files are never removed.

Housekeeping never blocks a start: tombstone room and export trimming are best-effort and run only at the archive bound.

What can still refuse: only archived runs that can't be proven, for example ones archived under an earlier guest incarnation whose owner no longer matches, keep their place. If 256 of those fill the archive, graph_archive_budget still refuses, and it now names graph export and graph prune.

Review: one reviewer (a Claude subagent, read-only) over two rounds; the last is clean.

  • Fixed:
    • prunes and exports that crashed partway now resume;
    • housekeeping no longer blocks a start, and runs only at the bound;
    • the tombstone comment now says what changes;
    • the docs no longer claim the chain never refuses.
  • Accepted residuals:
    • -recovery directories (only after crashes) are not trimmed;
    • no engine test of make_archive_room itself.

Tests (Linux, retention::chain_tests):

  • a full archive offers its removed and interrupted runs oldest first, and never a run that isn't removed;
  • a full tombstone store drops only its oldest fully pruned entries;
  • exports of fully pruned runs expire, and other exports are never removed.

Clippy is clean on Linux and aarch64-apple-darwin --all-targets.

Docs: the guide explains the chain and what it does at each bound.

Not covered: a real engine, and the VM.

retention chain

SVG · source

🤖 Generated with Claude Code


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

roodboi and others added 4 commits November 23, 2026 02:30
…ad of refusing (HACK-2576)

With #1136 a new run archives removed runs, which moves the dead end to
the archive's 256 bound (`graph_archive_budget`), then the 4096
consumed-ID tombstones (`graph_consumed_budget`).

- At 256 archived runs, the oldest archived removed runs are exported
  (as `graph export`) and pruned (as `graph prune`), under the lease the
  archiving caller holds; each keeps its consumed-ID tombstone.
- At 4096 tombstones, the oldest tombstones of fully pruned runs go. A
  tombstone only makes a fresh start with that run id refuse; the CLI
  makes every fresh id from 128 random bits at the start and a restore
  needs the receipt pruning removed, so nothing can name such an id.
- Exports of fully pruned runs are diagnostics: kept seven days, at most
  256, oldest first; an export a prune still needs is never removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing never blocks a start (HACK-2576)

Independent review: an archived run whose prune stopped after its
tombstone, or whose export stopped before its rename, kept its slot for
good. Both are now resumed. Tombstone and export housekeeping are
best-effort and run only at the archive bound. The tombstone note says
what removing one does change (inspect reports graph_unreserved), and
the docs and the remaining refusal name the one case that can still
fill the archive: runs archived under an earlier guest incarnation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oldest first (HACK-2576)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hack-docs Ready Ready Preview Nov 23, 2026 2:40am UTC

Request Review

@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

HACK-2576

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roodboi

roodboi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Ready for lead: #1137 (draft) at 34c7b5f304, the chain behind #1136, closing the 256-archive and 4096-tombstone bounds. ls-remote matches. It's stacked on #1136's branch at ec0696cacb, which is unchanged. About 190 source lines plus tests, docs and the chart. The review was clean after two rounds; the PR body lists what was fixed and the residuals I accepted.

Your decision, as built:

  • At 256 archived runs: the oldest archived removed runs are exported into the home's exports/graphs, then pruned. Each keeps its consumed-ID tombstone.
  • Exports of fully pruned runs: kept 7 days, like the host-command records, and at most 256 of them.
  • At 4096 tombstones: the oldest of fully pruned runs go. The PR body says why that is safe, and the one visible change: inspect of such an id then reports graph_unreserved.

What can still refuse: only archived runs that can't be proven, such as ones archived under an earlier guest incarnation whose owner no longer matches. If 256 of those fill the archive, graph_archive_budget refuses, and the message now names graph export and graph prune. That is a way out, though not a hack command. If you want that closed too, my default would be to treat a removed archived run from another incarnation as prunable once its export proves it removed. That needs an owner decision, because it relaxes the owner identity check.

Testing at these bounds: reaching 256 archives on the VM needs over 300 removed runs, so the Linux tests carry this one: archive selection, tombstone room, and export expiry. A VM run can still cover the 66-run case of #1136 on this head.

Next for me:

  1. The 64-cache-volume PR. The branch fix/native-cache-volume-bound is pushed, with a WIP commit and no PR yet.
  2. Then the three plausible rows.
  3. Then HACK-2572's missing state.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant