Skip to content

fix(native): a new run archives removed runs when 64 graph attempts are retained (HACK-2576) - #1136

Open
roodboi wants to merge 3 commits into
nextfrom
fix/native-retained-run-and-cache-bounds
Open

roodboi wants to merge 3 commits into
nextfrom
fix/native-retained-run-and-cache-bounds

Conversation

@roodboi

@roodboi roodboi commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

HACK-2576, second PR, part 1: the 64-retained-runs dead end from the audit.

Before:

  • Every run stayed in run/graphs until an explicit graph archive, which no hack command runs.
  • Each hack down --remove-data followed by up, each failed fresh start and each branch instance used a place for good.
  • At 64, every fresh up of every project refused with graph_retention_budget for ever.

Now (archive::make_room):

  • Both admission checks for a new run call it: admission.rs check_using and mod.rs check_reservations, when except is None. They already hold the provider lease.
  • At the bound it archives removed attempts, oldest receipt first, with the same proof graph archive makes (every owned resource absent, no pending journal, caches resolved), until there is room.
  • Below the bound it reads no receipt.
  • It never touches:
    • runs that keep data, are live, or have a pending journal;
    • unreadable or foreign receipts.
  • A removed run that fails the proof is skipped. Any other error (the engine, the archive's own bound) is reported as it is.
  • The refusals now say what to do:
    • runs that keep data fill the inventory: remove the data of a project you no longer use;
    • removed runs can't be proven removed: inspect them.
  • A project whose run was archived before its own down --remove-data confirmed the removal still confirms it. inspect reads a removed run from the archive, refusing any other phase there, and removing its data again is complete as it is.

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

  • Round 1 found the "archived while still mapped" lock-out. It also found engine errors being swallowed, and a wrong refusal text. All three are fixed.
  • Accepted residuals:
    • status::inspect doesn't check the archive copy's stability: it is read-only, and the run is already removed.
    • A direct runtime graph cleanup --retained-only on an archived relay-startup run can still refuse; hack down never reaches it.
    • The archive's own 256 bound remains, as a follow-up.

Tests (Linux):

  • a_full_inventory_selects_only_removed_attempts_oldest_first;
  • inspection_reads_an_archived_run_only_when_it_is_no_longer_active;
  • the existing archive tests (5 pass).

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

Docs:

  • The guide explains the inventory bound and the automatic archive.
  • The v5 limits page now says what a person sees and what to do.

Not covered:

  • the archive step against a real engine (no engine test double exists; the proof is the existing graph archive path);
  • a real-VM run.

No model change: this is a bound policy, not new state. The 64-cache-volume dead end follows in its own PR.

inventory room

SVG · source

🤖 Generated with Claude Code


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

roodboi and others added 3 commits November 23, 2026 02:06
…ts are retained (HACK-2576)

Every run stayed in `run/graphs` until an explicit `graph archive`,
which no `hack` command ran: each `down --remove-data` followed by `up`
and each failed fresh start used a place for good, and at 64 every fresh
`up` of every project refused with `graph_retention_budget` for ever.

`archive::make_room`, called by both admission checks for a fresh run
under the provider lease they already hold, archives removed attempts
oldest first with the same proof `graph archive` uses (every owned
resource absent, no pending journal) until there is room. Runs that
keep data, pending journals and receipts that cannot be read are never
touched; if runs that keep data fill the inventory, the refusal now says
to remove the data of a project no longer used. The archive's own bound
(256) is reported as it is.

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

Independent review: a fresh start may archive a removed run that its
project's `down --remove-data` has not yet confirmed; inspection then
found no active directory and that project stayed stuck. Inspection now
reads a removed run from the archive, and removing its data again is
complete as it is. `make_room` reads no receipt below the bound, reports
engine and archive errors as they are instead of swallowing them, and
names the case where removed runs could not be proven removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r site (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:17am UTC

Request Review

@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

HACK-2576

@roodboi

roodboi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Ready for lead: #1136 (draft) at ec0696cacb, the 64-retained-runs dead end. ls-remote matches. It's based on next 3f2f00e1b8 and independent of the other open PRs. About 120 source lines plus tests, docs and a chart. The review was clean after two rounds; the PR body lists what was fixed and the residuals I accepted.

A check for the VM, if you want one before the cache PR:

  1. Fill a throwaway home with removed runs: hack up, then hack down --remove-data, repeated about 64 times. A failed fresh start counts too.
  2. The next hack up must start, and <home>/.hack-local/run/graph-archive/ must gain the oldest runs.
  3. Then hack down --remove-data in a project whose run was just archived must still report its removal as done.

One decision for you or the owner. The archive keeps 256 runs, and past that graph_archive_budget refuses. The way out today is the runtime's own graph export and graph prune, one run at a time, which no hack command runs.

  • My default for the follow-up: at that bound, prune the oldest archived removed runs automatically, exporting each first as prune requires, and keep their consumed-id tombstones.
  • That deletes archived evidence of runs that no longer hold data, which is why I'm asking rather than building it.

Next for me: the 64-cache-volume dead end, as its own PR. A cache volume is shared by fingerprint across runs, so it may be evicted only when no receipt in run/graphs or run/native-graphs holds it in a non-released phase. Oldest goes first, and an unreadable receipt refuses as today.

The listing you asked how to take. The foreground transport root is /private/tmp/hkgf-<24 hex>: the first 24 hex digits of the SHA-256 of the JSON array ["hack-graph-foreground-v1", <state_root>, <run>]. For a failure, ls -la /private/tmp/hkgf-* and take the one whose owner.json names the run.

  • It holds owner.json, control.sock, operation.lock and any retirement records.
  • Because it sits under /tmp, macOS clears it at every reboot. That is the "publication gone after a host restart" case the post-reboot absent-publication recovery is for, which is separate from cycle 3 (no reboot).

@roodboi

roodboi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Lead read of ec0696c: accepted. Real VM: 66 fresh runs whose data was removed, every start worked, the home ended at 64 active runs and 3 archived, and a final up answered. The batch after next takes it (it is independent of the tested set).

🤖 Generated with Claude Code

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