8000 fix(minimald): arm the workspace baseline at finalize, so a never-attached box can be removed by agent-137 · Pull Request #4042 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): arm the workspace baseline at finalize, so a never-attached box can be removed - #4042

Open
agent-137 wants to merge 2 commits into
mainfrom
fix/rm-never-attached-box
Open

agent-137 wants to merge 2 commits into
mainfrom
fix/rm-never-attached-box

Conversation

@agent-137
@agent-137 agent-137 commented Dec 4, 2026 •
Copy link
Copy Markdown
Member

A plain min box rm of a box started with --detach, never attached, and then stopped exits 2:

The files of bench-b could not be checked for changes, so it was not removed. Checking …/sessions/2d9c8/tree failed: it is not a git repository, and there is no readable record of the files from when the box started.

--force works. Found in pc's full run on 0.8.0-dev.818 (E4).

Why

minimald armed the workspace baseline at a box's first host launch (box_actor/host.rs). A box started detached and never attached has no host launch, so it had no baseline. Stopped, the change check reads the tree against the baseline (assess_baseline_first, #3994's ruling), and with neither a baseline nor a git repository it answered Unchecked.

Treating such a box as having nothing to lose would be wrong: min box exec changes the tree with no host launch.

What changes

finalize now arms the baseline (load_or_arm_baseline, which also persists it) after the workspace upload and the default minimal.toml scaffold have filled the tree, and before an activate hook, an attach, or min box exec can change it. A later host launch reuses that baseline, as a reattach already did. An actor that did not finalize the box, such as one spawned from disk after a restart, still arms at its first launch or reads the persisted sidecar, as before. The walk is the same bounded one (5 s) that the first attach paid before; it now runs at finalize.

So a never-attached box, stopped and unchanged, reads clean, and a plain min box rm removes it. A file that min box exec adds reads as changed.

Tests

  • session_delta_rpc_reads_a_never_attached_box_against_its_creation replaces session_delta_rpc_names_why_a_never_launched_box_is_unchecked, which pinned the reported behaviour. A finalized, never-attached, stopped box reads clean, and a file added with no host reads A. Mutation check: with the finalize arming disabled, it fails.

  • session_delta_rpc_falls_back_to_activation_delta_without_a_repo and session_delta_rpc_reads_a_stopped_box_against_its_first_launch now seed their pre-existing file between configure and finalize (create_box_from(.., false) and then finalize_session), the order a real upload has. Before, they seeded after finalize and before the first launch.

  • minimal client tests over the harness daemon: box_rm_without_force_gates_changed_files now pins pc's expectation: a never-attached stopped box is removed by a headless min box rm, with no --force. box_rm_removes_an_unchanged_stopped_box_without_force seeds its file before finalize through the new harness split (create_unfinalized_session + finalize_configured_session). box_grammar_and_migration_end_to_end checks each rm form's refusal on a running box, then removes the stopped boxes without --force.

    < 8000 /li>

Verification

  • minimal: 1379/1379.
  • minimald: 1700/1701. The one failure is env::tests::run_task_relays_exit_through_both_paths, which fails in this sandbox on main too ("Exec format error").
  • clippy -D warnings and fmt are clean.
  • Not run here: just test-cross and the VM e2e.

🤖 Generated with Claude Code

https://claude.ai/code/session_016CYvTye6pQuxGcVPkx1r2g

Summary by CodeRabbit

  • Bug Fixes
    • Workspace change tracking now starts when a box is finalized, so changes made afterward are reflected in its session activity.
    • Finalized boxes that have not yet been attached report an empty change list when unchanged, and include newly created files when changes are present.
    • Unchanged stopped boxes and finalized boxes that have never been launched can be removed without using --force.

…ached box can be removed

A box started detached and never attached had no host launch, so it had
no workspace baseline. Stopped, with a tree that is not a git repository,
the change check answered "could not be checked", and a plain `min box
rm` refused it. The baseline is now armed when the box is finalized,
after the upload and the scaffold fill the tree and before a hook or
`min box exec` can change it. A later launch reuses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016CYvTye6pQuxGcVPkx1r2g
@agent-137
agent-137 requested a review from a team as a code owner December 4, 2026 11:52
@agent-137 agent-137 added the release:0.8.0 Targeted for the 0.8.0 release. Pair with a priority label. label Dec 4, 2026
@agent-137
Copy link
Copy Markdown
Member Author

/arch-review

@coderabbitai
coderabbitai Bot commented Dec 4, 2026 •
Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Finalization now arms an unarmed workspace baseline after patch materialization and before activation hooks. Test helpers can create sessions before finalization. Tests cover activation deltas and removal of stopped boxes without --force.

Changes: Workspace baseline lifecycle

Layer / File(s) Summary
Arm and verify the baseline
crates/minimald/src/box_actor/setup.rs, crates/minimald/src/box_actor/tests.rs
finalize stores the result of load_or_arm_baseline as Armed. Tests seed workspaces before finalization and check unchanged and added-file activation deltas.
Create sessions before finalization
crates/minimald/src/test_harness.rs
The harness adds helpers to create and configure a session without finalizing it, then finalize it separately. create_configured_session uses both helpers.
Verify stopped-box removal
crates/minimal/src/tests.rs
Tests cover refusals for running boxes and removal of stopped boxes without --force, including a never-launched box with a finalized file record.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • gominimal/minimal#3995: It checks a stopped box’s tree against the first-launch baseline during removal. This change arms that baseline at finalization.

Suggested reviewers: bryan-minimal

Merge Risk: Minimal · up to 84c18

Stopped, unchanged boxes that were never attached can now be removed with plain min box rm, and files added by min box exec still read as changed. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title follows the Conventional Commit form type(scope): summary with a lower-case, imperative summary and no trailing period. It names the main change: the workspace baseline is armed at finaliz…
Description check Passed The description follows the template's main parts. It has a Summary that explains the bug, the cause, and the change, with issue context. It has a Testing section that lists test results and verificat…
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 the Conventional Commit form type(scope): summary with a lower-case, imperative summary and no trailing period. It names the main change: the workspace baseline is armed at finalize, which lets a never-attached box be removed. The title is clear and specific, and it matches the objectives and the code changes.

Full details: Description check

Explanation

The description follows the template's main parts. It has a Summary that explains the bug, the cause, and the change, with issue context. It has a Testing section that lists test results and verification, including the one known failing test and the tests not run. The Checklist is missing: the description does not say whether docs were updated, and it does not state whether a BREAKING CHANGE footer applies. The description also does not include explicit issue links such as Refs: or Closes:, though it cites #3994 and the author's report.

Resolution

Optionally complete the Checklist: state whether docs were updated for the changed finalize behavior, and state whether this is a breaking change. Optionally add a Refs: or Closes: line for the related issue.

Finishing Touches

Generate unit tests (beta)

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

A rabbit checks the workspace tree
A baseline waits before hooks run
A seeded file leaves its trace
A stopped box can be removed
The rabbit hops; the tests are done

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: 053f89b0-f102-4707-8654-65f14f4e1c46
Commits

Reviewing files that changed from the base of the PR and between b700505 and 84c18fb.

Files selected for processing: 2

  • crates/minimal/src/tests.rs
  • crates/minimald/src/test_harness.rs

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 Dec 4, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 84c18fb74fc8.

Nothing to do.

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

The design of record is silent on the workspace change baseline and on when it is armed. This is a PASS by absence. The arm moves to finalize in the same box actor. It runs before hooks, attach and min box exec can change the tree. A box with no usable baseline still reads from git state or as Unchecked, so the check still fails closed.

Ruled at b700505 against gominimal/arch@5cfb8febb353 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

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

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Dec 4, 2026
…box without --force

The client tests read a box's tree over the harness daemon. Seeded after
finalize, their files are now changes against the finalize baseline, so
they seed between configure and finalize, the order a real upload has:
the harness splits create_configured_session into
create_unfinalized_session and finalize_configured_session. The tests
that pinned the never-attached refusal now pin its removal, and the
end-to-end walk refuses each rm form on a running box instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016CYvTye6pQuxGcVPkx1r2g
@agent-137
Copy link
Copy Markdown
Member Author

/arch-review

@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 compare since b700505e changes only tests and the test harness. The tests follow the finalize-time baseline, which was ruled PASS at that head. The refusal of a box that cannot be checked is still tested at rm_gate and in the daemon. The design does not specify the rm change check, so this is a PASS by absence.

Ruled at 84c18fb against gominimal/arch@5cfb8febb353 by claude-opus-5-5.

@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 8000 comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — 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

backport release/0.8.x Backport this PR to release/0.8.x priority:should-have Should be done. Applied by the inbox-route classifier or a human. release:0.8.0 Targeted for the 0.8.0 release. Pair with a priority label. review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0