Skip to content

fix(minimald): report 137 for a task whose container a SIGKILL ended - #3503

Merged
bryan-minimal merged 1 commit into
mainfrom
fix/task-exec-sigkill-exit-137
Nov 18, 2026
Merged

bryan-minimal merged 1 commit into
mainfrom
fix/task-exec-sigkill-exit-137

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What

When the daemon ends a task's box with SIGKILL, the task now exits 137 (128 + 9), as it would under a shell. It used to exit 125.

Refs #3062 (its first item; the minimald: prefix on client lines is a separate change).

Why

A command killed by a signal inside the box already reports 128 plus the signal. A box ended by SIGKILL itself was the one case that did not: the daemon passed the sandbox's own status, 125, straight through. 125 is below the range the daemon treats as "killed", so the shutdown notice never printed for such a task, although a comment there says it does.

What does not change

Only one exact case is mapped: a box ended by SIGKILL with no exit code of its own. These keep 125:

  • a command that exits 125 itself;
  • a sandbox failure;
  • min task run's own 125 for a command that succeeded with exports skipped.

Other signals that end the box itself still report 125.

Testing

a_container_sigkill_reports_137 checks the mapped case and the four that must stay as they are (a command's own 125, a sandbox failure, a signalled command at 143, a clean exit). It is a unit test of the mapping: driving it end to end needs a real sandbox child.

Workspace lint, tests and the native end-to-end script pass on this commit.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Tasks terminated by a container-level SIGKILL now report shell exit status 137, making the termination status clearer to users.
    • Command exit status 125 and other sandbox failure statuses continue to retain their reported codes. SIGTERM and successful task exits also keep their existing status values.

hakoniwa reports a container that a SIGKILL ended as code 125 with no inner
exit code, so a task exec the daemon killed reported 125, below 128, and the
shutdown notice never printed for it. Map that one shape to 137, as a
SIGKILLed command reports; a command that exits 125 itself and a sandbox
failure keep 125.

Refs #3062

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 17, 2026 20:55
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Task process wait handling now reports 137 for the specified container-level SIGKILL status. Other task exit statuses remain unchanged. A test covers the mapping and the preserved status codes.

Changes: Task exit status mapping

Layer / File(s) Summary
Map and validate task exit status
crates/minimald/src/exec/process.rs, crates/minimald/src/exec/tests.rs
task_exit_code returns 137 when the status code is 125, the inner exit code is absent, and the reason is CONTAINER_SIGKILL_REASON. HakoniwaProcess::wait uses the helper after a successful wait. Tests cover this mapping and the preservation of command exit 125, sandbox failure 125, SIGTERM 143, and clean exit 0.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • gominimal/minimal#3062 — The issue describes task execs reporting 125 after a daemon SIGKILL and proposes reporting 137, which this change implements.

Possibly related PRs

  • gominimal/minimal#3479 — Both changes affect the task exit status recorded when a task box stops. PR #3479 can affect whether a task has its own exit code, which determines whether this change's mapping applies.

Suggested reviewers: agent-137, norrietaylor

Merge Risk: Minimal · up to 82e92

A task whose box the daemon ends with SIGKILL now reports 137 instead of 125, so the shutdown notice can print. Other exit codes are unchanged and the change is small and easy to revert. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title uses a Conventional Commit form (fix(minimald): ...) and names the main change: a task whose container was ended by SIGKILL now reports exit status 137. The raw summary confirms the mapping …
Description check Passed The description follows the template's Summary, Testing, and Checklist sections. The Summary explains what changes and why, and it cites Refs #3062. The Testing section names the unit test a_container…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title uses a Conventional Commit form (fix(minimald): ...) and names the main change: a task whose container was ended by SIGKILL now reports exit status 137. The raw summary confirms the mapping in task_exit_code and HakoniwaProcess::wait, and the objectives describe the same change, so the title is fully related to the changeset.

Full details: Description check

Explanation

The description follows the template's Summary, Testing, and Checklist sections. The Summary explains what changes and why, and it cites Refs #3062. The Testing section names the unit test a_container_sigkill_reports_137, lists the cases that stay unchanged, and reports that lint, tests, and the end-to-end script pass. It does not paste command output as the template asks, and the Checklist items (docs updated, BREAKING CHANGE footer) are not ticked or addressed. These are minor gaps, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the task’s last sign,
When SIGKILL ends it, status reads 137.
Other codes keep their places neat,
The tests confirm each exit’s beat.
Then off I hop, through logs so green,
With one clear status on the screen.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: bb90c598-04ea-457b-9be3-3c3be0645a4b
Commits

Reviewing files that changed from the base of the PR and between 6c0718d and 82e92b3.

Files selected for processing: 2

  • crates/minimald/src/exec/process.rs
  • crates/minimald/src/exec/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 1 remain after this review.

@minimal-foundry

minimal-foundry Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Approved: no findings at 82e92b3682c0.

Nothing to do.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 17, 2026

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right. The mapping matches only hakoniwa's container-SIGKILL shape (125, no inner exit code, that exact reason), the same predicate sandbox_failure already excludes, so a command's own 125, a sandbox failure and the export-skipped 125 all keep their code. With 137 the shutdown notice in bridge.rs now holds for task execs, which makes the comment there true. The unit test covers the mapped case and the cases that must not move.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit a47685e Nov 18, 2026
40 checks passed
@bryan-minimal
bryan-minimal deleted the fix/task-exec-sigkill-exit-137 branch November 18, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants