Skip to content

fix(native): report cross_boot_stop only for a stop the recovery finishes (HACK-2757) - #1291

Open
roodboi wants to merge 2 commits into
nextfrom
claude-lead/cross-boot-stop-tighten
Open

roodboi wants to merge 2 commits into
nextfrom
claude-lead/cross-boot-stop-tighten

Conversation

@roodboi

@roodboi roodboi commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes HACK-2757: the review follow-ups from #1290. graph foreground-owner now reports cross_boot_stop only for a stop the recovery really finishes, so the advice never names a refused hack down --recover.

Changes

  1. Current boot while the pool runs (dead_owner_cleanup::interrupted_stop). The pool's current boot no longer counts while the pool is running. The cross-boot recovery never selects it, so an owner that died during its stop while its VM kept running is no longer reported as a cross-boot stop. The retained-start preflight and the lost-start advice no longer send it to hack down --recover. Two boots still count: a stopped pool's last recorded boot (a provider lost with its VM leaves the pool recovered-unclean with that boot) and earlier boots. New test: an_owner_that_died_while_its_vm_kept_running_is_not_a_cross_boot_stop.

  2. Selection check (bridges::cleanup::interrupted_stop_provable). While the registry still records the run's slots, capture_previous_boot uses those, and so does this check. Otherwise the persisted selection must pass the checks that capture applies to it:

    • this pool owner, and the old boot;
    • no previous_boot and no predecessor proof;
    • this run and plan, and this bridge capacity;
    • a serial the registry has reached;
    • bindings that validate_bindings accepts: route assignments running on that boot, with their helper evidence.

    An empty selection also needs a settled relay startup. New test: an_interrupted_selection_is_admitted_only_as_capture_previous_boot_admits_it. The HACK-2746 test now also refuses another plan, capacity or boot, a previous_boot, and a route without helper evidence. In the retained-start preflight test, the old bare {"version":1} file now names no command; a selection the capture accepts names the down.

  3. Doc wording. The receipt is admitted by interrupted_enrollment in execute and in archive_completed_prior. The explicit cleanup's prepare refuses it.

  4. Advice text. A ready-stage loss that names no command now says why, through a new withheld reason: an unprovable relay (as before); a stop the runtime reports it cannot finish (its relay cleanup marker names no ended boot of the pool, or the saved bridge selection is missing or does not match); or a runtime too old to report cross_boot_stop. New test: a ready-stage loss that names no command gives its reason.

  5. Model. New negative control old-stop-advice (StopAdvice = FALSE): the runtime that finishes the interrupted stop, paired with the message that always named the down. It fails NoRefusedAdvice at Stopping for a stop with no persisted route and an unsettled relay.

Validation

  • Mac:
    • Focused bun tests pass, root typecheck passes, and check passes with 111 warnings, the same as next.
    • cargo +1.97.1 fmt --check passes, and clippy -D warnings passes with default features and with --all-features.
    • The runtime-core provider::graph tests under the native-bench lock: 732 pass, including the three new or changed Rust tests (they sit in macOS-only modules).
    • test:models passes, including old-stop-advice. privacy:check and gitleaks are clean.
  • Linux (the repo's toolchain image, --init, at a8369fc8): fmt, both clippy runs, test-runtime-core.sh with default features and with --all-features, and test:models (old-stop-advice verified) pass. The head differs from a8369fc8 only in a test in the macOS-only retained_startup module, which Linux does not build.
  • VM rows to run: an owner killed while its VM keeps running, during a Ctrl-C stop (expect no hack down --recover advice and no automatic recovery by hack up), and the HACK-2746 rows again.

🤖 Generated with Claude Code


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

…shes (HACK-2757)

Review follow-ups from #1290:

- `cross_boot_stop` no longer counts the pool's current boot while the pool
  runs. The cross-boot recovery never selects it, so an owner that died
  while its VM kept running is not sent to `hack down --recover`. A stopped
  pool's last boot, and earlier boots, still count.
- The persisted bridge selection must pass the checks
  `capture_previous_boot` applies to it (`interrupted_stop_provable`): this
  pool owner, the old boot, no `previous_boot` or predecessor proof, this
  plan and bridge capacity, a serial the registry has reached, and
  bindings that `validate_bindings` accepts (route assignments running on
  that boot). An empty one needs a settled relay startup.
- The doc cites `execute` and `archive_completed_prior`, where the receipt
  is admitted, not `prepare`, which refuses it.
- A ready-stage loss that names no command says why (`withheld`): an
  unprovable relay, a stop the runtime reports it cannot finish, or a
  runtime too old to report it.
- ForegroundLossRecovery gains the `old-stop-advice` negative control
  (`StopAdvice = FALSE`): the new runtime with the old message, which
  fails `NoRefusedAdvice` at `Stopping`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roodboi roodboi added the ci:mac Run macOS checks for this pull request label Nov 27, 2026
@vercel

vercel Bot commented Nov 27, 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 27, 2026 9:01pm UTC

Request Review

@linear-code

linear-code Bot commented Nov 27, 2026

Copy link
Copy Markdown

HACK-2757

@roodboi

roodboi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T21:02:29.382880Z d72ea3a Manual request
🔒 Security Review ✅ Completed 2026-11-27T21:05:16.961883Z d72ea3a Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: a3dfd245ee

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: a3dfd245ee

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

…top (HACK-2757)

#1291 review (High): a provider SIGKILLed with its VM leaves the pool record
`running` with the dead boot until `runtime recover` writes
`recovered-unclean`, and `runtime status` reads it `process-exited`. The
current-boot exclusion skipped that boot too, so the owner's lost-VM advice
and a plain `hack up` lost `hack down --recover`. That undid #1290's
real-VM rows 1 and 2.

Now the current boot is skipped only while it is live: the record says
`running` and the provider is not proven gone (`identity::provider_gone`,
the check `runtime status` makes). An unreadable provider counts as live,
so nothing is promised then. The tests cover a `running` record with a
dead provider (a cross-boot stop, and `hack up` names the down), and a live
provider (neither).

The case where the VM really keeps running still has no supported recovery.
It is filed as HACK-2763.

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

roodboi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Review fix (High) in d72ea3ad: a killed provider's boot now counts as ended.

  • Cause. A provider SIGKILLed with its VM leaves the pool record running with the dead boot until runtime recover writes recovered-unclean. The current-boot exclusion checked only phase == "running", so it skipped that boot too. The owner's lost-VM advice and a plain hack up then lost hack down --recover, which undid fix(native): finish a Ctrl-C stop lost with its VM through hack down --recover (HACK-2746) #1290's real-VM rows 1 and 2.
  • Fix. interrupted_stop now skips the current boot only while that boot is live: the record says running and the provider is not proven gone. This is the same identity::provider_gone check that runtime status uses to report process-exited. If the provider's state can't be read, the boot counts as live, so nothing is promised.
  • Tests:
    • an_owner_that_died_while_its_vm_kept_running_is_not_a_cross_boot_stop_but_a_killed_provider_is: a running record with a dead provider is a cross-boot stop; with a live provider it is not.
    • a_remaining_publication_names_its_owner_state_without_effects: in the same two states, hack up's retained preflight names hack down --recover (graph_foreground_owner_exited) or names nothing.
    • Putting fix(native): report cross_boot_stop only for a stop the recovery finishes (HACK-2757) #1291's phase == "running" rule back fails both tests.
  • The case where the VM really keeps running (the owner died during its stop with the provider alive): no supported path finishes it. recover-live-owner refuses cleanup-intent and any receipt with relay_cleanup. The cross-boot recovery never selects a live boot. Stopping the pool first might make it a cross-boot stop, but runtime down refuses while runs are live, and --force would stop other projects. So the advice keeps naming no command, and the gap is filed as HACK-2763.

Gates at d72ea3ad:

  • Mac:
    • Root typecheck passes, and check passes with 111 warnings, the same as next.
    • Focused bun tests: 479 pass.
    • cargo +1.97.1 fmt --check passes, and clippy -D warnings passes with default features and with --all-features.
    • provider::graph tests under the native-bench lock: 732 pass.
    • privacy:check and gitleaks are clean.
  • Linux (toolchain image, --init, on the build volume, at d72ea3ad): fmt, both clippy runs, test-runtime-core.sh with default features and with --all-features, and test:models (old-stop-advice verified) pass.

@roodboi

roodboi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: d72ea3ad0b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: d72ea3ad0b

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@roodboi

roodboi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Real-VM results at d72ea3ad (Apple Silicon, pinned SmolVM 1.35.4, fresh isolated homes)

All rows use webdb: a foreground hack up reaches ready, then Ctrl-C goes to the process group. About 50 ms later, while the graph's state.json reads cleanup-intent, either the provider or the graph owner is SIGKILLed.

Verdict: rows 1, 2, 4 and smoke PASS. Row 3 names no recovery command, and up and runtime down both refuse. The exact texts are below for your call.

Row Observed Result
1. Provider killed during the Ctrl-C stop at cleanup-intent, then hack down --recover, ×3 exit 1 in 0.13 s; the advice names hack down --recover. That exits 0 in 2.72, 2.65, 2.71 s ("services stopped · data retained"); ps shows stopped-data-retained; hack up ready, row kept. 3 of 3 PASS
2. The same, then a plain hack up ready; "The native runtime had stopped under this run. It was started and the run was recovered with data retained; starting it again."; web 200, row kept PASS
3. Graph owner SIGKILLed during the Ctrl-C stop at cleanup-intent; provider stays alive the foreground exits 1 in 0.16 s with: "Native retaining shutdown is incomplete; retained state and mapping require inspection. No uncertain stop was replayed. Inspect with hack doctor --native-cleanup inspect and follow explicit owned cleanup recovery; do not repeat down or restart the pool blindly." Neither hack down --recover nor hack up is named; the only command named is the read-only hack doctor --native-cleanup inspect. The provider is still alive; ps shows phase=cleanup-intent, db=exited, web=running. see below
3. … then hack up -d exit 1, no automatic recovery: "E_STARTUP_INCOMPLETE: Native detached startup failed (graph_foreground_owner_exited_unadmitted)… Data is retained, but no supported command can prove and retire that attempt yet; keep the native home unchanged for inspection. The native VM pool may still be running; when no other native project uses it, stop it with runtime down --json on this native home." as expected
3. … then runtime down --json exit 2, refuses: runtime_down_live_runs, "Native project runs are running in this pool …, so runtime down stopped nothing. Run hack down in each project first (hack down --recover for a run whose hack up has exited), or runtime down --force to stop the pool under them…". Afterwards ps is unchanged (cleanup-intent, web still running, provider alive) refuses, nothing changed
4a. #1279 no-port unsettled relay (killed while relay_startup.app reads prepared) advice: "no hack command can retire a run lost at that point yet"; a plain down does not start the pool PASS (unchanged)
4b. #1279 HACK-2719-era loop (run started on next c62f4350, provider killed 2 s after down) up refuses ("…listed again… Run hack down --recover…"); down --recover removes the brought-back container; up ready with the row kept; a further down/up works PASS (unchanged)
5. smoke PASS

Two points for your judgement on row 3:

  1. The foreground advice names hack doctor --native-cleanup inspect, an inspection command, and no recovery command.
  2. The up refusal says to stop the pool with runtime down --json, but that refuses because the run is still live. The runtime down refusal in turn suggests "hack down --recover for a run whose hack up has exited", which the row 3 advice says not to rely on. I did not try hack down --recover here, so nothing was disturbed.

Also in that state, a hack exec … db -- psql check refused: "Native dependency refresh identity or outcome is unconfirmed". The web service kept running throughout.

Evidence: 20261127-161433, 161532, 161629-d72ea3ad-p1279-ctrlc (row 1), 161725-d72ea3ad-p1279-ctrlc (row 2), 161821-d72ea3ad-p1279-ctrlc-s0 (row 3, .keep), 161910-d72ea3ad-p1279-dep2 (4a), 161931-d72ea3ad-p1279-old (4b), 162319-d72ea3ad-smoke. Nothing was merged.

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

ci:mac Run macOS checks for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant