Repository navigation
fix(native): let authored hack run and interactive exec wait out another project's stop (HACK-2742) - #1285
fix(native): let authored hack run and interactive exec wait out another project's stop (HACK-2742)#1285roodboi wants to merge 14 commits into
Conversation
…her project's stop (HACK-2742) HACK-2739 made an authored finite `hack exec` wait for the provider lease in its requesting process. Authored one-off `hack run` and authored interactive `hack exec` still had only the owner's 15 s wait and reported its expiry as unconfirmed. In all three, the owner's guard (a pending signal, its own `hack down`, a changed publication or pin) could end that wait with a plain refusal, which the CLI also reported as unconfirmed although nothing ran. - `native::foreground::one_off` and `::interactive` wait up to 35 s for a free lease before they send; the interactive one passes its frontend leash as the check. - All three owner paths go through `exec::owner_command_engine`, which answers `graph_authored_exec_lease_busy`, `graph_authored_run_lease_busy` or `graph_authored_command_not_started` for a wait that ended before acquisition; later failures keep their codes. - `hack run` gets the 85 s request bound (was 45 s), the progress line, the not-run refusals and the released admission slot. - The interactive child sends its lease-wait report on its control channel as one closed event line, and its refusal report names the holder; the CLI prints the progress line and an honest refusal. - ExecStopWait.tla gains the owner's cancel (Cancellable, CancelUnconfirmed) with three controls; earlier state counts unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CK-2742) The Linux all-features test build compiles the authored exec module but not the macOS interactive requester that reads owner_pre_effect_code, so clippy reported it as dead code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…(HACK-2741) The authored exec requester test (HACK-2739) and its compose sibling in command_lease_tests held the lease for 600 ms against a 700 ms bound. The retry loop sleeps up to 50 ms and checks the deadline before each attempt, so on a hosted macOS runner the caller could give up just as the lock was freed (provider_busy after about 0.75 s on next). As in #1280, the hold stays and the positive case gets 500 ms of slack, ten capped poll intervals; the expiry case asserts its exact refusal only after its deadline has passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-lead/authored-run-waits-out-stop
|
@codex review |
|
Head 8c139fd: merged #1286's branch in (HACK-2741 test slack, so hosted macOS Candidate core is not red from the inherited #1278 test). The two expiry tests this PR added now assert their exact refusal only after the deadline. Checked on this Mac under the native-bench lock, |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Real-VM results at
|
| Row | Observed (this head) | next cd2e21fd |
Result |
|---|---|---|---|
1. Authored hack run worker sh -c 'echo …' in Y during X's 30 s stop, ×3 |
one line "Waiting for the native runtime lock, held by a project stop. This command continues once it is released (up to 35 s).", then the command's output; exit 0 after 29.7, 29.3, 29.3 s | exit 1 after 15.1 s: "Native authored run completion is unconfirmed…", 3 of 3 | PASS |
2. Authored interactive hack exec worker -- /bin/sh in a pty during X's stop |
the same single progress line, then the shell prompt after 29.1 s. echo works, exit returns 0. The pty is back to icanon echo afterwards |
exit 1 after 15.2 s: "Interactive exec could not confirm admission or completion (native_graph_foreground)…" | PASS |
3. operation.lock held 45 s (flock): hack run |
exit 1 after 35.1 s: "E_LIFECYCLE_FAILED: hack run could not acquire the native runtime lock (provider_busy); nothing ran." / "Holder: unavailable." / "Retry hack run once the holder finishes." No "unconfirmed", no command output. hack ps shows only worker afterwards |
"unconfirmed" after 15.1 s | PASS |
| 3. The same: interactive exec in a pty | after one progress line, exit 1 after 35.1 s: "hack exec could not acquire the native runtime lock (provider_busy); nothing ran." / "Holder: unavailable." / "Retry hack exec once the holder finishes." No "unconfirmed". Terminal not left raw (icanon echo after exit). Marker absent (touch never ran) |
"could not confirm admission or completion" after 15.2 s | PASS |
4. Y's own hack down while a run waits on the lock (lock held 15 s, run started, down 3 s later) |
the run prints the progress line, then after 24.6 s exits 1 with "E_LIFECYCLE_FAILED: Native authored run completion is unconfirmed; command effects may have occurred and its one-off container may remain until down." The down exits 0 after 21.8 s ("services stopped · data retained") |
the run fails "unconfirmed" after 3.1 s | FAIL |
5. Latency, nothing holding the lock, 20× run and 20× exec, order head, next, next, head |
run medians 0.325 / 0.32 s, exec 0.28 / 0.285 s; no progress line in any of the 80 calls |
run 0.335 / 0.33 s, exec 0.30 / 0.29 s |
PASS |
6. Finite hack exec during X's stop |
one progress line, output, exit 0 after 29.3 s | the same (from #1278) | PASS |
7. smoke |
PASS |
Marker files: for rows 1 and 3 I first used an authored project with persistent /data storage, so hack run could leave a marker. On that project, hack run fails at once as "unconfirmed" (0.10 s, nothing holding the lease) and hack exec takes ~16 s, on this head and on next alike. Filed as HACK-2752. So the busybox project's command output is the proof that the command ran (row 1) or did not run (row 3).
Evidence: 20261126-191440-8b0bca62-p1285-s0 (rows 1, 3 run, 4, 6), 20261126-193424-8b0bca62-p1285-pty-s0 (rows 2, 3 interactive), latency …190802-8b0bca62, …190906-cd2e21fd, …191012-cd2e21fd, …191117-8b0bca62 (p1285-lat), smoke 20261126-191221-8b0bca62-smoke-s0; next: 20261126-192139-cd2e21fd-p1285-s0, 20261126-193729-cd2e21fd-p1285-pty-s0.
Harness false failures, fixed and rerun: the harness sets HACK_NO_INTERACTIVE=1, which forced finite exec in the first pty runs. The first pty driver also could not read termios after the session ended.
Nothing was merged.
…end as not started (HACK-2742) VM row 4: Y's own `hack down` ran while a Y `hack run` waited for the lease. After the wait, the requester found the owner's pin gone (Pin::load or pin.connect in request_selected, pin.connect in the interactive requester) and returned the plain refusal, which the CLI reported as "unconfirmed", although nothing had been sent. Every requester failure before the request is written now answers graph_authored_command_not_started: for finite exec and run as the cause of the native_graph_foreground refusal, for interactive exec as the report code. Status, observe, logs and cleanup keep their refusals. A failure after the write, including an owner that accepted and then exited, keeps "unconfirmed". The CLI's not-started line now says the owner stopped or changed before the command was sent or started. Review L4: the call sites go through owner_exec_engine and run::owner_engine, and tests check that each passes its own command; the interactive requester's forwarding of owner codes is a tested function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Head 73a1a61 fixes VM row 4 (the review's L1) and adds the L4 tests.
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Linux x86_64 at 73a1a61 (toolchain image, |
Real-VM rerun at
|
| Row | Round | Observed | Result |
|---|---|---|---|
4. hack run waiting on the lock while Y's hack down runs |
1 | exit 1 after 24.7 s: "hack run did not start: the project's owner stopped or changed before the command was sent or started (graph_authored_command_not_started); nothing ran." / "Check hack ps, then retry hack run once the project is up." ps: not_started, no entries |
PASS |
| 2 | exit 1 after 24.7 s: "Native authored run completion is unconfirmed; command effects may have occurred and its one-off container may remain until down." The command's output never appeared; ps is clean (not_started) |
FAIL | |
| 3 | the same as round 2 | FAIL | |
4b. Interactive hack exec worker -- /bin/sh in a pty (interactive mode on), same timing |
1 | exit 1 after 24.6 s: "hack exec did not start: …(graph_authored_command_not_started); nothing ran. Check hack ps, then retry hack exec once the project is up." Terminal restored (icanon echo); ps clean |
PASS |
| 2 | exit 1 after 24.7 s: "No receipt is currently retained for session 4c4c…. Interactive exec could not confirm admission or completion (session_cleanup_uncertain); no request was replayed." Terminal restored; ps clean |
FAIL (no did-not-start message) | |
1. hack run during X's 30 s stop |
one progress line, output, exit 0 after 29.4 s | PASS | |
7. smoke |
PASS |
In every round the down exits 0 in about 21.8 s, and the shell or command never ran. So the wrong text claims an uncertainty that is not real. The behaviour depends on timing: the same sequence produces the right message in round 1 and the old one in later rounds.
Evidence: 20261126-201450-73a1a613-p1285-r4-s0 (.keep), smoke 20261126-*-73a1a613-smoke-s0. Nothing was merged.
…ACK-2742) VM row 4, later rounds: the requester connected while Y's owner was busy in its own `hack down` cleanup, so its request sat in the listen backlog. The owner then saved its run as removed, retired its publication and exited without accepting it. The requester's read (or write) failed after the send, and the CLI said "unconfirmed" (run) or "could not confirm admission" (interactive), although nothing ran. The owner serves one request at a time and answers each before it takes the next, and it leaves its loop only through a cleanup that saves the run as removed and then retires its publication. So a connection the owner closed without a single byte of answer, followed by that retirement and a removed run, was never processed. The finite requester now peeks for the first byte (consuming nothing) and the interactive handoff tells a close with nothing received apart; with that owner evidence both answer graph_authored_command_not_started. An owner that is still published, or that sent any part of an answer, keeps "unconfirmed". Tests reproduce the row deterministically: a requester left in the backlog of an owner that ends through cleanup (finite exec, run and interactive), plus a stale pin with a dead socket, an owner that read the request and dropped it while still published, and a partial answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (HACK-2742) The backlog proof treated an unanswered close followed by a retired publication and a removed run as proof that nothing ran. Two rare paths could satisfy it falsely: - Dead-owner recovery saves the run removed and archives the publication as `control-<fp>.retired.sock` / `owner-<fp>.retired.json`, which looked like the owner's own retirement. The proof now also requires that no archived publication path exists (`verify_retired_by_owner`). - An interactive session the owner had started, whose descriptor handoff then failed with no byte sent, closed the connection unanswered. The owner now sends an empty handoff and the bound reply in that case, so the requester answers a retained session; and the requester's proof also requires that no retained receipt exists for this session. Tests: a recovery-archived retirement stays unconfirmed (both archive names), and a present session receipt stays session-correlated. Both fail with the guards disabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cklog request (HACK-2742) The test closes the owner's listener as soon as the connection is pending, so the requester's write races the close. When the write loses, the error is the transport's `graph_owner_recovery`; when the read loses, it is `native_graph_foreground`. Both are correct. The test now rules out only the not-started answer (code and cause), whichever step fails first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bedbedf81b
ℹ️ 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".
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Real-VM rerun at
|
| Row | Observed | Result |
|---|---|---|
4. hack run waiting on the lock while Y's hack down runs, ×5 |
every round: the progress line, then exit 1 after 24.5 to 24.7 s: "hack run did not start: the project's owner stopped or changed before the command was sent or started (graph_authored_command_not_started); nothing ran." / "Check hack ps, then retry hack run once the project is up." No "unconfirmed", no "container may remain". The down exits 0 in about 21.7 s; hack ps shows not_started with no entries. 5 of 5 |
PASS |
4b. Interactive hack exec worker -- /bin/sh in a pty (interactive mode on), same timing, ×3 |
every round: exit 1 after 24.6 s with "hack exec did not start: …(graph_authored_command_not_started); nothing ran. Check hack ps, then retry hack exec once the project is up." No "unconfirmed" or "could not confirm". Terminal restored (icanon echo); ps clean. 3 of 3 |
PASS |
1. hack run during X's 30 s stop |
one progress line, output, exit 0 after 29.3 s | PASS |
7. smoke |
PASS |
Evidence: 20261127-112652-bedbedf8-p1285-r4-s0, 20261127-113244-bedbedf8-smoke-s0. Nothing was merged.
…run-waits-out-stop # Conflicts: # packages/runtime-core/src/provider/engine/command_lease_tests.rs # tests/native-interactive-exec.test.ts
|
@codex review Merged
Gates at 760d698:
No product code changed in the resolution, so the VM evidence at bedbedf still stands. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…ner acceptance (HACK-2742)
Codex review P1: a command whose stdout reached the 1 MiB cap produced a
reply of about 2.8 MB of base64. The owner serialized it into the
1,081,344-byte request buffer, so the write failed with nothing sent, and
the error was ignored. If the owner then ended through its cleanup, the
requester's proof ("closed with no byte, then retired by the owner, run
removed") reported the command as not started although it had run.
Replies: a command reply is written with its own 4 MiB bound, which holds
two capped streams and their receipt (checked at compile time), the size
the requester already reads. A failed reply write is reported value-free on
the owner's standard error.
Proof: the owner now accepts each command with one byte, after it read and
validated the request and before any effect, and drops a command whose byte
it cannot queue. Commands carry request version 3; status, observe, logs
and cleanup keep version 2, and the owner still serves version-2 commands
from older requesters without the byte. A requester reports not started
only when the connection closed with no byte at all, which proves for this
request alone that it never began. Any close after acceptance stays
unconfirmed. The interactive requester also requires that its frontend
leash still holds, so a local shutdown by the leash watcher is never read
as the owner's close. The retirement, recovery-archive and session-receipt
checks, and the handoff's closed-unanswered code, are removed: the byte
replaces them.
An owner started by an earlier prerelease refuses version 3 by closing, so
an authored exec or run against it reports not started (true) until the
project is restarted; the guide says so.
Tests: a capped reply is refused by the request bound and delivered whole
by the reply writer; a command taken but not accepted is not started while
the owner is still published; an accepted command closed before its reply
stays unconfirmed even when the owner then ends through cleanup; backlog
requests are not started whatever retired the publication; interactive
requests are not started only without acceptance, and a leash shutdown
stays uncertain (fails with the leash check removed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review New head 93b7a2c fixes the P1 on
Gates at 93b7a2c:
This changes product code (the owner protocol), so the VM rows at bedbedf need a rerun. Row 4 should still say nothing ran: the backlog request is never accepted. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…ceptance (HACK-2742) Protocol review M1: an owner started by an earlier prerelease validates `version == 2` and closes on anything else, so a new requester's version-3 command against it was refused as "not started" for every authored exec and run until the project restarted. The owner now publishes record version 5, the same session-qualified record as version 4, which advertises acceptance. A requester sends a version-3 command, and waits for the acceptance byte, only to such an owner. Any older owner gets version 2 exactly as before: its commands run, and only the new not-started proof is missing (a failure after the send stays unconfirmed). Dead-owner recovery reads version 5 like version 4. Review lows: - The reply bound's compile-time check uses the receipt maximum (`state::MAX_RECEIPT_BYTES`, 1 MiB) plus an envelope margin. - The owner loop's per-request step is now `Loop::answer`, unchanged in behaviour, so one real request can be driven through it. A test holds the provider lease as another project's stop, sends a version-3 exec and run, and shows that when the acceptance byte arrives the lease is still the stop's, the journal root (state and one-off records) is unchanged and the owner is still waiting; its pending signal then ends the wait and it answers not started. Tests: an owner from before the upgrade (record version 4) receives version 2 and still runs exec and run, and gets no not-started proof. Model: `CommandAccept.tla` covers the acceptance step. The positive control holds that "not started" is reported only without the byte, and is true, and that every failure after it is unconfirmed. The old retirement rule and a missing leash check each violate an invariant. Row 4 and Codex's case are reachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Real-VM results at
|
| Row | Observed | Result |
|---|---|---|
1. Authored hack run during X's 30 s stop, ×4 (3 + 1) |
one progress line, then the output; exit 0 after 29.3, 29.3, 29.4, 29.7 s | PASS |
2. Interactive hack exec worker -- /bin/sh in a pty during the stop, ×2 |
one progress line, the shell opens after 29.2 and 29.4 s, echo/exit work, terminal back to icanon echo |
PASS |
3. Lock held 45 s: run, and interactive exec (×2) |
run exits 1 after 35.1 s; interactive exec after 35.2 s. Both say "…could not acquire the native runtime lock (provider_busy); nothing ran." / "Holder: unavailable." / "Retry … once the holder finishes." No "unconfirmed"; terminal not left raw; markers absent |
PASS |
4. Y's hack down while a run waits on the lock, ×5 (+1); interactive ×3 |
every round: "hack run did not start … (graph_authored_command_not_started); nothing ran." / "Check hack ps, then retry hack run once the project is up." For exec, the same text with "hack exec". No "unconfirmed" or "container may remain"; ps clean; terminal restored |
PASS (9 of 9 run, 3 of 3 exec) |
5. ~1.3 MB of stdout (head -c 1000000 /dev/zero | base64 = 1,350,880 bytes) |
run: exit 0, but only 303,218 and 301,447 bytes, the end of the output, with no notice. exec: once exactly 1,048,576 bytes then "Native exec output was truncated." and exit 0; once exit 1 "Native authored exec completion is unconfirmed" (printed on stdout). next 149aead1: the same: run 303,218 bytes, exec "unconfirmed" |
FAIL (pre-existing, HACK-2759) |
6. Authored project started on next 149aead1, then exec and run with this binary, no restart |
exec works on the old binary. With this binary, both exit 1 at once (0.08 s): "E_LIFECYCLE_FAILED: hack exec did not start: the project's owner stopped or changed before the command was sent or started (graph_authored_command_not_started); nothing ran." / "Check hack ps, then retry hack exec once the project is up." The run text is the same with "hack run". Nothing ran; ps still ready-observed. There is no restart hint, though the project is up. After hack down / hack up -d with this binary, exec works |
expected-bad baseline (v2 negotiation pending) |
| 7. Finite exec during the stop | one progress line, output, exit 0 after 29.3 s | PASS |
| 7. Latency, nothing holding the lock, 10× each | this head: run median 0.35 s, exec 0.30 s. next: run 0.34 s, exec 0.305 s. No progress line in any call |
PASS |
8. smoke |
PASS |
Evidence: 20261127-144939-93b7a2cc-p1285-s0, …145635-93b7a2cc-p1285-pty, …145941-93b7a2cc-p1285-r4, …150532/151132-93b7a2cc-p1285-big and next …151040-149aead1-p1285-big, …150624-93b7a2cc-p1285-upg, …150731-93b7a2cc-p1285-lat and next …150830-149aead1-p1285-lat, …150928-93b7a2cc-smoke.
Nothing was merged.
…ec tests (HACK-2742) The publication now writes record version 5, which advertises command acceptance. The codec tests asserted version 4 and used 5 as the unknown future version; they now assert 5 and use 6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review New head 3a9a382 addresses the protocol review of 93b7a2c.
Gates:
|
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Upgrade and downgrade note (from the independent review of 3a9a382, verdict SHIP).
|
Real-VM results at
|
| Row | Observed | Result |
|---|---|---|
6. Authored project started on next 149aead1 (old owner), then this binary with no restart |
hack exec worker -- sh -c 'echo …' prints its line, exit 0 (1.9 s, the first call; the old binary took 0.25 s). hack run worker sh -c 'echo …' prints its line, exit 0 (0.35 s). The run stays ready-observed. After down / up -d with this binary, exec still works (0.28 s). At 93b7a2cc both refused with "did not start" |
PASS |
4. Y's hack down while a run waits on the lock, on an owner started by this binary, ×5 |
every round: "hack run did not start … (graph_authored_command_not_started); nothing ran." No "unconfirmed" or "container may remain"; ps clean. 5 of 5 |
PASS |
4. The same with interactive hack exec worker -- /bin/sh in a pty, ×3 |
every round: "hack exec did not start … nothing ran."; terminal restored. 3 of 3 | PASS |
1. hack run during X's 30 s stop |
one progress line, output, exit 0 after 29.3 s | PASS |
| 5. ~1.35 MB of stdout | unchanged: run exit 0 with only 301,216 of 1,350,880 bytes (the end of the output, no notice); exec exactly 1,048,576 bytes then "Native exec output was truncated.", exit 0 |
still FAIL (HACK-2759) |
8. smoke |
PASS |
Evidence: 20261127-153132-3a9a382e-p1285-upg-s0, 20261127-153238-3a9a382e-p1285-r4-s0, 20261127-153826-3a9a382e-p1285-big-s0, 20261127-153919-3a9a382e-smoke-s0. Nothing was merged.
|
Merged |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Fixes HACK-2742. Follows #1278 (HACK-2739), which fixed the same failure for authored finite
hack exec.Problem
In an authored project (
hack.project.json), two commands still sent their request straight to the project's owner, whose lease wait is 15 s inside a fixed 30 s budget on its only loop:hack run;hack exec(a terminal on both ends).During another project's 30 s stop, both should fail after about 15 s with "completion is unconfirmed" (run) or "could not confirm admission or completion" (interactive), although nothing ran.
A third case affected all three authored commands, finite exec included. The owner's check (a pending signal, its own
hack down, a changed publication or pin) runs before every lease attempt, so it can end the owner's wait. It returned the plainrefused(), and the CLI also reported that as unconfirmed, although nothing had been read, touched or started.Root cause
On
nextat cd2e21f:packages/runtime-core/src/provider/graph/native/foreground.rs(one_off,interactive): neither requester waited for the lease before sending.packages/runtime-core/src/provider/graph/native/runtime/run.rs(execute) andexec.rs(interactive): the owner's wait was the only wait, and its expiry kept a rawprovider_busy.exec.rsandrun.rs:guard()?and the guard passed intoconnect_command_untilreturned the plainrefused()(native_graph_foreground) for a pending signal before any effect.src/backends/native-authored-project-oneoff.ts: the request bound was 45 s, too short for a 35 s requester wait plus the owner's fixed 40 s read, and every failure became "unconfirmed".src/backends/native-interactive-exec.ts: the interactive report carried only one code, and every refusal read "could not confirm admission or completion".Behaviour
native::foreground::one_offand::interactivecalllifecycle::await_free_command_leasebefore they send (35 s, the same wait fix(native): let authored hack exec wait out another project's stop (HACK-2739) #1278 added for the finite exec). It is one lock attempt when nothing holds the lease. The interactive requester passes its frontend leash as the check (await_free_command_lease_checked), so a frontend that is gone ends the wait. A refused check is returned as it is.exec::owner_command_engineruns the owner's guard and the 15 s wait for finite exec, interactive exec and run. It answers with a pre-effect code only for a wait that ended before acquisition:graph_authored_exec_lease_busy(exec, as in fix(native): let authored hack exec wait out another project's stop (HACK-2739) #1278) orgraph_authored_run_lease_busy(run) when the lease stayed busy;graph_authored_command_not_startedwhen the guard refused (a pending signal orhack down).nativeAuthoredCommandNotRun(shared by exec and run):{status: "not_run"}with the wire code and cause as they arrived, and a background command's admission slot is released. Everything else keeps "unconfirmed".hack runbound. 85 s, the same as the authored finite exec (it was 45 s): the 35 s wait, 5 s to send, the fixed 40 s read and a 5 s margin.hack runsetsonLeaseWait, as exec does. The interactive child's stderr is the user's terminal, so its lease-wait report goes on its private control channel (fd 3) as one closed event line ahead of the final report:{"version":1,"event":"lease-wait","holder":"project-stop"}. The CLI prints the usual single progress line for an authored interactive exec. A Compose interactive exec ignores the event (its own wait is 15 s)."holder":"project-stop"). The requester forwards the owner's pre-effect codes as the report code, because that report carries only one code. For an authored exec refused before its session existed, the CLI prints the same lines as above; a session-correlated refusal and any Compose refusal keep their messages.psand the normal path are unchanged.pstakes no lease. With nothing holding the lease, each request makes one extra lock attempt and prints nothing.Not changed
hack run(HACK-2740 territory) is untouched: it keeps its owner's 15 s wait within one bound for selection and admission.docs/guides/native-candidate.md, in a different paragraph. Neither PR changessrc/lib/native-authored-command.tsin common: this one doesn't touch it. Whichever lands second getsnextmerged in.Evidence
Local (macOS arm64):
--features native-config-plan, under the native-bench lock): 164 passed across the lease, command-lease, owner-lease, authored-exec, authored-run and interactive filters, including the new tests:the_owners_wait_refusals_have_their_own_pre_effect_codes: the three codes per command; a refused guard wins over a busy lease; other codes are kept; all pass the reply-code filter.the_owners_lease_wait_expires_with_each_commands_pre_effect_code:owner_command_engineon a held flock, for exec and run (scaled: 300 ms for 15 s).a_refused_owner_check_ends_the_wait_as_not_started: a guard that starts refusing after 200 ms ends the wait as not started within 2 s; a guard that refuses at once does the same.an_owner_failure_after_acquisition_keeps_its_code.the_authored_run_requester_waits_before_it_contacts_the_owner: theone_offcall site waits out a 600 ms stop.a_refused_requester_check_ends_the_wait_with_its_own_error: the interactive leash check ends the requester's wait with its own error, and the refusal's holder token isproject-stop.native-authored-project-oneoff: the 85 s bound, one progress line, the three not-run refusals with their details and the released slot, other failures still unconfirmed with the slot held.native-authored-project-exec: the not-started message and detail.native-command-lease: only the exact owner cause pairs are not-run refusals.native-interactive-exec: the event line parser, the report's closedholderfield, the messages for native and Compose, and two new PTY cases (native-lease,native-not-started) in which the fake runtime sends the event and the refusal over the real fd 3: one progress line, "nothing ran", no session query.native-runtime-client: the two new causes pass the closed cause filter.native-authored-command,native-project-exec,native-project-one-off,native-project-dependency-refresh.ExecStopWait.tlagainsCancellable(the owner's check may end its wait) andCancelUnconfirmed(the report before the fix). Every earlier config sets both toFALSE, and their state counts are unchanged. New controls:authored-cancel(335 states; report invariants,NoSendWhileHeldandSettleshold);authored-cancel-old(UnconfirmedOnlyAfterSendviolated:cancelled = TRUE,report = "unconfirmed",sent = FALSE);authored-cancel-reach(the cancel is reachable, reported as not run).bun run test:models: 496 controls verified.bun install --frozen-lockfile, rootbun run typecheckandbun run check(the Biome warnings are the existing set),docs:prepareanddocs:check,privacy:checkafter staging, gitleaks,cargo +1.97.1 fmt --check, clippy--all-targets -D warningswith default features and with--all-features.Linux x86_64, in the repo's toolchain image (
.hack/toolchain/Dockerfile), every container run with--init, in a scratch clone:5c4f1677:cargo fmt --checkpassed; clippy--all-targets -D warningspassed with default features and failed with--all-features:owner_pre_effect_codewas dead code there, because its only reader is the macOS interactive requester. The second commit gates it to macOS. At8b0bca62: fmt and both clippy runs pass.bash scripts/test-runtime-core.sh: 1709 passed, 0 failed.bash scripts/test-runtime-core.sh --all-features: 1924 passed, 0 failed.bun run test:models: all 496 controls verified.Not run: a VM, Docker on the Mac, or the full suite. None of this is real-VM evidence yet.
Mac rows to run
hack runduring a 30 s stophack downin X, then within a secondhack run worker sh -c 'echo ran > /tmp/hack-2742-marker; echo ok'in Yok, exits 0hack execduring a 30 s stophack exec worker -- shin Y on a terminalnothing ran,Holder: …,Retry hack run …(orhack exec …). No "unconfirmed" or "could not confirm". The marker is absenthack downin Yhack runexits 1 with eitherdid not start … (graph_authored_command_not_started); nothing ran.or the requester's lease refusal; no "unconfirmed"; Y'shack downcompleteshack run worker trueandhack exec worker -- truein Y, on this head and onnextcd2e21f🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.