Repository navigation
T52 — Hold every record in one of five states, migrated once, and reaped only when unfinished - #2632
Conversation
The record module gives each state its reason, exit code and signal, and decides which records a daemon restart reaps: pending and materializing only. Two Kani harnesses prove both properties.
At store open, a record written before the two fields becomes a session box with no parent. A nil id is replaced with a fresh one. Each migration logs one line, and a later start leaves the record as it is.
The start-up reap asks the boxes crate which states a restart reaps, so only pending and materializing records go and running ones stay.
…-record-in-one-of-five-states-migrated
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none seen in the store and manager hunks. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The reap at restart and the one-time migration conform to architecture.md line 495 and line 499. BOX-011 does not. The five states exist only as the RecordState type, and no stored record can be stopped or exited. The PR still closes #2387. C1 changes that to Part of #2387 and files an issue for the stored endings. C2 removes a test assertion that keeps a record with no process running across a restart. Line 495 says that record becomes stopped.
Ruled at 9945fa3 against gominimal/arch@109541a48c31 by claude-opus-5-5.
The BOX-012 Kani harness ran restart_reap into Vecs over a symbolic length and CBMC ran out of time. restart_reap now takes any Default + Extend output, so the harness runs it into a four-slot buffer with no heap. The minimald restart test now checks only that the running record is kept, since the mock launcher starts no process.
|
/revise Four fixes on 9945fa3. Two are CI failures and two come from review. 1. 2. 3. arch-review C2 (crates/minimald/src/box_manager/tests.rs:2285). In 4. minimal-review, crates/boxes/src/store.rs:558. The finding holds. arch-review C1 (the issue and the PR body) is done outside this round: #2634 holds the rest of BOX-011, and the body will say Run the plan's test lines plus |
|
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. |
The store reopen now runs the one-time migration, which stamps box_type on a record that lacks it. Seed the held record with its type, so the test still proves the retained record is unchanged.
…-record-in-one-of-five-states-migrated
|
Round 1 of 10 on a failed check suite, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
After a daemon restart, a stored session that was active loads as a running box and the restart keeps it. The restart deletes only pending and materializing records. A record without box_type or parent is migrated once, with one log line for each record. Notes from the agent: Revise round 1. (1) Kani lane: the restart_reaps_only_pending_or_materializing harness ran restart_reap into Vecs over a symbolic length, and CBMC ran out of time. restart_reap is now generic over a Default + Extend output. The harness runs it into a fixed four-slot buffer with no heap. It also checks store order. Kani is not on this box, so the new harness is not run here. Both Kani harnesses stay deferred to the kani lane. (2) tests lane: minimald store::tests::colliding_box_id_refuses_creation failed because the store reopen now runs the one-time migration, which stamps box_type on the seeded record. I changed crates/minimald/src/store.rs, which is OUTSIDE the task's layers, to seed that record with box_type = session. No other code changed in that file. (3) Threads C1 and C2 are judged below. C1 asks for a new issue and a PR body change from 'Closes #2387' to 'Part of #2387'. I have no credential for either, so a person must do both. The runner writes the PR body, and the commits carry no closing keyword. Deferred lines, not run: cargo nextest run -p boxes state_is_exactly_one (kani), cargo nextest run -p boxes restart_reaps_only_pending_or_materializing (kani). The unit tests with those names pass locally. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
BOX-011 still does not conform to architecture.md line 495. A record must be in one of five states, and a stopped or exited record must store its reason, exit_code and signal. The stored BoxState still holds only Pending, Materializing and Active, and the five states exist only in memory as RecordState. The new commits fix the Kani harness and two tests, but they do not change this. The migration (BOX-003) and the restart reap (BOX-012) conform. Do C1: store the ending, or file an issue for it and name that issue in the PR body and in the two doc comments.
Ruled at 278c40e against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
/revise One fix on 278c40e, item 4 of the last directive, which round 1 left out. minimal-review, crates/boxes/src/store.rs:557. The finding holds. arch-review C1 is done: #2634 is filed, and the body says Run the plan's test lines plus |
|
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. |
The BOX-003 migration now sets session only on a record with no box_type. A typed record with no parent key keeps its type and gets parent null. The BOX-012 Kani harness now proves the per-record reap decision with no collection, so it stays inside the lane's memory.
|
Revise round 1 ran against |
|
/revise Two fixes on 278c40e. The first clears the kani lane; the second is the held item from the last 1. kani: 2. minimal-review, crates/boxes/src/store.rs:557. In the migration, set Leave the PR body's Run the plan's test lines plus |
|
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. |
The BOX-003 migration runs when the store reopens. The test now reads the held record from the reopened store, so it checks only that the refused create leaves that record unchanged.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 6 unresolved threads — minimal-arch[bot] crates/boxes/src/core/record.rs:9, minimal-arch[bot] crates/boxes/src/core/record.rs:414, minimal-arch[bot] crates/minimald/src/box_manager/tests.rs, minimal-foundry[bot] crates/boxes/src/core/record.rs, minimal-arch[bot] crates/boxes/src/core/record.rs:9, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 2 conditions · the full ruling
The compare closes the open points of the last ruling. The migration now keeps a stored box_type, as glossary line 21 requires. The Kani harness proves the reap predicate that the daemon calls. The BOX-003 spec text still says that each such record becomes session, so amend the spec (C1). The two Kani legs are still not run, and C2 records them. The stored-ending gap for BOX-011 stays residual #2634.
Ruled at f5881fc against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 2 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
1 outdated runtime thread(s) were not judged: After a daemon restart, a session record from before box types is a running session box with no parent, and it migrates only once. A record that already has a box_type (for example task) keeps it. The restart reaps only pending and materializing records. Notes from the agent: Fix 1: colliding_box_id_refuses_creation now reads the held record from the reopened store as |
state_is_exactly_one compared state names as strings. A string compare is a byte loop, so it failed under #[kani::unwind(1)].
|
Round 3 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
After a daemon restart, old session records stay on as running boxes, and the restart reaps only pending and materializing records. A record that already has a box_type and has no parent key keeps its type and gets a null parent. Notes from the agent: Directive item 1: holds_one_state_with_its_ending now matches on the RecordState variant, not on name(). The outer |
|
/revise One edit on 20b0960: arch-review C1 (ruling on f5881fc), the BOX-003 spec amendment. A maintainer accepted this out-of-layer edit to Rewrite the BOX-003 requirement (line 65) to the behaviour of
Keep its Leave the Kani legs (arch C2) to the kani CI lane on this head, and leave the PR body's |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 2 conditions · the full ruling
The compare since f5881fcd is sound. The Kani check now matches on the variant and proves the same rule, and the code names #2634 for the stored ending. The record still stores only three of the five states that line 495 of architecture.md requires. C1 keeps that work open under #2634, and the change can merge with it open. C2 asks you to amend the BOX-003 spec line, so that it agrees with the migration that the code does.
Ruled at 20b0960 against gominimal/arch@109541a48c31 by claude-opus-5-5.
The migration in heal_migrate_untyped_records keeps the box_type of a record that has one and lacks only the parent key. BOX-003 now says so, and a second verify: line names the unit test for that case.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 10 unresolved threads — minimal-arch[bot] crates/boxes/src/core/record.rs:9, minimal-arch[bot] crates/boxes/src/core/record.rs:417, minimal-arch[bot] crates/minimald/src/box_manager/tests.rs, minimal-foundry[bot] crates/boxes/src/core/record.rs, minimal-arch[bot] crates/boxes/src/core/record.rs:9, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
The new commit amends BOX-003 so that the spec matches the migration code. A stored box_type is kept, and only a missing one becomes session. The design is silent on migration, so the amendment conforms. The stored stopped and exited states that line 495 requires are still absent. C1 keeps that open, and issue #2634 owns it. The change can merge with C1 open.
Ruled at c8ced45 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 4 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Spec BOX-003 now states what the migration on this branch does: a record without box_type takes session, a record with a box_type keeps it, both get no parent, a fresh id only for a nil id, and no change on a later start. After restart, old sessions are running boxes, and the daemon reaps only unfinished records. Notes from the agent: Revise round 4 changed only the spec, as the maintainer directed. This file is outside the task layers, and the maintainer accepted the edit. I changed no code. The first verify: test (restart_migrates_records_missing_type_or_parent_once) does not cover the kept-box_type case. Its typed record already has both keys. So a second verify: line names heal_migrate_keeps_box_type_of_record_without_parent_key in crates/boxes/src/store.rs. just lint-prose did not run, because vale is not installed on this box. The prose lane must lint the changed lines. The Kani legs stay deferred to the kani CI lane: state_is_exactly_one and restart_reaps_only_pending_or_materializing. I did not touch the PR body. |
T52 — Hold every record in one of five states, migrated once, and reaped only when unfinished
slice: S0
kind: task
covers: BOX-001, BOX-003, BOX-011, BOX-012
size: L
est: 410 code, 460 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: daemon log names each migrated record
observability: one log line per migrated record
layers:
- state-model:
- crates/boxes/src/core/record.rs (new): state model, reap decision, harnesses
- crates/boxes/src/core/mod.rs: mod line
- crates/boxes/src/lib.rs: running, stopped, exited
- scripts/kani.sh: two more harnesses
test: cargo nextest run -p boxes record_state_is_one_of_five_with_exit_reason
test (deferred: kani): cargo nextest run -p boxes state_is_exactly_one
test: cargo nextest run -p boxes restart_reaps_only_pending_and_materializing
test (deferred: kani): cargo nextest run -p boxes restart_reaps_only_pending_or_materializing
- migration:
- crates/boxes/src/store.rs: one-time migration
test: cargo nextest run -p boxes restart_migrates_records_missing_type_or_parent_once
- create-path:
- crates/minimald/src/box_manager.rs: verb type; pure reap at start
- crates/minimald/src/box_manager/tests.rs: tests
- crates/minimal/src/task.rs: marks the task verb
test: cargo nextest run -p minimald legacy_create_path_records_type_from_creating_verb
produces:
- crates/boxes/src/core/record.rs
consumes: none
proof: After restart, old sessions are running boxes; only unfinished records reaped.
depends on:
- blocked by #2386
Proof
Partly delivered. After a daemon restart, a record written before box types loads as a session box with no parent. A nil id gets a fresh id. The daemon log has one line for each migrated record, and a later start leaves the record unchanged. Stored active records read as running through Record::state(), and the start-up reap deletes only pending and materializing records. A box record cannot yet be stored as stopped or exited. The five-state model, with its reason, exit_code and signal, exists only as the RecordState type in crates/boxes/src/core/record.rs.
Notes from the agent: Scope gap (BOX-011): the stored BoxState still has only Pending, Materializing and Active. To add Stopped and Exited, or to rename Active to Running, I must change exhaustive matches and Record struct literals in files outside the layers: crates/minimal/src/cmd/list.rs (the
min lslabel printsactive), crates/minimal/src/attach.rs, crates/minimald/src/box_actor.rs, crates/minimald/src/box_actor/setup.rs, and several test fixtures. Because of this, record.rs holds the five-state model as a typed RecordState (endings are typed, so only the BOX-011 table rows can be represented). Record::state() projects the stored status onto it (Active -> running). BoxState::Active also accepts the spellingrunningon load. A later task must store an ending on the record and own those files, and it must change themin lslabel fromactivetorunning.Create path: T1 (#2521) already stamps box_type from the creating verb, and crates/minimal/src/task.rs already sends CreatingVerb::Task. So task.rs needs no change. The test legacy_create_path_records_type_from_creating_verb already exists inline in box_manager.rs (create_stamp_tests) and passes. In box_manager.rs, the change is that reap_unresumable_records now calls RecordState::reaped_at_restart(). I added restart_keeps_running_records_and_reaps_pending_ones to box_manager/tests.rs.
Migration (BOX-003): the spec says migrate a record…[truncated]
Tests
cargo nextest run -p boxes record_state_is_one_of_five_with_exit_reasoncargo nextest run -p boxes restart_reaps_only_pending_and_materializingcargo nextest run -p boxes restart_migrates_records_missing_type_or_parent_oncecargo nextest run -p minimald legacy_create_path_records_type_from_creating_verbVerify
min task run agent-verifyexited 101 under rustc 1.98.1, which the repository does not pin (1.99.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.Base
The base branch moved while the coder worked; it was merged in before the tests ran.
Deferred
The plan marked these test lines deferred: the executor lacks the lane, so nothing here ran them and they still owe evidence.
cargo nextest run -p boxes state_is_exactly_onecargo nextest run -p boxes restart_reaps_only_pending_or_materializingResiduals
stoppedandexitedwith their endings on every box record, themin lslabel, and thestate_is_exactly_oneharness overRecord(arch-review C1).Kani
state_is_exactly_oneandrestart_reaps_only_pending_or_materializingverified in the kani lane onc8ced457(expect boxes 12,ci-kani-successgreen).Closes #2387
Maintainer accepted the out-of-layer edit to
crates/minimald/src/store.rs(the collision test seeds its record with a box type), 2026-10-26. Undrafted.Maintainer accepted the out-of-layer amendment of BOX-003 in
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md(arch-review C1), 2026-10-26.