Repository navigation
Closed
Labels
kind:taskA task the plan skill rendered; the body carries ## TaskA task the plan skill rendered; the body carries ## Taskmodel:strongestThe strongest model available: unknown ground, or large work that needs careThe strongest model available: unknown ground, or large work that needs caresize:SUnder 200 net lines; one PRUnder 200 net lines; one PR
Description
Task
| slice | size | difficulty | model | who | estimated lines |
|---|---|---|---|---|---|
| Tasks leave exited boxes | S | known ground | strongest | an agent | 240 (100 code, 140 tests) |
A stop that races a box's natural end gives one honest answer and one honest ending.
Covers:
- BOX-013
- BOX-038
Layers:
- daemon:
- crates/minimald/src/box_manager.rs:
stop_boxtreats anexitedrecord as an answer to a racing stop ("already exited, nothing to stop"), not an error - crates/minimald/src/box_manager/tests.rs: tests
- crates/minimald/src/rpc.rs:
serve_stop_boxanswers an already-exited box cargo nextest run -p minimald stop_racing_natural_end_answers_already_exited
- crates/minimald/src/box_manager.rs:
- runtime:
- crates/minimald/src/box_runtime.rs: a daemon-initiated kill (shutdown included, with no queued Stop) that loses the
try_waitrace is not read as the entrypoint returning on its own - crates/minimald/src/box_runtime/tests.rs: tests
cargo nextest run -p minimald daemon_kill_racing_reap_is_not_a_natural_exit
- crates/minimald/src/box_runtime.rs: a daemon-initiated kill (shutdown included, with no queued Stop) that loses the
- wire:
- crates/minimald-rpc/src/lib.rs: the
StopBoxanswer can say the box had already exited (its exit code), additive on the wire
- crates/minimald-rpc/src/lib.rs: the
Found in the review of T9 (#2401, PR #2850):
stop_box's fallback (box_manager.rs ~2355-2371) accepts onlyRecordState::Stopped. AStopBoxthat loses the race with the entrypoint returning gets "the session ended before its stop finished", though the box did end.stop_boxreturnsStopEnding, which can't express an exited box, so the return type, the RPC answer and its readers change together.- In
Host::run(box_runtime.rs ~1455),requestedis hard-codedfalsewhentry_waitreaps the process first, and it ispending.is_none()on the step-error branch. A daemon kill without a queued Stop (for example on shutdown) that loses that race is read as the entrypoint returning, so the box can be recordedexitedinstead of left for the stop path (BOX-154 sets itstoppedon restart).
Waits on:
Plan block
### T61 — A stop racing a box's natural end gives one honest ending
slice: S2
kind: task
covers: BOX-013, BOX-038
size: S
est: 100 code, 140 tests
executor: agent
difficulty: known ground
model: strongest
diagnostics: daemon log names the race outcome (stopped, or already exited with code)
observability: stop span records outcome = stopped | already_exited
layers:
- daemon:
- crates/minimald/src/box_manager.rs: stop answers an already-exited box
- crates/minimald/src/box_manager/tests.rs: tests
- crates/minimald/src/rpc.rs: serve_stop_box answers already-exited
test: cargo nextest run -p minimald stop_racing_natural_end_answers_already_exited
- runtime:
- crates/minimald/src/box_runtime.rs: daemon kill losing the reap race is not a natural exit
- crates/minimald/src/box_runtime/tests.rs: tests
test: cargo nextest run -p minimald daemon_kill_racing_reap_is_not_a_natural_exit
- wire:
- crates/minimald-rpc/src/lib.rs: StopBox answer can say already exited
produces: none
consumes: none
proof: A stop that loses the race to the entrypoint's return answers "already exited" with the code, and a daemon kill that wins it is never recorded as the entrypoint's own exit.
depends on:
- blocked by #2401
Reacted by minimal-foundry
Metadata
Metadata
Assignees
Labels
kind:taskA task the plan skill rendered; the body carries ## TaskA task the plan skill rendered; the body carries ## Taskmodel:strongestThe strongest model available: unknown ground, or large work that needs careThe strongest model available: unknown ground, or large work that needs caresize:SUnder 200 net lines; one PRUnder 200 net lines; one PR
Activity
minimal-foundry commentedon Nov 3, 2026
Done. #2863 merged.
branch
agent/2862-a-stop-racing-a-box-s-natural-end-gives-one-hone· epic #2236 · PR #2863d59725d5c5307b7eUpdated 2026-11-03T18:49:26.879Z.