Repository navigation
refactor(process): one owned run for every child the core waits on; the group kill, run_bounded and four timeout+kill_on_drop copies are deleted (card de211a71) - #5030
Merged
joelteply merged 8 commits intoOct 14, 2026
Conversation
…he group kill, run_bounded and four timeout+kill_on_drop copies are deleted (card de211a71) lane_process::run_owned is THE way the core runs a child it waits on: spawned in the core's process group (so a stop ends it), output drained alongside the wait, bounded, and OWNED. A timeout or a dropped waiter ends it with its whole tree through end_tree, keeps the hands' admission until that end is done, and names what isn't confirmed gone. It returns what the child wrote before a timeout (card ba846f38), and stops waiting on output while a survivor could hold the pipe open. Migrated onto it, each a parallel copy before: - gh: OwnedGh and its reader move into lane_process as OwnedChild. - the SWE grader (#381): the process group + post-hoc killpg is gone. - the gym grader's run_capped and the hermes competitor: timeout + output + kill_on_drop, which killed only the direct child. - code/cargo: the same, so a build's rustc and build scripts outlived a timeout or a dropped command. - code/run's rustc compile, binary run and python run: run_bounded and BoundedOutput are deleted (its partial-output contract is now run_owned's). Deleted from lane_process: lead_own_group, kill_tree, TreeKill (end_tree is the one tree end). Net -91 lines. Test: an_owned_run_ends_its_tree_when_dropped_or_timed_out_and_holds_the_admission_until_it_has (a dropped run: the release waits for the end and nothing is unconfirmed, the descendant is gone; a timed-out run keeps what it wrote first). Replaces the gh-only owner test; code/run's safety_timeout_actually_kills_the_child and the partial-output tests still pin the snippet paths. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
marked this pull request as draft
October 14, 2026 00:42
…ne bound, with a typed capture (Codex root on #5030 at 1105c92) - One bound covers the child's exit and both pipes' EOF; the child, its tree and its readers stay owned until that lifecycle ends. Before, the bound covered only the wait, and a process the child started that inherited the pipes held the read past it, after the owner had let go of the child. - A holder past the bound is never claimed ended (decision (b), the core's process-group boundary kept): the read is cut and the uncertainty is kept on the hands' admission (HandsLease::keep_unknown), which holds the release by name. Full containment is card 074b7f42. - Typed capture apart from the process verdict: CaptureEnd Complete | Failed(io error) | Cut(why), each with the prefix read. Readers append into a RunCapture shared with the operation (the seam the result-custody owner holds), so a cancel keeps its prefix reachable after the waiter is gone, and the readers are owned and stopped (aborted, never detached). - Callers surface the note beside the verdict: gh adds Incomplete (a clone whose output was held keeps its partial, like a timeout), the graders and hermes refuse an incomplete output, code/cargo and code/run append it. Tests: a_process_that_holds_an_exited_childs_output_past_the_bound_is_held_never_claimed_ended, a_read_that_fails_is_typed_failed_and_keeps_its_prefix, and the owned-run test now also checks the cancelled run's prefix on the shared capture. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…n fences the holder; a reader's JoinError is Failed (Codex root on #5030 at 3f597b9) The exit branch took the readers out of the owner before awaiting them, so a cancel during the drain dropped their handles (detached, not aborted) and left no fence, letting the lease release under a live holder. Now drain_readers awaits them in place: a cancel or panic mid-drain finds them in the owner, whose Drop stops them and, since the child already exited and its tree can't be walked, keeps the unidentified holder on the hands' admission. A reader that panicked or was aborted is a Failed capture, never whole. Test: the holder test now also cancels mid-drain (the shell exited and was reaped, the holder still running) and checks the fence and the cut. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…m ends (E0597 at 1b492b3) The tail expression's temporary iterator borrowed end past its scope. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ts missing-interpreter test pins 59f01a0's run_owned migration renamed it to 'failed to run' and broke a_snippet_runs_in_the_given_root_and_tree_walking_is_named_not_refused. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
marked this pull request as ready for review
October 14, 2026 02:25
…t that isn't whole is never ok (Codex root on #5030 at 6c7bd0d) The timeout note suppressed a failed read and claimed the output above was "everything it produced"; a compile whose output a process it started held past the bound was discarded and its binary run anyway. One helper, with_run_notes, now writes the timeout (what was READ before the kill, and what isn't confirmed gone) and each stream's capture status on every path, and read_whole gates `ok` and the compile's fall-through: a successful exit whose output isn't whole doesn't vouch for the result or the binary. timeout_note and with_capture_note are deleted. Test: a_runs_capture_status_is_said_on_every_path_and_an_unwhole_run_is_never_ok. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…grader-subprocess-ends-through
… keeps the stdout it captured (Codex root on #5030 at 96d6d27) The rustc timeout arm returned stdout: String::new() though compiled.stdout was captured, and each of the six arms built CodeRunResult by hand, so they could drift. result_of is now the one projection of an owned run into the result (exit code, ok = clean exit AND whole read, stdout, stderr with with_run_notes, timed_out, interpreter), and every arm calls it. CRLF becomes LF for every interpreter, not only python. -86/+41. Test: a_runs_capture_status_and_what_it_read_survive_every_path_and_an_unwhole_run_is_never_ok now projects a timed-out run through result_of and checks its captured stdout. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
Contributor
Author
|
Codex root: Independent rereview APPROVE exact8efc342746f9737be930d0197622782c957d2035. Shared result_of now retains captured stdout/stderr and capture notes across compiler timeout/failure, Python and binary execution; incomplete compiler capture refuses execution. Regression explicitly projects compiler timeout stdout. Prior shared-lifecycle blockers resolved. All seven hosted checks independently SUCCESS. This approves process-lifecycle/consumer consolidation only: durable bounded capture and cancellation-result reachability remain unfinished root-owned work, not claimed solved. |
joelteply
deleted the
de211a71/swe-bench-grader-subprocess-ends-through
branch
October 14, 2026 06:36
joelteply
added a commit
that referenced
this pull request
Oct 14, 2026
…holder is fenced like an output holder (Codex root on #5035 at dc2a64c) The exit path took the writer out of the owner before awaiting it (the hole #5030 closed for the readers): a cancel during that await detached it, and Drop saw no writer to stop or mark. settle_writer now awaits it in place, reads a JoinError as failed delivery, and clears it only once settled. A process the child started that holds its stdin after the child exits is cut by name at the bound, and Drop on a cancel during that wait marks the input cut and keeps the unidentified holder on the hands' admission, as for an output holder. Test: a_process_that_holds_an_exited_childs_stdin_is_fenced_at_the_bound_and_on_a_cancel (the cancel lands after the shell is reaped, during the writer's wait). 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
…9ae815) (#5035) * refactor(process): the remaining timed child waits run owned (card 679ae815) Four more timeout + output/wait_with_output + kill_on_drop copies, each of which ended only the direct child, now go through lane_process::run_owned: - the sentinel shell step (a pipeline's commands and what they start); - authored commands (sdk_codegen ext), through the new run_owned_with_input: params go to stdin BESIDE the wait, so a program that never reads them can't wedge the call past its bound (the old runner awaited the write first). Its error text no longer clips stderr/stdout to 600/200 chars (Joel, 2026-10-11: clipping is illegal; the budgeter decides); - the engine's --help probe; - the CLI's prebuilt-checkout HEAD lookup. Each surfaces an output that wasn't read whole instead of reading it as a result. Not here: code::git_bridge (about 20 sync git calls; moving git_apply alone would leave a parallel path), carded as bfa87dd5. python_adapter's runner is being deleted in #5029. shutdown.rs:270 is a test harness child. Test: input_reaches_a_reading_child_and_a_child_that_never_reads_it_still_ends_at_the_bound. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * fix(process): input delivery is recorded on the run owner; timeouts keep what was read and name unconfirmed teardown (Codex root on #5035 at 549dce1) - The stdin writer discarded its own outcome, so a child that closed stdin early and exited 0 with valid JSON read as having answered the call. The write's end is now recorded on the run's capture (RunCapture.input): Complete (written whole and closed), Failed (the child closed it first), Cut (the bound elapsed, a process it started held stdin, or the operation was cancelled). OwnedOutput carries it, and input_note names it. Authored commands reject a result whose input wasn't delivered. Stated limit: Complete can't prove the child READ all of an input that fit the pipe's buffer. - The sentinel shell step's and authored commands' timeouts discarded what was read and claimed everything was ended. Both errors now carry the stdout/stderr read before the bound, and name the pids not confirmed gone. Test: input_delivery_is_recorded_whole_failed_or_cut_and_never_read_as_delivered_when_it_wasnt (a reading child; a deaf child at the bound; a child that closes stdin early and exits 0 with '{}'; a cancel mid-write). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * fix(process): the input writer stays owned through its wait; a stdin holder is fenced like an output holder (Codex root on #5035 at dc2a64c) The exit path took the writer out of the owner before awaiting it (the hole #5030 closed for the readers): a cancel during that await detached it, and Drop saw no writer to stop or mark. settle_writer now awaits it in place, reads a JoinError as failed delivery, and clears it only once settled. A process the child started that holds its stdin after the child exits is cut by name at the bound, and Drop on a cancel during that wait marks the input cut and keeps the unidentified holder on the hands' admission, as for an output holder. Test: a_process_that_holds_an_exited_childs_stdin_is_fenced_at_the_bound_and_on_a_cancel (the cancel lands after the shell is reaped, during the writer's wait). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * test(process): the stdin holder keeps the pipe under dash too (CI failure at d66da0f) CI's sh is dash, which gives an async command /dev/null as stdin before its redirections, so `sleep <&0 &` held /dev/null, not the pipe, and the write ended with a broken pipe (Failed, not Cut). Measured on IntelMac: under /bin/dash, `<&0` leaves fd 0 a CHR device and `exec 3<&0; ... <&3` leaves it a PIPE; /bin/sh (bash) gives a PIPE for both. The holder now takes the pipe through fd 3. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * refactor(process): one owned pipe-task lifecycle for the readers and the writer; tests cancel on the run's own exited signal (Codex root on #5035) The ownership defect repeated across stream directions because the lifecycle was copied per direction (drain_readers/cut_readers for stdout and stderr, settle_writer and its own Drop branch for stdin). Now every pipe is a PipeTask (task, the stream it records on, the name a fence uses) with ONE lifecycle: settle_pipes awaits each in place and reads a JoinError as a failed stream; cut_pipes stops what is still open and returns its names; fence_holders keeps an unidentified holder on the admission when the child already exited. The exit path, the timeout path and Drop each call those, so no direction can drift. -105/+84. RunCapture::exited() is set once the child is reaped. The cancel-during-settle tests wait on it instead of a 300 ms sleep or a kill -0 poll, so the cancel lands in the settle phase deterministically. 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Card de211a71 is the follow-up from #5026, and Codex root made me owner of process lifetime. The core ran child processes it waits on in five different ways. Most of them, on a timeout or a dropped command, killed only the direct child, so what that child started was orphaned. Examples are a build's rustc, pytest's workers, and a hermes agent's tools. #381 is the 11-hour sympy run found by the cooling fan. The SWE grader kept a separate mechanism, a process group with a killpg after the fact.
What
lane_process::run_ownedis now THE way the core runs a child it waits on:end_treeends the whole tree, deepest first, by identity.code::hands::current) until that end is done. Whatever it can't confirm gone is kept on the admission, for the release to recheck or hold, as refactor(hands): a workspace is bound, never moved; each card claim has its own hands (card fc9e9fd7) #5026 does.Migrated onto it. Each of these was a parallel copy:
OwnedGhand its reader move intolane_processasOwnedChild.lead_own_groupand the post-timeoutkillpgare gone.run_cappedand the hermes competitor: these used timeout +output()+kill_on_drop, which killed only the direct child.run_boundedandBoundedOutputare deleted.Deleted from
lane_process:lead_own_group,kill_treeandTreeKill. 7 files, +295/-386.Lifecycle and capture (Codex root on 1105c92, decision e=a2872107)
HandsLease::keep_unknown), which holds the release by name.CaptureEndis Complete, Failed(io error) or Cut(why), each with the prefix read so far.RunCaptureshared with the operation, so a cancel keeps its prefix reachable after the waiter is gone. Readers are aborted, never detached.Incompletekeeps a clone's partial, as a timeout does;RunCapture. After a cancel, its prefix is reachable only while something holds thatArc, and today nothing does. The retained-operation integration is root's, and so is bounded-memory capture.Not in this PR (card 679ae815, owner Cormac)
The remaining timed waits: the sentinel shell step,
sdk_codegen/ext, system/shutdown, the llama--helpprobe, the continuum bin,python_adapter(sync) andgit_bridge. Each needs its lifetime owner read first.Tests
an_owned_run_ends_its_tree_when_dropped_or_timed_out_and_holds_the_admission_until_it_has: a dropped run's release waits for the end, nothing is unconfirmed, and the descendant is gone. Its prefix stays on the shared capture. A timed-out run keeps what it wrote first, and its read is cut.a_process_that_holds_an_exited_childs_output_past_the_bound_is_held_never_claimed_endeda_read_that_fails_is_typed_failed_and_keeps_its_prefixcode/run'ssafety_timeout_actually_kills_the_childand its partial-output tests still pin the snippet paths.Benchmark area: I read BENCHMARKS-ARE-ADAPTERS-NOT-A-RUNNER.md. This changes only how a grader subprocess ends. It adds no run state and no external consumer.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE