Skip to content

fix(minimald): a box records a started event when its entrypoint first starts and when a resume - #3568

Draft
minimal-foundry[bot] wants to merge 3 commits into
mainfrom
agent/3552-a-box-records-a-started-event-when-its-entrypoin
Draft

minimal-foundry[bot] wants to merge 3 commits into
mainfrom
agent/3552-a-box-records-a-started-event-when-its-entrypoin

Conversation

@minimal-foundry

@minimal-foundry minimal-foundry Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up

Fixes #3552

Task marker
### D3426 — A box records a started event when its entrypoint first starts and when a resume starts it again (BOX-040)
  kind: task
  size: S
  est: 50 code, 140 tests
  executor: agent
  origin: bug
  epic: 2236
  layers:
    - daemon:
      - crates/minimald/src/box_actor.rs: moves the restart's started-event write into one shared helper, and calls it in finish_resume after the resumed event when the launch succeeds
      - crates/minimald/src/box_actor/host.rs: writes started through the helper when ensure_host and mint_session_host launch a new host for the entrypoint, but not for a hooks host, a reused host or a resume that finish_resume records
      - crates/minimald/src/box_actor/tests.rs: adds event-order tests: a created task box records created, started, exited, a created session box records created, started, and a resumed session box records resumed, started
      test: cargo test -p minimald created_task_box_records_started
      test: cargo test -p minimald created_session_box_records_started
      test: cargo test -p minimald resumed_session_box_records_started
      test: cargo test -p minimald restart_records_exited_then_started_only
  proof: min box events on a new task box shows created, started, exited, and a resumed session box shows resumed and then started.

Proof

min box events on a new task box now lists created, started, exited. On a session box, the first attach adds started after created. An attach that resumes a stopped session box adds resumed and then started, with no second started.

Notes from the agent: I ran each of the four test lines as written, and each one exited 0. I also ran the resume, event, until_complete and restart tests in the lib (81 passed). cargo clippy -p minimald --all-targets gave no warnings. A new actor field, resume_in_flight, is set by resume() and cleared by finish_resume(). It stops mint_session_host from writing started during a resume, so finish_resume writes started after resumed. finish_resume writes started only when the attach's launch succeeded. A failed started write is logged at warn with the op (exec, attach, resume, restart) and does not stop the box.

Tests

line exit tail
cargo test -p minimald created_task_box_records_started 0 running 1 test test box_actor::tests::created_task_box_records_started ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1509 filtered out; finished in 0.45s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s running
cargo test -p minimald created_session_box_records_started 0 running 1 test test box_actor::tests::created_session_box_records_started ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1509 filtered out; finished in 0.30s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s runn
cargo test -p minimald resumed_session_box_records_started 0 running 1 test test box_actor::tests::resumed_session_box_records_started ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1509 filtered out; finished in 0.36s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s runn
cargo test -p minimald restart_records_exited_then_started_only 0 running 1 test test box_actor::tests::restart_records_exited_then_started_only ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1509 filtered out; finished in 0.43s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s

Verify

min task run agent-verify timed out after 1800s, so this PR is a draft.

Krp/some dir\u{1f}RUSTC_WRAPPER=sccache\u{1f}SCCACHE_BUCKET=agent-runtime-sccache-gominimal-minimal\u{1f}SCCACHE_ENDPOINT=https://4103a6df4dd77276970745a22603bea9.r2.cloudflarestorage.com\u{1f}SCCACHE_REGION=auto\u{1f}SCCACHE_S3_USE_SSL=true\u{1f}SHELL=/usr/bin/bash\u{1f}SHLVL=2\u{1f}SSL_CERT_DIR=/etc/ssl/certs\u{1f}SSL_CERT_FILE=/etc/ssl/cert.pem\u{1f}XDG_CACHE_HOME=/state/cache\u{1f}XDG_CONFIG_HOME=/home/.config\u{1f}XDG_DATA_HOME=/home/.local/share\u{1f}XDG_RUNTIME_DIR=/run\u{1f}XDG_STATE_HOME=/home/.local/state\u{1e}stdin\n"
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   1.523s] ( 630/1531) minimald env::tests::refresh_remaps_the_installed_set_onto_the_new_graph
        PASS [   4.183s] ( 631/1531) minimald env::tests::run_task_relays_exit_through_both_paths
        SLOW [> 60.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>120.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>180.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>240.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>300.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>360.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>420.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>480.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>540.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>600.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>660.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>720.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>780.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>840.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>900.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>960.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1020.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1080.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1140.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1200.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1260.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1320.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task

Residuals

Closes #3426 (the original issue this task was triaged from).

A box wrote its started event only on a restart. The exec and attach
launches now write it through one shared helper, and a resume writes
it after its resumed event (BOX-040).
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: Advanced
  • Run ID: 01d37d9b-bc4d-4ade-aa80-11a3f18c83be

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@agent-137
agent-137 marked this pull request as ready for review November 18, 2026 22:37
@agent-137
agent-137 requested a review from a team as a code owner November 18, 2026 22:37
@minimal-foundry

minimal-foundry Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewed: no findings; approval withheld, 3 threads unresolved at d8c233cd63d6.

APPROVE withheld: 3 unresolved threads — minimal-arch[bot] crates/minimald/src/box_actor/host.rs:1989, minimal-foundry[bot] crates/minimald/src/box_actor.rs:1482, minimal-arch[bot] crates/minimald/src/box_actor/host.rs:1989. 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.

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: CONDITIONS · 1 condition · the full ruling

The change writes started on the exec launch, the attach mint, the resume and the restart, in the correct owner. One start of the entrypoint still writes no event. An attach that keeps a hooks host releases its shell at the start gate, and nothing writes started. architecture.md lists started as a lifecycle event, and line 500 says running means the entrypoint started. The PR body calls this a known gap but names no issue. Make the edit in C1, or file the gap as a named residual as C1 says.

Outside the diff

  • crates/minimald/src/box_actor/attach.rs:388: C1 · The kept hooks host starts its shell at this attach (box_runtime.rs line 2499). After h.attach returns Ok, call record_started("attach") once for this host, unless a resume is in flight (C1).

Ruled at 5f5272f against gominimal/arch@327e1b57d16b by claude-opus-5-5.

// BOX-040: a new host started the box's entrypoint. On a resume,
// `finish_resume` writes `started` after `resumed`.
if !self.resume_in_flight {
self.record_started("attach").await;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · This write covers only a host that mint_session_host launches. An attach that keeps a HostOrigin::Hooks host releases the shell at its start gate, and no started event is written. Write started once in the Some((h, _)) arm of attach_launch() in attach.rs, as C1 says.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Disputed — not addressed: The gap is real, but it is outside this task's layers. A kept hook host starts its shell in the Some((h, _)) arm of attach_launch in crates/minimald/src/box_actor/attach.rs. This task names only box_actor.rs, host.rs and tests.rs, and its host.rs line excludes a hooks host. A follow-up task must cover that arm.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

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).

Comment on lines +1467 to +1472
// BOX-040: the resume started the entrypoint again, so `started`
// follows `resumed`. A launch that failed beside a host that was
// already there started nothing.
if launched.is_ok() {
self.record_started("resume").await;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LOW · correctness · confidence 0.50 · in finish_resume

finish_resume gates started on launched.is_ok(). But mint_session_host stores the new host and returns SessionBusy when the attach to it times out. On a resume that leaves a running host, so has_host is true and minted_host is false. The success path then records resumed with no started. The comment says a failed launch beside a host started nothing, and that is not true here. A first attach in the same case does record started (host.rs mint_session_host). Gate on whether the attach launch minted a host instead of on the launch result.

What the reviewer checked

box_actor.rs: if launched.is_ok() { self.record_started("resume").await; } vs host.rs: Err(HostAttachError::Timeout) => Err(AttachError::SessionBusy) then the host is stored and record_started("attach") runs only when !resume_in_flight.

Hand this to an agent
Act on a code-review finding.

File:       crates/minimald/src/box_actor.rs
Lines:      1467-1472
Category:   correctness
Severity:   low (reviewer confidence 0.50)

Finding:
`finish_resume` gates `started` on `launched.is_ok()`. But `mint_session_host` stores the new host and returns `SessionBusy` when the attach to it times out. On a resume that leaves a running host, so `has_host` is true and `minted_host` is false. The success path then records `resumed` with no `started`. The comment says a failed launch beside a host started nothing, and that is not true here. A first attach in the same case does record `started` (host.rs mint_session_host). Gate on whether the attach launch minted a host instead of on the launch result.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in d8c233cd63d6: mint_session_host now sets resume_attach_minted during a resume, and finish_resume writes started when the launch succeeded or the attach minted a host. Added resumed_session_box_records_started_when_attach_wedges.

An attach that mints a host during a resume and then times out stores
that host, so its entrypoint started. finish_resume now writes started
after resumed in that case too (BOX-040).
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on the runtime's review findings, pushed as d8c233cd63d6.

line exit tail
cargo test -p minimald created_task_box_records_started 0 running 1 test test box_actor::tests::created_task_box_records_started ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1510 filtered out; finished in 0.48s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s running
cargo test -p minimald created_session_box_records_started 0 running 1 test test box_actor::tests::created_session_box_records_started ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1510 filtered out; finished in 0.31s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s runn
cargo test -p minimald resumed_session_box_records_started 0 running 2 tests test box_actor::tests::resumed_session_box_records_started ... ok test box_actor::tests::resumed_session_box_records_started_when_attach_wedges ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 1509 filtered out; finished in 2.38s running 0 tests test result: ok
cargo test -p minimald restart_records_exited_then_started_only 0 running 1 test test box_actor::tests::restart_records_exited_then_started_only ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1510 filtered out; finished in 0.39s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s

Verify min task run agent-verify timed out after 1800s.

bin\u{1f}PWD=/tmp/.tmp0low72/some dir\u{1f}RUSTC_WRAPPER=sccache\u{1f}SCCACHE_BUCKET=agent-runtime-sccache-gominimal-minimal\u{1f}SCCACHE_ENDPOINT=https://4103a6df4dd77276970745a22603bea9.r2.cloudflarestorage.com\u{1f}SCCACHE_REGION=auto\u{1f}SCCACHE_S3_USE_SSL=true\u{1f}SHELL=/usr/bin/bash\u{1f}SHLVL=2\u{1f}SSL_CERT_DIR=/etc/ssl/certs\u{1f}SSL_CERT_FILE=/etc/ssl/cert.pem\u{1f}XDG_CACHE_HOME=/state/cache\u{1f}XDG_CONFIG_HOME=/home/.config\u{1f}XDG_DATA_HOME=/home/.local/share\u{1f}XDG_RUNTIME_DIR=/run\u{1f}XDG_STATE_HOME=/home/.local/state\u{1e}stdin\n"
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 3 tests still running
        PASS [   0.413s] ( 631/1532) minimald env::tests::search_finds_known_package
        PASS [   3.382s] ( 632/1532) minimald env::tests::run_task_relays_exit_through_both_paths
        SLOW [> 60.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>120.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>180.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>240.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>300.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>360.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>420.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>480.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>540.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>600.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>660.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>720.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>780.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>840.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>900.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>960.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1020.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1080.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1140.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1200.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1260.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1320.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task

Converted to a draft: something above needs a person before review.

Review threads the coder judged:

  • 👎 invalid — crates/minimald/src/box_actor/host.rs:1989: The gap is real, but it is outside this task's layers. A kept hook host starts its shell in the Some((h, _)) arm of attach_launch in crates/minimald/src/box_actor/attach.rs. This task names only box_actor.rs, host.rs and tests.rs, and its host.rs line excludes a hooks host. A follow-up task must cov
  • 👍 valid — crates/minimald/src/box_actor.rs:1482: mint_session_host now sets resume_attach_minted during a resume, and finish_resume writes started when the launch succeeded or the attach minted a host. Added resumed_session_box_records_started_when_attach_wedges.

min box events on a new task box shows created, started, exited. A resumed session box shows resumed and then started. This is also true when the resume's attach mints a host that then reports busy.

Notes from the agent: Revise round 1. A resume now writes started when the attach mints a host, even when the attach to that host times out. Without the fix, the new test resumed_session_box_records_started_when_attach_wedges failed. The arch thread is a real gap: an attach that keeps a hook-launched host releases its start gate and writes no started event. The fix site is attach_launch in crates/minimald/src/box_actor/attach.rs. That file is outside this task's layers, and the task's host.rs line excludes a hooks host. A follow-up task must cover that case. I did not run just clippy-strict.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 18, 2026 23:39

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

arch-review: CONDITIONS · 1 condition · the full ruling

The compare fixes a different path: a resume whose attach wedges now records resumed and then started. That part conforms. C1 is still open. A first attach that keeps a hooks host starts the shell but writes no started event, and attach.rs has no change. Architecture line 500 says that running means the entrypoint started, and line 382 makes started the event for it. Make the C1 edit in attach_launch(). Or file an issue and name it in the PR body under Residuals.

Ruled at d8c233c against gominimal/arch@327e1b57d16b by claude-opus-5-5.

if self.resume_in_flight {
self.resume_attach_minted = true;
} else {
self.record_started("attach").await;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C1 · This line writes started only for a host that mint_session_host creates. A hooks host that an attach keeps gets no started when attach_launch() releases its shell (attach.rs line 413). Architecture line 500 says running means the entrypoint started. Do the C1 edit in attach.rs. Or file the gap as an issue and name it under Residuals in the PR body.

@agent-137

Copy link
Copy Markdown
Member

/review

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

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: 3 unresolved threads — minimal-arch[bot] crates/minimald/src/box_actor/host.rs:1989, minimal-foundry[bot] crates/minimald/src/box_actor.rs:1482, minimal-arch[bot] crates/minimald/src/box_actor/host.rs:1989. No findings.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant