Skip to content

Exit 75 only when the installed binary is replaced - #407

Draft
SashaMIT wants to merge 6 commits into
cursor/launcher-contract-1297from
cursor/host-lock-exit-1297
Draft

SashaMIT wants to merge 6 commits into
cursor/launcher-contract-1297from
cursor/host-lock-exit-1297

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The install transaction replaces the installed binary by renaming the staged file onto that path. On Linux the running path then ends in (deleted). The binary watch exits 75, and a supervisor starts elastos gateway --addr localhost:8090 again.

A moved path, a path that cannot be read, and a failed re-hash wait for one more sample. A replacement on that next sample exits 75. A second sample with the same failure exits 1. A different failure on that next sample, or a move to a different path, waits for one more sample instead (2efbfbf3): the watch records the failure it saw (WatchFailure in host_lock.rs: path unreadable, moved to a named path, unverifiable, re-verify failed) in place of the earlier shared pending_confirm flag, which let two different failures in a row exit 1. The message names elastos gateway --addr localhost:8090. That failure text does not contain changed on disk. A supervisor leaves that process stopped.

Head ddf4344e. Draft. Do not merge. Stacked on #394: this branch merges #394's head 36720070 (290a7401, a merge, no rebase), which carries the zip 9 merge, the cherry-pick of develop 50515055 and the /healthz lock-ownership fix. It then merges #394's head 4bb19dcf (27432f02, a merge, no rebase; host_lock.rs, runtime_control.rs and gateway_home_terminal.rs auto-merged). In it, the ownership proof is one step (each registry entry keeps a second descriptor of the locked open file, and the registry mutex is held from the lookup to the end of the probe; 85f3142e); the managed-runtime subordinate lane uses the same proof as /healthz, and a Home terminal gets an inherited lock descriptor, ELASTOS_GATEWAY_HOST_LOCK_FD (eed83a72); a held lock whose record cannot be read still counts as held (4bb19dcf). It then merges #394's head 13cdcad0 (ccd860f8, a merge, no rebase; docs/LAUNCHER_CONTRACT.md and host_lock.rs auto-merged, no conflict): the contract states that the host lock proves possession, not that the holder is the gateway, also for ELASTOS_GATEWAY_HOST_LOCK_FD, with two process tests (docs and tests only). It then merges #394's head d30027ed (ddf4344e, a merge, no conflict), which merges develop at bfefe92f. The diff of this PR against its base is c7592e89 (exit 75 meanings) and 2efbfbf3 (same-failure confirmation).

Tests

cargo test -p elastos-server --lib host_lock:: healthz gateway_inside_serve on 2efbfbf3: 23 passed, including a rename onto the running test binary (exit 75), one metadata miss then new bytes (exit 75), a failed re-hash that exits 1 on the second sample without the words changed on disk, and supersession_watch_confirms_only_the_same_failure_twice: an unreadable file, then a move, then a move to another path each wait (no exit), and the same move on the next sample exits 1 and names that path.

Negative proof: with the confirmation check reverted to the old meaning (if self.pending_failure.is_none(), i.e. any pending failure confirms, in confirm_stop), that test fails: panicked at crates/elastos-server/src/host_lock.rs:1022:9: a move after an unreadable file is a different failure. With the fix it passes. cargo clippy -p elastos-server --all-targets -- -D warnings, cargo fmt --all -- --check and git diff --check pass. Run on a Linux worker only.

On 27432f02: cargo test -p elastos-server --lib (host_lock, runtime_control::tests::subordinate, site_publication::test_healthz) 35 passed; cargo fmt --check OK; cargo clippy -p elastos-server --all-targets -- -D warnings clean.

On ccd860f8: cargo test -p elastos-server --lib -- host_lock:: possession home_terminal_lane subordinate_lane healthz gateway_inside_serve 32 passed, 1 ignored (the child half of #394's subprocess test, which its parent test runs), built from this worktree; cargo fmt --all -- --check OK. Clippy was not re-run on this merge.

On ddf4344e: the same test filter 32 passed, 1 ignored; cargo clippy -p elastos-server --all-targets -- -D warnings clean; cargo fmt --all -- --check and git diff --check pass. Built from this worktree.

CI

Principles check

  • P10. Exit 75 means the installed binary was replaced or its hash changed. Exit 1 means the watch saw the same move, unreadable path, or failed re-hash on two samples in a row.
  • P11. One missed sample during the rename does not strand Home, and neither do two different transient failures. A confirmed failure stops and names the recovery command.
  • P12. docs/LAUNCHER_CONTRACT.md on this branch states the exits these tests lock, including that a different failure waits again.
  • P15. This watch does not check the new bytes against the signed manifest before exit 75. Gateway start remains the verification point. A team issue owns an explicit refusal of an unsigned replacement before restart.

Intel stays C. This pull request publishes no Intel download. No grade here is a merge approval.

Team issues to open

  1. Unsigned replacement. Title: Refuse an unsigned binary before a supervisor restarts it. Body: Exit 75 tells the supervisor to start the gateway again after a hash change. The watch does not verify those new bytes against the signed manifest. Gateway start, or the supervisor, must refuse an unsigned replacement and show that refusal.
  2. Adversarial review. Title: Adversarial review for launcher process control. An independent review from a non-Cursor model family, then irzhywau, on this SHA.

The install transaction renames the staged binary onto the installed
path. On Linux the running path then ends in " (deleted)", and the
watch exits 75 so a supervisor can start the gateway again. A move,
an unreadable path, or a failed re-hash waits for one more sample.
A second sample with the same failure exits 1 and names the recovery
command. The failure text does not contain "changed on disk".

Co-authored-by: Sash <SashaMIT@users.noreply.github.com>
…-1297

Brings in the zip 9 merge, the journal test cherry-pick and the lock
ownership fix 3672007 from the base branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K
The contract says a second sample with the same failure exits 1, but the
watch kept one shared pending flag, so an unreadable file followed by a
move, or moves to two different paths, also exited 1. The watch now
records which failure it saw (and, for a move, the new path). Only the
same failure on the next sample stops; a different one waits again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K

Copy link
Copy Markdown
Contributor Author

2efbfbf3: the binary watch now records which failure it saw (and the moved-to path), so only the same failure on two samples in a row exits 1, as the contract says; a different failure waits again. 290a7401 merges #394's head 36720070.
Proof: supersession_watch_confirms_only_the_same_failure_twice fails with the old shared-flag check restored ("a move after an unreadable file is a different failure") and passes with the fix.


Generated by Claude Code

@SashaMIT

Copy link
Copy Markdown
Contributor Author

Round 3 review: PASS (B+).
Follow-up: alternating failures never confirm a result; add a deadline.

Brings in #394 4bb19dc: one-step flock ownership proof, the subordinate lane on the same proof, and a held lock with an unreadable record counting as held. host_lock.rs merged without conflict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K
@andersalm andersalm mentioned this pull request Oct 17, 2026
9 tasks
@SashaMIT

Copy link
Copy Markdown
Contributor Author

Round 4 at 27432f0: PASS (B+). Same-failure rule proven; CI green.

Brings in #394 13cdcad: the launcher contract states that the host lock
proves possession, not that the holder is the gateway, also for the
inherited ELASTOS_GATEWAY_HOST_LOCK_FD, with two process tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K

Copy link
Copy Markdown
Contributor Author

CI on ccd860f (run 39092041888): only source-home-linux (ubuntu-24.04) failed (job 117602057388, "finite installed UI journey failed"). That is the #433 x86 finite-journey failure develop 9be009b also had. #395 ac97a4a, with the same #394 code, passed this job, and #407's own 27432f0 passed it before. Every other real job passed. No fix exists yet, and I can't re-run (403).


Generated by Claude Code

@SashaMIT

Copy link
Copy Markdown
Contributor Author

Round 5 at ccd860f: PASS (A). Clean merge on #394; supersession_watch 11 pass; clippy clean.

Brings in #394's head d30027e, which merges develop at bfefe92
(develop's fix for its own #430 Home link test). No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6Qn9RX7LDqrwiAfNC2F2K

Copy link
Copy Markdown
Contributor Author

ddf4344e: merges #394's head d30027ed (develop at bfefe92f), with no conflicts; the PR diff is unchanged. Locally, 32 tests passed and 1 was ignored; clippy and fmt are clean.
Run 39092041888's attempt-2 failure was an expired artifact, not code. llama-amd64-bundle has retention-days: 1, so the failed-jobs re-run could not download it. This push starts a full run. Attempt 1 failed with #433.


Generated by Claude Code

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.

3 participants