Skip to content

fix(process): an exited child's own failure outranks an input-delivery note; OwnedOutput::answer is the one projection (card 25160dd7) - #5038

Merged
joelteply merged 2 commits into
canaryfrom
25160dd7/canary-red-5035-an-exited-child-s-own-fa
Oct 14, 2026
Merged

joelteply merged 2 commits into
canaryfrom
25160dd7/canary-red-5035-an-exited-child-s-own-fa

Conversation

@joelteply

@joelteply joelteply commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Why

Canary went red after #5035: run 38541241843, 8869 passed / 1 failed (reported by Codex root, e9374398). The failing test was ext::a_process_command_round_trips_json_and_names_a_failure.

ext checked input_note BEFORE the exit status. So sh -c 'echo boom >&2; exit 3' read as "input not delivered (Broken pipe)" whenever the params write lost the race to the child's exit, and the child's own verdict (exit 3, "boom") was lost. The PR checks ran on the other side of that race. My defect.

What

lane_process::OwnedOutput::answer() is the one way a run is read. It returns Whole(stdout), or Not(Unanswered { why, note, stdout, stderr }) carrying every dimension the run left (Codex root's review, d24eaad6). why is one of:

The notes are collected for every shape, a timeout included. Unanswered's Display is the one rendering: the why, then the note beside it, then both streams in full.

ext reads it as one match, which folds its separate timeout branch, its input/capture checks and its exit-status branch together. Its error is <name> (bound N ms): <unanswered>. input_note is now private behind answer.

#5037 (card bfa87dd5) copied ext's ordering into the git runner. It rebases onto this and reads answer() too.

Tests

  • New, deterministic. In input_delivery_is_recorded_whole_failed_or_cut_..., a child exits 3 without reading 4 MiB of input. That's past the pipe buffer, so the write can only end by the exit: the race, every time. The test asserts Not with why: Exited(3), stderr "boom" and the input note beside it, rendered as exit 3 (…input…)\nstderr:\nboom.
  • The early-close case asserts NotWhole and that its stdout is kept. The timed-out case asserts that its input note is kept.
  • The ext test that failed on canary keeps its assertion unchanged. The ext timeout test now matches (bound 200 ms): timed out, the one rendering's wording.
  • Not run locally: IntelMac doesn't compile the core. Source-hygiene: 32 passed at 4ffcc83 (2026-10-14).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…y note; OwnedOutput::answer is the one projection (card 25160dd7)

Canary run 38541241843 (after #5035) failed ext::a_process_command_round_trips_json_and_names_a_failure:
ext checked input_note before the exit status, so `sh -c 'echo boom >&2; exit 3'` read as
"input not delivered (Broken pipe)" whenever the params write lost the race to the exit.
PR checks passed on the other side of that race.

OwnedOutput::answer() reads a run one way:
- non-zero exit = the child's own failure, with status and stderr; any input/capture note
  goes beside it;
- zero exit with a note = not an answer;
- whole = stdout;
- timed out = its unconfirmed pids.

ext reads it as one match. input_note is now private behind it. The regression in
lane_process is deterministic: 4 MiB to a child that exits 3 without reading keeps
exit 3 and its stderr.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…eft: why, note, both streams (Codex root on #5038)

Codex root's P2 on 194975c:
- NotWhole kept only the note and dropped the streams;
- Failed omitted stdout;
- TimedOut returned before the input/capture notes were collected.

answer() now returns Whole(stdout) or Not(Unanswered { why, note, stdout, stderr }), for
every shape including a timeout. Unanswered's Display is the one rendering: why, the note
beside it, then both streams whole. ext's error is "<name> (bound N ms): <unanswered>".

Tests:
- the early-close case keeps its stdout;
- the exit-3 case renders "exit 3 (...input...)\nstderr:\nboom";
- the timed-out case keeps its input note.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

ACK Codex root d24eaad6, all three P2s fixed at 4ffcc83: (1) NotWhole kept only the note, (2) Failed omitted stdout, (3) TimedOut skipped the notes. answer() → Whole(stdout) | Not(Unanswered { why, note, stdout, stderr }) for every shape. Display renders why, the note beside it, then both streams whole. Assertions for each are in the lane_process input test.

@joelteply

Copy link
Copy Markdown
Contributor Author

Reviewed exact 4ffcc83 with independent source review. The shared outcome projection now retains reason, input/capture notes, stdout and stderr on each non-answer, including timeout and teardown uncertainty. Deterministic early-close regression requires nonzero status, stderr and failed input together; additional assertions cover zero-exit incomplete input and timeout notes.

Independently verified all six hosted checks successful, including Unix library tests, Windows compilation and generated binding drift. Approved for canary merge. This does not establish complete producer cancellation custody, byte-exact textual display, deployed acceptance or learning.

@joelteply
joelteply merged commit 7bdf4e3 into canary Oct 14, 2026
6 checks passed
@joelteply
joelteply deleted the 25160dd7/canary-red-5035-an-exited-child-s-own-fa branch October 14, 2026 10:47
joelteply added a commit that referenced this pull request Oct 14, 2026
…5038): a non-zero exit is git's own failure with its stderr, a delivery note beside it, never in its place

The runner had copied ext's ordering (input note before exit status), the defect #5038 fixed
at the owner. Its error is now 'git <args>[ interrupted…]: <unanswered>', the one rendering.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Oct 14, 2026
…ocking_git, the blocking-thread admission and github's git_output are deleted (card bfa87dd5) (#5037)

* refactor(git): every git the core waits on is one owned async run; blocking_git, the blocking-thread admission and github's git_output are deleted (card bfa87dd5)

git_bridge's ~20 sync git calls ran unbounded on blocking threads, so a cancelled
command or a passed deadline abandoned the git and what it started. run_git is now
the one async runner over lane_process::run_owned_with_input (env hygiene kept, caller
env applied last as its doc said); a task-local deadline (`within`) carries ONE
absolute bound across a caller's calls. A git the deadline ends is INTERRUPTED (effect
unknown), never "failed"; a push it ends is PushInterrupted and the next sync reads the
remote before deciding to publish.

Deleted: blocking_git, hands::spawn_blocking + BlockingAdmission + BLOCKING_ADMITTED
(no caller left), github::git_output/git_quiet, PlacementSwitch::has_unpushed_work,
and the citizen layer's six raw git spawns incl. a try_wait/sleep poll loop.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(code/git/apply): one await on git_apply (the asyncify pass doubled a split-line await; CI E0277 at 537cb62)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* refactor(git): the git runner reads the shared OwnedOutput::answer (#5038): a non-zero exit is git's own failure with its stderr, a delivery note beside it, never in its place

The runner had copied ext's ordering (input note before exit status), the defect #5038 fixed
at the owner. Its error is now 'git <args>[ interrupted…]: <unanswered>', the one rendering.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(workspace-transfer): a cancelled sync holds its checkout until its git has ended; the remote is unknown from before the push (Codex reviewer on #5037)

Two findings from the reviewer (bf7c5ada) at 992b027:
- A sync cancelled mid-git dropped the checkout's lock with its future, while
  OwnedChild's drop ended the git's tree after it. The next sync could run beside
  that git.
- REMOTE_UNKNOWN was set only when a DEADLINE ended a push, so a cancelled push
  left the next sync trusting a stale tracking ref.

Fixes:
- lane_process::holding(value, work): every owned child started in `work` keeps
  `value` until its tree has ended. It's the same lifetime the hands lease already
  had, now available to any exclusion.
- sync_by takes the lock owned and holds it through `holding`. It takes the sync as
  a future, so tests can pass a granted carry.
- The remote is unknown from BEFORE the push. Only a completed push (landed,
  rejected or unreachable) clears it.

Regression: a_sync_cancelled_mid_push_holds_the_checkout_until_its_git_has_ended_and_leaves_the_remote_unknown,
phase-synchronized on the pre-receive hook's pid file:
- after the cancel, the lock is still held;
- it frees within 10 s;
- the hook is gone;
- the remote is unknown;
- the next sync publishes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(process, git): an unconfirmed end keeps what its caller held; only a conclusive push settles the remote (Codex reviewer on #5037 at 54060cc)

P1: `kept` was released when the end's task returned, even when the end was unconfirmed:
survivors, an unwalked tree, or an exited child whose pipes a process it started still held.
It now goes where the unconfirmed end goes: HandsLease::keep_held puts it on the gate beside
`lingering`, and retain_processes releases it only when a re-check finds nothing left.
With no admission nothing can re-check, so it is never released (fail closed, probed).

P2: every push error except a timeout cleared REMOTE_UNKNOWN. The runner now returns a
typed GitError { end: NeverRan | Refused | Unknown }; run_git and run_git_with_env convert
it to String, so their callers are unchanged. A push clears the mark only on a conclusive
end: Ok, Refused or NeverRan. Unknown (cut off, output not whole, invalid UTF-8) is
PushInterrupted.

Test: the abort test no longer assumes a cleanup phase. It checks the order, which holds at
any timing: the lock is seen free only after the hook is gone, with liveness read after the
lock. lane_process pins what `kept` does:
- the pipe-holder case keeps it after close;
- a confirmed timeout releases it;
- git's undelivered-input case is GitEnd::Unknown.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(process, git): runner errors are an unknown effect; holding needs an admission; the strict release order is witnessed at the release (Codex reviewer on #5037 at bbeaba1)

- P1: run_git_input mapped every run_owned_with_input error to NeverRan, but a failed wait
  or an end that couldn't run happens after the spawn. Those are GitEnd::Unknown now, so a
  push keeps the remote unknown. Only "no time left" is NeverRan.
- No release owner: `holding` without an admission is refused in run_owned_with_input
  before anything starts. kept is then non-empty only under a lease, and the mem::forget
  branch is deleted.
- Test order: my "holds at any timing" claim was wrong; liveness read after seeing the lock
  free can miss a hook dying in between. The strict proof is now in lane_process: a Witness
  held through `holding` reads the grandchild AT its drop, the instant the exclusion is
  released, and must find it gone. The workspace_transfer test now runs under an admission,
  as the turn path does, and checks: the checkout frees, close confirms nothing lingers,
  the remote is unknown, and the next sync publishes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(workspace-transfer): a push git refused keeps the remote unknown; only an answered push or one that never ran settles it (Codex reviewer on #5037 at 39cd437)

A non-zero push exit isn't proof the remote is unchanged: the remote can take the ref and
the connection fail before git hears so. Refused keeps its classified outcome (Rejected or
Unreachable) for the turn, but REMOTE_UNKNOWN stays set; the next sync's one fetch reads
the remote. The unreachable-remote test pins it: unknown after the refused push, settled
by the next sync.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant