Repository navigation
fix(minimald): T48 — An interrupted in-box task run prints no socat or connection line - #3435
Conversation
The in-box min helper sends socat's stderr to /dev/null and reads socat's exit status. When a signal ends socat, as Ctrl-C or the run's timeout does, the helper no longer prints the broken-stream line. It still exits 125, as before.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
The in-box min helper now sends socat's stderr to /dev/null, so the RPC-CALLED marker the fake socat wrote there never reached the test. help_word_in_argument_slot_reaches_rpc failed, and the tests that check the marker is absent passed for no reason. The fake now writes the marker to a file, and run_min_command adds it to the stderr it returns.
|
Round 1 of 10 on a failed check suite, pushed as
Verify Converted to a draft: something above needs a person before review. Inside a box, Notes from the agent: Revise round 1: the CI log excerpt did not name the failed test. A local run found it: help_word_in_argument_slot_reaches_rpc. Its fake socat wrote RPC-CALLED to stderr, and the helper now sends socat's stderr to /dev/null. The fake now writes the marker to a file, and run_min_command adds the file to the stderr it returns. The negative checks in help_spellings_print_usage_without_rpc and patched_build_help_prints_usage_without_rpc test the marker again. A full |
|
Reviewed: no findings; approval withheld, 9 threads unresolved at APPROVE withheld: 9 unresolved threads — minimal-foundry[bot] crates/minimald/src/env_min_helper.sh:164, minimal-arch[bot] crates/minimald/src/env_min_helper.sh:163, minimal-foundry[bot] crates/minimald/src/env_min_helper.sh:296, minimal-arch[bot] crates/minimald/src/env_min_helper.sh:298, minimal-arch[bot] crates/minimald/src/env_min_helper.sh, …. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen. |
| exec {sock_out}< <(printf '%s\n' "$request" | socat -,ignoreeof UNIX-CONNECT:/run/minenv_sock 2>/dev/null) | ||
| sock_pid=$! |
There was a problem hiding this comment.
LOW · correctness · confidence 0.50 · in __min_rpc
2>/dev/null now hides every socat error in the non-run path, such as a missing /run/minenv_sock. For other methods there is no exit: check and no replacement message, so a failed connection can end silently with status 0. Keep socat stderr for these methods, or only hide it for run.
What the reviewer checked
line 161: exec {sock_out}< <(printf ... | socat -,ignoreeof UNIX-CONNECT:/run/minenv_sock 2>/dev/null); the non-run tail returns 1 only if error==true
Hand this to an agent
Act on a code-review finding.
File: crates/minimald/src/env_min_helper.sh
Lines: 161-162
Category: correctness
Severity: low (reviewer confidence 0.50)
Finding:
`2>/dev/null` now hides every socat error in the non-`run` path, such as a missing /run/minenv_sock. For other methods there is no `exit:` check and no replacement message, so a failed connection can end silently with status 0. Keep socat stderr for these methods, or only hide it for `run`.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in 970f7bb5bcea: Only a run call now sends socat's stderr to /dev/null. Other methods keep socat's error on stderr, so a missing /run/minenv_sock is visible again.
…pted-in-box-task-run-prints-no-socat-o
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
For run, the change conforms. The change also hides socat's errors for every other in-box min command. The 2>/dev/null on line 161 is in the branch that search, build, check, materialize and net-expose all use. At head, such a call with an unreachable daemon socket prints nothing and exits 0. At base, it printed socat's connect error. Design principle 4 (line 334) puts diagnostics on stderr. Principle 5 (line 335) gives min's own failures reserved codes. Make the change in C1: suppress socat's stderr for run only.
Ruled at b8cc8ab against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
| printf '%s\n' "$request" >&"$sock_in" | ||
| else | ||
| exec {sock_out}< <(printf '%s\n' "$request" | socat -,ignoreeof UNIX-CONNECT:/run/minenv_sock) | ||
| exec {sock_out}< <(printf '%s\n' "$request" | socat -,ignoreeof UNIX-CONNECT:/run/minenv_sock 2>/dev/null) |
There was a problem hiding this comment.
C1 · Every helper method that is not a forwarding run uses this branch. With 2>/dev/null here, a failed connect for net-expose, search or build prints nothing and exits 0. Design line 334 puts diagnostics on stderr. Send socat's stderr to /dev/null only when $method is run. Keep it on stderr for every other method.
|
/revise Head 1. Arch C1: hide socat's stderr for 2. Test the branch that does not forward. Change nothing else. |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
Only a run hides socat's stderr, because only a run prints its own broken-stream line. The signal test now also runs with a terminal on stdin, so the non-forward branch is covered.
…pted-in-box-task-run-prints-no-socat-o
|
Round 2 of 10 on the runtime's review findings, pushed as
Verify
10000
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Inside a box, Notes from the agent: Revise round 2. In the helper, only a |
| fi | ||
| if [[ "$error" != "true" ]] && (( sock_status <= 128 )); then | ||
| echo "error: the connection closed before the task reported its exit status" >&2 |
There was a problem hiding this comment.
LOW · correctness · confidence 0.50 · in __min_rpc
The sock_status <= 128 test treats every status above 128 as a signal that the user caused. Any signal that kills socat, such as SIGKILL from an out-of-memory kill, now exits 125 with no message. Also, a run that fails to connect (for example a missing /run/minenv_sock) now prints only the generic closed-connection line, because socat's own error goes to /dev/null. Limit the silence to SIGINT and SIGTERM (130 and 143). Consider keeping socat's stderr when it exits with a plain error status.
What the reviewer checked
if [[ "$error" != "true" ]] && (( sock_status <= 128 )); then ... 2>/dev/null on both run socat calls
Hand this to an agent
Act on a code-review finding.
File: crates/minimald/src/env_min_helper.sh
Lines: 289-291
Category: correctness
Severity: low (reviewer confidence 0.50)
Finding:
The `sock_status <= 128` test treats every status above 128 as a signal that the user caused. Any signal that kills socat, such as SIGKILL from an out-of-memory kill, now exits 125 with no message. Also, a `run` that fails to connect (for example a missing /run/minenv_sock) now prints only the generic closed-connection line, because socat's own error goes to /dev/null. Limit the silence to SIGINT and SIGTERM (130 and 143). Consider keeping socat's stderr when it exits with a plain error status.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in 8334cf66952f: 8334cf6: a signal end now exits with its own 128 + signal code for every signal, SIGKILL included, so the code carries the cause. It is not limited to SIGINT and SIGTERM. A run whose connect fails still prints the closed-connection line and exits 125.
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The helper now hides socat's warning only for run, and the broken-stream line stays where it belongs. That part conforms to design principle 4. The exit code does not conform. When a signal ends socat, __min_rpc returns 125, and its own comment says that this end is not a failure of min. Line 371 reserves 125 for a min-side failure, and line 335 gives a signal end the shell's 128 + signal. Make C1 in env_min_helper.sh and C2 in the test. Then the change conforms.
Ruled at 970f7bb against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
| if [[ "$error" != "true" ]] && (( sock_status <= 128 )); then | ||
| echo "error: the connection closed before the task reported its exit status" >&2 | ||
| fi | ||
| return 125 |
There was a problem hiding this comment.
C1 · This line returns 125 also when a signal ended socat. Line 371 reserves 125 for a min-side failure. Line 335 gives a signal end the shell's 128 + signal. When sock_status is above 128, return $sock_status. Keep 125 for the other broken streams.
There was a problem hiding this comment.
Addressed in 8334cf66952f: 8334cf6: __min_rpc returns $sock_status when it is above 128. Other broken streams keep 125 and the closed-connection line.
| fi | ||
| # A `run` always ends with an `exit:` line. A stream that ends without | ||
| # one is a failure of min, not of the task, so it exits 125. | ||
| # A signal that ends socat, as Ctrl-C or the run's timeout does, also |
There was a problem hiding this comment.
C1 · The run's own timeout does not end socat on a signal. The daemon relays that timeout as an exit: line. Remove "or the run's timeout" and state that the helper exits with 128 + signal.
There was a problem hiding this comment.
Addressed in 8334cf66952f: 8334cf6: removed "or the run's timeout" from the comment. It now says the helper exits with 128 + signal.
| let check = |what: &str, out: std::process::Output| { | ||
| let stdout = String::from_utf8_lossy(&out.stdout); | ||
| let stderr = String::from_utf8_lossy(&out.stderr); | ||
| assert_eq!(out.status.code(), Some(125), "{what}: {stderr}"); |
There was a problem hiding this comment.
C2 · This assertion pins 125 for a run that SIGTERM ends. After C1, expect Some(143). Change the comment on line 5127 to say 128 + signal, not "exits 125 as before".
There was a problem hiding this comment.
Addressed in 8334cf66952f: 8334cf6: the SIGTERM assertion expects Some(143), and the test comment says 128 + signal.
Only a run hides socat's stderr. A net expose against a missing /run/minenv_sock still prints socat's connect error.
|
Every failing check on
Re-run the failed jobs. If the same checks go red again on this head, the next failed suite starts a round; if this red is not the flake, |
|
/revise Head 1. Arch C1: a signal end exits 128 + signal, not 125. 2. Arch C2: the test pins 143. 3. Finding PRRT_kwDOPdfcxM63b8n2. Change nothing else. |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
|
Round 3 of 10 on a /revise note, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
Inside a box, Notes from the agent: Round 3. Both directive items were already in the code at head f11f834: |
A run whose socat a signal ends now exits with the shell's 128 + signal and prints nothing. Every other broken stream keeps exit 125 and its closed-connection line. The test now pins 143 for SIGTERM.
| fi | ||
| if [[ "$error" != "true" ]] && (( sock_status <= 128 )); then | ||
| echo "error: the connection closed before the task reported its exit status" >&2 |
There was a problem hiding this comment.
LOW · correctness · confidence 0.50 · in __min_rpc
sock_status <= 128 hides the connection line for every status above 128. That includes SIGKILL (137) and SIGPIPE (141), not only the Ctrl-C and timeout signals (SIGINT 130, SIGTERM 143). The helper closes sock_out before it waits, so a socat that is still running gets SIGPIPE. Socat's own stderr is now discarded too. The command then returns 125 with no message at all. Limit the check to 130 and 143, or to the signals the PR names.
What the reviewer checked
if [[ "$error" != "true" ]] && (( sock_status <= 128 )); then echo "error: the connection closed ..."
Hand this to an agent
Act on a code-review finding.
File: crates/minimald/src/env_min_helper.sh
Lines: 289-291
Category: correctness
Severity: low (reviewer confidence 0.50)
Finding:
`sock_status <= 128` hides the connection line for every status above 128. That includes SIGKILL (137) and SIGPIPE (141), not only the Ctrl-C and timeout signals (SIGINT 130, SIGTERM 143). The helper closes `sock_out` before it waits, so a socat that is still running gets SIGPIPE. Socat's own stderr is now discarded too. The command then returns 125 with no message at all. Limit the check to 130 and 143, or to the signals the PR names.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Addressed in d558ff0ec469: The helper now hides the connection line and returns 128 + signal only for statuses 130 and 143. SIGKILL, SIGPIPE and other ends print the line and exit 125. The test adds a SIGKILL case.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms. Only a run hides socat's stderr, and a run keeps its own broken-stream line when no signal ends the stream. Other calls keep socat's error on stderr, as design principle 4 (line 334) requires. The new expose test pins that. A task's own timeout still reaches the helper as exit:124, so line 370 holds. No conditions.
Ruled at e8cc8b3 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
|
Round 4 of 10 on a /revise note, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
Inside a box, Notes from the agent: Commit 8334cf6 answers arch C1 and C2 and thread PRRT_kwDOPdfcxM63b8n2. A wider run of |
| sock_status=$? | ||
| fi | ||
| if (( sock_status > 128 )); then |
There was a problem hiding this comment.
MEDIUM · correctness · confidence 0.70 · in __min_rpc
The PR says a signal-ended run keeps exit code 125. This code returns the socat status instead (128 + signal, for example 143). Any caller that reads 125 as 'min failed' now sees a different code. Either return 125 here, or update the PR body, comment and docs for the new code. The test pins 143, so it will not catch the mismatch with the stated intent.
What the reviewer checked
if (( sock_status > 128 )); then return "$sock_status"; fi vs PR body: 'The command still exits 125, the same code as before.'
Hand this to an agent
Act on a code-review finding.
File: crates/minimald/src/env_min_helper.sh
Lines: 289-291
Category: correctness
Severity: medium (reviewer confidence 0.70)
Finding:
The PR says a signal-ended run keeps exit code 125. This code returns the socat status instead (128 + signal, for example 143). Any caller that reads 125 as 'min failed' now sees a different code. Either return 125 here, or update the PR body, comment and docs for the new code. The test pins 143, so it will not catch the mismatch with the stated intent.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Disputed — not addressed: The 128 + signal code is deliberate: an earlier review (thread PRRT_kwDOPdfcxM63b81K) asked to keep 125 for min-side failures only. The code comment and the test already say 128 + signal. Only the PR body was stale, and this round's body states 128 + signal.
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The code conforms. A signal end now returns 128 + signal. Design principle 5 (line 335) and the exit-code table (lines 371 and 374) support this, and the host min does the same. A relayed exit: code, which includes 124, does not change. The PR body still says that the command exits 125, "the same code as before", and the Verify log comes from an earlier head. C1 corrects the body before merge.
Ruled at 8334cf6 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
| sock_status=$? | ||
| fi | ||
| if (( sock_status > 128 )); then | ||
| return "$sock_status" |
There was a problem hiding this comment.
C1 · This return gives 128 + signal, as design principle 5 (line 335) says. The PR body proof: line and ## Proof still say that the command exits 125, the same code as before. Change the body to state 128 + signal (130 for Ctrl-C).
There was a problem hiding this comment.
The PR body now says 128 + signal (130 for Ctrl-C) in both the proof: line and ## Proof, and notes that a run's timeout still exits 124 through its relayed exit: line.
A run that SIGKILL or SIGPIPE ends is a broken stream. It prints the connection line and exits 125, as before.
|
Round 5 of 10 on the runtime's review findings, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
Inside a box, Notes from the agent: Revise round 5. The exit code for a SIGINT or SIGTERM end is 128 + signal, not 125. An earlier round chose this on purpose (thread PRRT_kwDOPdfcxM63b81K), so the task proof's 'same code as today' holds for every other broken stream only. The PR body must say 128 + signal for those two signals. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head conforms. A run that SIGINT or SIGTERM ends now returns 130 or 143 and prints nothing more. Design principle 5 (architecture.md line 335) and the 128 + n row (line 374) give that code. Any other signal death of socat is a min-side failure. It keeps the connection line and returns 125, as the 125 row (line 371) gives. A new test leg pins this for SIGKILL. A timeout is still relayed as an exit: line and returns 124.
Ruled at d558ff0 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 9 unresolved threads — minimal-foundry[bot] crates/minimald/src/env_min_helper.sh:164, minimal-arch[bot] crates/minimald
10BC8
/src/env_min_helper.sh:163, minimal-foundry[bot] crates/minimald/src/env_min_helper.sh:296, minimal-arch[bot] crates/minimald/src/env_min_helper.sh:298, minimal-arch[bot] crates/minimald/src/env_min_helper.sh, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
T48 — An interrupted in-box task run prints no socat or connection line
slice: S2
kind: task
covers: BCLI-010, BCLI-014
size: S
est: 15 code, 65 tests
executor: agent
difficulty: needs care
model: standard
diagnostics: no new text; the broken-stream line
error: the connection closed before the task reported its exit statusstays for a stream that ends with no exit status and no signal, pinned by env.rs:5559 and the new testobservability: none new
layers:
- daemon:
- crates/minimald/src/env_min_helper.sh: both socat invocations send socat's stderr to /dev/null; a run whose socat ended on a signal prints no "connection closed" line and keeps its exit code
- crates/minimald/src/env.rs: its helper tests gain a run that SIGTERM ends, checking stderr holds neither line, beside the existing broken-stream test
test: cargo nextest run -p minimald min_helper_run_ended_by_signal_prints_no_connection_line
produces: none
consumes: none
proof: Inside a box,
min task runof a task that Ctrl-C ends prints neither the socat warning nor the connection line, and exits with 128 + signal (130 for Ctrl-C).Proof
Inside a box, when Ctrl-C ends
min task run, the output shows no socat warning and no 'the connection closed' line. The helper exits with the shell's 128 + signal: 130 for SIGINT, 143 for SIGTERM. Before this change it exited 125. A run's own timeout is not a signal end. The daemon relays it as anexit:line, so the run still exits 124. A stream that ends with no exit status and no signal, such as a failed connect, still prints the connection line and exits 125.Notes from the age 8000 nt: Only a
runcall sends socat's stderr to /dev/null. Every other in-box method (search,build,check,materialize,net-expose) keeps socat's errors on stderr. The helper reads socat's exit status: the coproc's wait in the stdin-forward path, and a wait on the process substitution ($!) in the terminal path. A status above 128 returns that status and prints no line. Any other broken stream returns 125 with the connection line.min_helper_run_ended_by_signal_prints_no_connection_linepins 143 for SIGTERM on the stdin-forward path.min_helper_expose_keeps_socat_connect_errorpins socat's connect error fornet-expose. No test covers the terminal-stdin path, because Command::output gives a non-terminal stdin. Pre-existing and not related to this change: this box sets MINIMAL_OTEL=off, so minenv_run_forwards_stdin_to_the_task and task_run_pipes_stdin_through_the_in_box_helper hang here, because their channel stub panics on the 'otel%off%' prefix. Both pass with MINIMAL_OTEL unset.Tests
cargo nextest run -p minimald min_helper_run_ended_by_signal_prints_no_connection_lineVerify
The log below is from an earlier head. CI on
8334cf66is green.min task run agent-verifyexited 100, so this PR is a draft.Closes #3421