Skip to content

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

Merged
mitodrummer merged 7 commits into
mainfrom
agent/3552-a-box-records-a-started-event-when-its-entrypoin
Nov 19, 2026
Merged

mitodrummer merged 7 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: f2b14a52-59ae-4c9c-98b2-c79f64047807

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, 4 threads unresolved at aeb472a2761f.

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

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 da9388839461: Took the residual branch: attach.rs is outside this task's layers. The gap is filed as #3604 and named under Residuals, and the record_started doc comment now names it.

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

@agent-137
agent-137 marked this pull request as ready for review November 19, 2026 01:24
@agent-137

Copy link
Copy Markdown
Member

/revise

Arch ruling CONDITIONS on d8c233c (arch_rulings 1407) keeps C1 open. C1 allows two branches, and this task takes the residual one: crates/minimald/src/box_actor/attach.rs is outside D3426's layers. The gap is now filed as #3604, and the PR body names it under ## Residuals in place of the old "Known gap" line.

Do this one change:

  1. In crates/minimald/src/box_actor.rs, the doc comment of record_started: add one sentence after "its entrypoint started on a new host". It says that an attach that keeps a hooks host (a host kept for its host-side row, or an attach that declares no terminal) releases the shell without writing started yet, and that minimald: an attach that keeps a hooks host releases its shell without a started event (D3426 residual, BOX-040) #3604 tracks it. Do not change any code path or attach.rs.
  2. Keep the PR body's ## Residuals entry for minimald: an attach that keeps a hooks host releases its shell without a started event (D3426 residual, BOX-040) #3604 and the line Closes #3426 (the original issue this task was triaged from). If the body still has a "Known gap" sentence, remove it.

An attach that keeps a hooks host releases the shell without a started
event. Issue #3604 tracks it.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 2 of 10 on a /revise note, pushed as da9388839461.

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; 1517 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 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; 1517 filtered out; finished in 0.27s 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; 1516 filtered out; finished in 2.29s 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; 1517 filtered out; finished in 0.37s 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.

e-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.361s] ( 638/1539) minimald env::tests::search_finds_known_package
        PASS [   3.436s] ( 639/1539) 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
        SLOW [>1380.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:

min box events on a new task box shows created, started, exited. A resumed session box shows resumed and then started. The record_started doc comment now names the hooks-host attach gap and says that #3604 tracks it.

Notes from the agent: This round changed only the doc comment of record_started in crates/minimald/src/box_actor.rs. No code path changed, and attach.rs is unchanged. The runner owns the PR body. Keep the ## Residuals entry for #3604 and the line 'Closes #3426 (the original issue this task was triaged from).', and remove any 'Known gap' sentence.

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

@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: PASS · the full ruling

C1 from the ruling on d8c233cd is met by its residual branch. The PR body names issue #3604 under Residuals for the hooks-host attach gap, and that fix is outside this task's layers. Each launch that starts the entrypoint now writes started through record_started. A resume writes resumed and then started. This conforms to the box event types and the running state in architecture.md lines 382 and 500.

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

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

@agent-137
agent-137 marked this pull request as ready for review November 19, 2026 05:07

@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 resume, restart and first-launch paths look right. resume_in_flight is set and cleared within the one attach handler, finish_resume writes started after resumed (including the wedged-mint case), and the restart keeps its single started. The new tests pin those orders. One medium issue: started is also written whenever a host is re-minted while the record is already running. That happens on an attach or exec after an until_stopped box's shell returned, and on the daemon-start launch of an own-address box. BOX-040 ties started to the record entering running, so those streams show repeated started events with nothing in between. Details are inline. The hooks-host attach gap is already tracked as #3604, so this review does not repeat it.


Generated by Claude Code

self.publish_host();
// BOX-040: a new host started the box's entrypoint. An ended box is
// refused above, so no resume reaches this launch.
self.record_started("exec").await;

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.

Medium: this write, and the matching one in mint_session_host (record_started("attach")), fires on every new host. That includes hosts minted while the record is already running, so the stream gets a second started with no exited or resumed before it. BOX-040 says started is written "each time the box's entrypoint starts and the record enters running".

Concrete path: take an until_stopped session box. Its shell returns (the user types exit and keeps the box). end_on_entrypoint_return sees ends_with_entrypoint == false, logs "the entrypoint returned; the box runs until it is stopped", and leaves the record running with no live host. The next min attach reaches attach_launch. The slot is either None or a dead host whose attach returns Closed, so the attach re-mints through mint_session_host, and resume_in_flight is false, so started is written again. A min exec there goes through this ensure_host launch, because h.is_alive() is false, and writes started too. Each time the shell is re-minted, the events read created, started, started, ... while the record never left running. The daemon-start rehydration of an own-address box (box_manager.rs, resume_own_ip_host -> session.ensure_host) hits the same line: it writes started for a box whose record stayed running across the restart, and logs it under op = "exec".

Suggested fix: write started only when this launch is the one that takes the record into running. One way is an actor flag that a write of started sets, and that exited, resumed and the restart's start clear. The other is to decide that a re-minted shell counts as a start and amend BOX-040's wording. Either way, add a test that attaches, exits the shell of an until_stopped box, attaches again, and asserts the resulting event list.


Generated by Claude Code

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 aeb472a2761f: record_started now writes started only when the record enters running: a started_recorded flag, cleared by exited, resumed and the restart's start, and seeded from the events file for a restored actor. New test reattached_running_box_records_started_once: attach, keep-exit, attach again, then an exec launch, and the events stay created, started.

@agent-137

Copy link
Copy Markdown
Member

/revise

Review finding (norrietaylor, medium, thread at crates/minimald/src/box_actor/host.rs:1765): started is written on every new host, including a host minted while the record is already running. BOX-040 says started is written "each time the box's entrypoint starts and the record enters running". So keep the spec as it is and fix the code:

  1. Write started only when this launch takes the record into running. Add an actor flag, for example started_recorded: bool. record_started sets it and writes nothing when it is already set. A write of exited, a resumed and the restart's start clear it, so the next real start writes started again. This covers both record_started("exec") in ensure_host and record_started("attach") in mint_session_host, and also the daemon-start launch of an own-address box (box_manager.rs resume_own_ip_host -> ensure_host), whose record stayed running across the restart.
  2. Add the test Norrie describes. An until_stopped session box is attached, its shell exits while the box keeps running, and it is attached again. Assert the event list created, started with no second started. Also assert that a min exec after the shell returned writes no second started.
  3. Answer the thread. Keep the PR body's ## Residuals entry for minimald: an attach that keeps a hooks host releases its shell without a started event (D3426 residual, BOX-040) #3604 and the line Closes #3426 (the original issue this task was triaged from).

A host minted while the record stays running, such as a second attach
to an until_stopped box or an exec after its shell returned, wrote a
second started event. The actor now tracks whether this start already
wrote started. An exited or resumed write and the restart's start
clear it. A restored actor reads the events file to decide.
@minimal-foundry

Copy link
Copy Markdown
Contributor Author

Round 3 of 10 on a /revise note, pushed as aeb472a2761f.

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; 1518 filtered out; finished in 0.34s 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; 1518 filtered out; finished in 0.25s 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; 1517 filtered out; finished in 2.25s 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; 1518 filtered out; finished in 0.35s 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.

udflarestorage.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.393s] ( 639/1540) minimald env::tests::search_finds_known_package
        PASS [   3.032s] ( 640/1540) 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
        SLOW [>1380.000s] (─────────) minimald env::tests::minenv_run_forwards_stdin_to_the_task
        SLOW [>1440.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:

  • 👍 valid — crates/minimald/src/box_actor/host.rs:1765: record_started now writes started only when the record enters running: a started_recorded flag, cleared by exited, resumed and the restart's start, and seeded from the events file for a restored actor. New test reattached_running_box_records_started_once: attach, keep-exit, attach again, then an exe

min box events on a new task box shows created, started, exited. A resumed session box shows resumed and then started. An until_stopped session box that is attached, exits its shell, is attached again and then gets a min exec shows created, started with no second started.

Notes from the agent: Round 3. The actor now has a started_recorded flag. record_started sets it and writes nothing when it is set. write_exited_event, the stop's exited write, the resumed write in finish_resume and the restart's move to running clear it. An actor restored from disk starts with the flag clear, so record_started then reads the events file: when the last of started, exited and resumed is started, it writes nothing. That covers the own-address rehydration at daemon start (box_manager.rs resume_own_ip_host -> ensure_host) with no change to box_manager.rs. The daemon-restart case has no dedicated test. The new test is reattached_running_box_records_started_once. I did not run it against the old code to see it fail. PR body items (Residuals entry for #3604, the Closes #3426 line) are the runner's to keep. I did not edit them. just clippy-strict was not run.

@minimal-foundry
minimal-foundry Bot marked this pull request as draft November 19, 2026 07:55

@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: PASS · the full ruling

The new commit writes started only when the record enters running. A second attach or an exec in a running box now writes no second started. This matches the design's meaning of running in architecture.md line 500 and spec BOX-040. Every path that leaves running clears the new flag, and a restored actor reads the events file. Issue #3604 tracks the hooks-host gap. No condition is open.

Ruled at aeb472a against gominimal/arch@8b824707cde6 by claude-opus-5-5.

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

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

@agent-137
agent-137 marked this pull request as ready for review November 19, 2026 10:37

@mitodrummer mitodrummer 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.

Approved.

@mitodrummer
mitodrummer added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit fff177f Nov 19, 2026
39 checks passed
@mitodrummer
mitodrummer deleted the agent/3552-a-box-records-a-started-event-when-its-entrypoin branch November 19, 2026 15: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

3 participants