8000 fix(minimald): log a box the daemon ended at debug, an unrequested exit as a warning by bryan-minimal · Pull Request #3539 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): log a box the daemon ended at debug, an unrequested exit as a warning - #3539

Merged
bryan-minimal merged 3 commits into
mainfrom
fix/box-exit-log-level
Nov 19, 2026
Merged

bryan-minimal merged 3 commits into
mainfrom
fix/box-exit-log-level

Conversation

@bryan-minimal
@bryan-minimal bryan-minimal commented Nov 18, 2026 •
Copy link
Copy Markdown
Member

What

When the daemon ends a box itself, that exit is now logged at debug. A box killed by something else is still a warning. Both lines lose their DIAG prefix.

Refs #3223

Why

A destroy, a forced stop and a daemon shutdown each end the box with SIGKILL. Every one was logged as a warning: container received signal SIGKILL, code 125, with a DIAG hakoniwa prefix. In a week of telemetry it was the daemon's second most frequent warning. It hid the kills nobody asked for, which are the ones worth a warning.

How

The process handle records that its own kill succeeded. The exit is logged at debug when both hold: the daemon killed the process, and the process died of a signal.

What stays a warning

  • An out-of-memory kill, or any other SIGKILL from outside. It reads the same on exit, but no kill was sent through the handle.
  • A non-zero exit the command made on its own.

Testing

  • a_box_the_daemon_killed_logs_its_exit_at_debug
  • only_a_kill_through_the_handle_marks_the_exit_as_requested

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Process exits caused by a successful daemon kill are now logged at a lower severity than unexpected nonzero exits. Clean exits continue to be logged as informational, while other nonzero exits remain warnings.
    • The daemon checks whether a process has already exited before attempting to kill it, helping avoid misclassifying externally terminated processes.
  • Documentation
    • Updated the Linux host setup example to remove an outdated prefix from a process error message.

…it as a warning

Every box the daemon ends itself (a destroy, a forced stop, a daemon
shutdown) reaps as `container received signal SIGKILL` with code 125,
and that exit was logged as a warning with a `DIAG hakoniwa` prefix.
It was the daemon's second most frequent warning and buried the kills
nobody asked for.

The process handle now records that its own kill succeeded, and the
exit is logged at debug when the daemon killed the process and it died
of a signal. An out-of-memory kill or any other outside SIGKILL reads
the same, but no kill was sent, so it stays a warning; so does a
non-zero exit the command made on its own. Both lines drop the `DIAG`
prefix.

Refs #3223

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 18, 2026 17:02
@coderabbitai
coderabbitai Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Process exit logging now distinguishes daemon-initiated kills from other nonzero exits. The process handle checks for an existing exit before sending a kill signal. Tests cover exit classification and kill-state handling. The Linux host setup example uses an updated process-exit prefix.

Changes: Process Exit Logging

Layer / File(s) Summary
Kill-state tracking
crates/minimald/src/box_runtime/backend.rs, crates/minimald/src/box_runtime/tests.rs
HostProcess checks for an exit before killing and records whether it successfully sent a kill. Tests cover daemon-initiated and external SIGKILLs, including a process that exited before kill was called.
Exit log classification
crates/minimald/src/box_runtime/backend.rs, crates/minimald/src/box_runtime/tests.rs, docs/reference/linux-host-setup.md
The logging interface receives the kill-state flag. Zero exits use INFO, nonzero abnormal exits marked as daemon-killed use DEBUG, and other nonzero exits use WARN. Tests assert the selected levels. The setup example replaces the old diagnostic prefix with box process exited.

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

Suggested reviewers: agent-137, norrietaylor, mitodrummer

Merge Risk: Minimal · up to 84563

This change only adjusts how box process exits are logged. Exits caused by a daemon-requested kill are logged at debug, and other abnormal exits remain warnings. No functional behavior changes, and no merge-blocking issues were found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title follows Conventional Commit form (type(scope): summary), is lower-case, imperative, and has no trailing period. It names the main change: a box the daemon ended is logged at debug, and an un…
Description check Passed The description explains what changes, why, how, and what stays a warning. It lists the two tests and states that lint, tests, and the end-to-end script pass. It links the related issue with 'Refs #32…
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 follows Conventional Commit form (type(scope): summary), is lower-case, imperative, and has no trailing period. It names the main change: a box the daemon ended is logged at debug, and an unrequested exit is logged as a warning. The title is 84 characters, which is longer than ideal but still readable.

Full details: Description check

Explanation

The description explains what changes, why, how, and what stays a warning. It lists the two tests and states that lint, tests, and the end-to-end script pass. It links the related issue with 'Refs #3223'. The template's Testing section has test names but no pasted output, and the Checklist items are not ticked. The Summary section is present under the 'What/Why/How' headings. The checklist does not mention docs. The docs file was changed, which addresses the docs item, but the item is unchecked. These gaps are minor.

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

Warning

Some tools did not complete. Review the errors below.

Vale (3.24.0)

{
"Line": 13,
"Path": ".vale.ini",
"Text": "Style 'ste' isn't on the StylesPath (/styles). If it's a package, run vale sync.",
"Code": "E201",
"Span": 23
}

A rabbit heard the process end,
And watched the exit levels bend.
A clean one earns INFO light,
A daemon kill gets DEBUG bright.
Other endings WARN the air,
Then hops away without a care.

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: dc805a01-4631-445e-83e9-d4c9220ec956
Commits

Reviewing files that changed from the base of the PR and between 997ee5a and 8456303.

Files selected for processing: 2

  • crates/minimald/src/box_runtime/backend.rs
  • docs/reference/linux-host-setup.md
Files skipped from review as they are similar to previous changes: 2

  • crates/minimald/src/box_runtime/backend.rs
  • docs/reference/linux-host-setup.md

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

@minimal-foundry
minimal-foundry Bot commented Nov 18, 2026 •
Copy link
Copy Markdown
Contributor

Reviewed: no findings; approval withheld, 1 thread unresolved at 84563036ff4b.

APPROVE withheld: 1 unresolved thread — norrietaylor crates/minimald/src/box_runtime/backend.rs. 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.

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 — advisory review

Verdict COMMENT — 1 finding, 1 inline.

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

A process an outside SIGKILL ended, such as an out-of-memory kill, stays a
zombie until it is reaped, and kill(2) on a zombie succeeds. The handle's
kill then marked the exit as requested and it logged at debug, losing the
warning. The kill now reaps without blocking first: an exit it finds is
recorded as unrequested and no signal is sent.

The check and the kill are not atomic, so a process that ends between them
is still marked killed. The comment on the kill says so.

Refs #3223

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Ma 8000 rkdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — advisory review

Verdict COMMENT — No findings.

Panel: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 19, 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.

The level choice in exit_log_level is correct. A box exit logs at debug only when the handle's own kill sent the signal and the process ended without an exit code of its own. A clean exit, an exit the command made itself, and a SIGKILL from outside (an out-of-memory kill, for example) still log at info or warning as before. The second commit checks for an exit without blocking before it sends the kill. So an outside kill whose process is not yet reaped keeps its warning. The status that check records is also what the destroy path's later wait() returns, so the exit is logged once. The window between the check and the kill that remains is documented. The tests cover each branch, including the zombie case. One non-blocking naming nit is inline.


Generated by Claude Code

Comment on lines +264 to +278
"hakoniwa container/process exited"
);
} else if level == tracing::Level::DEBUG {
tracing::debug!(
code = reason.code,
exit_code = ?reason.exit_code,
reason = %reason.reason,
"session process ended after the daemon killed it"
);
} else {
tracing::info!(
tracing::warn!(
code = reason.code,
exit_code = ?reason.exit_code,
reason = %reason.reason,
"hakoniwa container/process exited"
"session process exited non-zero"
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.

Low (non-blocking): the two new log messages call the process a "session process", but HostProcess<SandboxBackend> hosts every box, task boxes included. AGENTS.md ("Naming: box, Box Type, sandbox") asks new text to say box, not session, when it means the box. So a task box that fails now logs session process exited non-zero. The three branches also no longer match: the INFO line keeps the hakoniwa container/process exited wording, while the PR drops that component name from the other two. Suggested fix: use one subject in all three branches, for example box process exited, box process ended after the daemon killed it and box process exited non-zero. Then update the example in docs/reference/linux-host-setup.md to match.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 8456303. All three branches now have one subject: box process exited, box process ended after the daemon killed it and box process exited non-zero. Levels and fields are unchanged, and the example in docs/reference/linux-host-setup.md matches. No test or other doc quoted the old texts.

…anches

The exit log of a box's process named it three ways: the INFO line kept the
`hakoniwa container/process exited` wording and the DEBUG and WARN lines said
session process, though the host runs every box, task boxes included. All
three now say box process (`box process exited`, `box process ended after the
daemon killed it`, `box process exited non-zero`), with each line's level and
fields unchanged. The example in the Linux host setup page follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 — approval withheld

Verdict COMMENT — APPROVE withheld: 1 unresolved thread — norrietaylor crates/minimald/src/box_runtime/backend.rs. No findings.

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

@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Nov 19, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit a7fc943 Nov 19, 2026
39 checks passed
@bryan-minimal
bryan-minimal deleted the fix/box-exit-log-level branch November 19, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0