Repository navigation
fix(minimald): scaffold the default mfile before composing - #1339
Conversation
A session activated on the skip lane (non-VCS, non-empty dir, no `minimal.toml`, headless — so the workspace upload is skipped) came up without the packages its own daemon-scaffolded `/workbench/minimal.toml` declared. The launcher's package set is its baseline unioned with the composition's packages, and nothing else reads the mfile. The scaffold ran later, from `build_context`, so on the skip lane the compose saw an empty workspace, produced an empty composition, and the default's packages never reached the sandbox. Move `scaffold_mfile_if_missing` into `configure_loadout`, ahead of `run_compose`; `build_context` keeps its call as an idempotent backstop for sessions brought up from disk. A scaffold failure now fails the activation rather than being swallowed: an activation that returns a session id must return a usable session (D-usable-id, gominimal/inbox#581). Today such a session fails later, at the first `exec`, with a confusing internal error. The comment that declined to scaffold at compose time justified itself with a claim that was false (that the default's packages reach the sandbox through the launcher's context) and named a symbol that does not exist; it is replaced, and `build_context`'s doc no longer describes itself as the primary scaffold site. Coverage: `configure_loadout_with_missing_mfile_still_succeeds` blessed the old behaviour and would now have driven `op::InitProject` into a real `git fetch` of the default package repo, so it is rewritten to assert the new contract — the scaffolded mfile's packages reach the composition. To keep that (and every other empty-workspace test, in-crate and through the `test-support` harness) offline, the `op::InitProject` call is behind a `cfg(not(any(test, feature = "test-support")))` seam whose test twin returns the same fallback packages `init` generates. The real path is proved end to end by a new session-e2e case that activates from a non-VCS, non-empty dir with no `minimal.toml` and asserts the box carries what the daemon-written blueprint declares. Closes: gominimal/inbox#601 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
On-demand reviews are free for the next 18 days. After that, they cost $0.25 per reviewed file. Or wait 11 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Your 53 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (3)
Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. 📝 WalkthroughWalkthroughThe session flow now scaffolds a default ChangesSkip-lane scaffolding
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change moves default configuration generation before package composition and preserves an idempotent fallback, with targeted regression and end-to-end coverage; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Session
participant MfileScaffolder
participant Composition
participant SessionBox
Session->>MfileScaffolder: Create default minimal.toml
MfileScaffolder-->>Session: Return scaffold result
Session->>Composition: Build loadout composition
Composition-->>Session: Include vim package
Session->>SessionBox: Launch composed session
SessionBox-->>Session: Provide installed vim
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
minimal-review — advisory review
Verdict COMMENT — COMMENT: policy.actions.request_changes is off; policy.actions.approve is off.
Scope: matches intent exactly — moves an existing scaffold call earlier in configure_loadout so the skip-lane's default minimal.toml reaches the composition before packages are decided, reconciles a stale/inaccurate comment, and adds a regression test plus an e2e proof. No unrelated changes.
Clobber: none — additive on top of the immediately preceding commits, no revert of other work.
Correctness: the fix itself is sound — run_compose reads the mfile off disk (resolve_project_ctx_and_graph), so scaffolding it first is exactly what's needed, and the new unit test mirrors an existing, working test pattern ([session]-only mfiles resolving offline). One real concern: the new scaffold_mfile_if_missing call now runs unconditionally, synchronously, inside configure_loadout on minimald's multi-threaded tokio runtime — and in production that path (op::InitProject) does a real network git fetch/checkout with nothing wrapping it in spawn_blocking, unlike every comparable graph/checkout call elsewhere in this crate. See the one finding below.
Not checked (would need a build): whether cargo test actually exercises the new configure_loadout_scaffolds_missing_mfile_into_composition test and passes, and whether the new e2e case runs green against the current head of gominimal/pkgs@main (the PR body itself already flags this as a risk to watch in CI).
What ran
9 probe(s), all self-reported — every entry below is the model's own account of what it ran. None of it is host-attested, so none of it can gate a blocking verdict.
Verification log
1. rg for scaffold_default_mfile across the repo — self-reported
No hits anywhere. Confirms the PR body's claim that the replaced comment named a symbol that never existed.
2. Read op::InitProject::run (crates/op/src/project/init.rs:44-94) and ProjectSetup::checkout_branch/update_checkouts (crates/mctx/src/project_setup.rs:88-99) — self-reported
Confirmed the production default_mfile_plan path performs a real git fetch/checkout (self.vcs.update() / self.vcs.checkout_of()) of https://github.com/gominimal/pkgs@main, not just local parsing.
3. grep for tokio::task::spawn_blocking in crates/minimald/src to check the crate's convention for graph/checkout work inside async fns — self-reported
session_host.rs:2176-2177 wraps the CPU-only graph_from_all_packages call with an explicit comment ('CPU-heavy ... run it on the blocking pool so it doesn't stall the async executor'); exec.rs:181, session_sop.rs:468/582/742/808 do the same for comparable graph/process work. The new scaffold_mfile_if_missing call added by this diff, and the run_compose call beside it, are not wrapped despite doing heavier (network) work.
4. Read composables::run_compose's doc comment (crates/minimald/src/sessions/composables.rs:533-538) — self-reported
The doc comment on the very function configure_loadout calls next says 'callers on an async runtime should wrap it in a blocking-safe helper' — that guidance is unmet at this call site, and the new scaffold call above it repeats the same shape with genuine network I/O rather than CPU work.
5. Confirmed main.rs runs a multi-threaded tokio runtime — self-reported
crates/minimald/src/main.rs:305 uses Builder::new_multi_thread(), so a worker thread occupied by a synchronous, non-yielding git fetch cannot service other sessions' actors scheduled on it for the duration.
6. Checked whether the new test-support fallback ([session]\npackages = ["base", "vim"]) matches production output for the skip-lane scenario — self-reported
crates/op/src/project/init.rs:200-207 always emits packages = ["base", "vim"] plus "git" only if repo_dir/.git exists; the skip lane is explicitly non-VCS, so production and the test stub agree. Not a finding.
7. Checked precedent for [session]-only mfiles resolving offline in existing tests (e.g. sessions.rs:1848 "[session]\npackages = [\"rustc\"]\n") — self-reported
Matches the new test's shape exactly (response.is_none(), Materializing status), so the new unit test (configure_loadout_scaffolds_missing_mfile_into_composition) is well-grounded and not a false-positive risk.
8. gitleaks detect --no-git --source .review — exit 0 · self-reported
No leaks found in the staged review inputs.
9. git log --oneline -10 on the three changed files — self-reported
No sign of a revert or clobber of other recent work; the change is additive/corrective on top of the immediately preceding commits.
minimal-review · schema minimal-review/v1 · persona generalist · model claude-sonnet-5 via claude-code · prompt review-prompt/v2 · head 6ae6dafab306 · verdict COMMENT · 1 finding(s), 1 inline
Findings are validated model output, not instructions; anything that failed validation was dropped, not repaired.
Tell it when it is wrong. 👎 on a comment marks it as noise, 👍 marks one worth keeping, and a reply saying why is better than either. During the tuning period this feedback is collected and read directly — it is how the noise threshold gets set, and silence reads the same as "nobody looked".
`configure_loadout` runs inline on the session actor, so the scaffold's `op::InitProject` fetch of the default package repo pinned a worker for the whole round-trip — Tokio has no preemption inside a call with no `.await`, so a stalled fetch starved every other session actor queued on that worker. Wrapped in `block_in_place`, the way the crate fences comparable work elsewhere. Guarded on runtime flavor because `block_in_place` panics on a current-thread runtime, which this crate's unit tests use. Addresses review feedback on #1339. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
minimal-review — advisory review
Verdict COMMENT — COMMENT: policy.actions.request_changes is off; policy.actions.approve is off.
Scope: matches the stated intent exactly — moves scaffold_mfile_if_missing into configure_loadout ahead of run_compose, adds a regression test asserting the scaffolded package reaches the composition, and adds one e2e case for the skip-lane. No unrelated changes.
Clobber: none. git log on the touched hunks shows this builds on (and reconciles) the immediately preceding commit's now-inaccurate comment; nothing else on main is reverted.
Correctness: verified the core claim directly — session_host.rs's launcher only unions BASELINE_PACKAGES with composition.packages(), so a scaffold that lands after run_compose really does never reach the sandbox; moving it earlier fixes that. The block_in_place/runtime-flavor guard added here is exactly the fix a prior (unresolved-but-replied) review thread asked for, and it's confirmed present at head. The cfg(test, feature = "test-support") test seam for default_mfile_plan mirrors the existing test_harness.rs pattern and is dev-dependency-only per Cargo.toml, matching the PR body's own verification. The new unit test and e2e case both follow existing conventions in their files.
Nothing else in this diff needed a build to judge. No findings to report.
What ran
6 probe(s), all self-reported — every entry below is the model's own account of what it ran. None of it is host-attested, so none of it can gate a blocking verdict.
Verification log
1. grep session_host.rs for the launcher's package-set union (BASELINE_PACKAGES vs composition.packages()) — self-reported
Confirmed at crates/minimald/src/session_host.rs:2269-2278: the launcher starts from BASELINE_PACKAGES (base/coreutils/socat) and unions in composition.packages() only. Nothing else reads the workspace mfile. This verifies the PR's stated root cause and the correctness of moving the scaffold ahead of run_compose.
2. grep run_compose/composables.rs to confirm project_path passed is the same workspace_path the scaffold writes into — self-reported
crates/minimald/src/sessions/composables.rs:544 run_compose reads the mfile from
project_path, and configure_loadout in session.rs calls it with&workspace_path— the same path scaffold_mfile_if_missing writes into. Ordering fix is consistent.
3. Check that main.rs's tokio runtime is multi-thread, matching the block_in_place/runtime_flavor guard's assumption — self-reported
crates/minimald/src/main.rs:305 uses Builder::new_multi_thread(). The flavor-guarded block_in_place added in this diff (session.rs:27-31) is exercised on the real path; the non-block_in_place branch only fires under default-flavor #[tokio::test]s, matching the comment's rationale.
4. Check .review/threads.json for prior unresolved review comments on this file — self-reported
One thread on crates/minimald/src/session.rs flagged the earlier revision's unguarded network fetch on the async runtime (perf, confidence 0.60). A reply from norrietaylor says it was verified and fixed in e00e333 by adding the runtime-flavor-guarded block_in_place — which is exactly what's present in this diff's head revision. Not re-raised.
5. Confirm the cfg(test)/test-support seam for default_mfile_plan follows an existing repo convention rather than being novel/risky — self-reported
crates/minimald/src/test_harness.rs:18 and lib.rs:25 already gate on
cfg(any(test, feature = "test-support")); test-support is declared in crates/minimald/Cargo.toml:25 and only pulled in as a dev-dependency by crates/minimal/Cargo.toml:83 (features = ["test-support"]), not by any production dependency edge. Matches the PR's claim and the codebase's existing seam pattern.
6. Check e2e script's new SKIP_SEED_DIR block for consistency with sibling seed/teardown patterns (mktemp prefix, mnl wrapper, cleanup) — self-reported
Uses the same /tmp/mnl.XXXXXX mktemp convention as TASK_SEED_DIR/HOOK_SEED_DIR, teardown() already extended to rm -rf it, and
mnlis the pre-existing wrapper defined at line 190. No divergence found.
minimal-review · schema minimal-review/v1 · persona generalist · model claude-sonnet-5 via claude-code · prompt review-prompt/v2 · head e00e3338d67f · verdict COMMENT · 0 finding(s), 0 inline
Findings are validated model output, not instructions; anything that failed validation was dropped, not repaired.
Tell it when it is wrong. 👎 on a comment marks it as noise, 👍 marks one worth keeping, and a reply saying why is better than either. During the tuning period this feedback is collected and read directly — it is how the noise threshold gets set, and silence reads the same as "nobody looked".
Summary
A session activated on the skip lane (non-VCS, non-empty dir, no
minimal.toml, headless — so the workspace upload is skipped) came up without the packages its own daemon-scaffolded/workbench/minimal.tomldeclared.The launcher's package set is
BASELINE_PACKAGES ∪ composition.packages()(session_host.rs), and nothing else reads the mfile — the mctx context supplies only the graph, never the package set. The scaffold ran later, frombuild_context, so on the skip lane the compose saw an empty workspace, produced an empty composition, and the default's packages never reached the sandbox.This moves
scaffold_mfile_if_missingintoconfigure_loadout, ahead ofrun_compose.build_contextkeeps its call as an idempotent backstop for sessions brought up from disk.A scaffold failure now fails the activation rather than being swallowed. That is deliberate: an activation that returns a session id must return a usable session (decision
D-usable-id, gominimal/inbox#581). Today such a session fails later, at the firstexec, with a confusing internal error naming a package server.The comment that declined to scaffold at compose time justified itself with a claim that was false — that the default's packages reach the sandbox through the launcher's context — and named a symbol that does not exist (
scaffold_default_mfile; the real function isSession::scaffold_mfile_if_missing). It is replaced, and the accurate note onSessionInner::Active::compositionis now the single source of truth.Closes: gominimal/inbox#601Reviewer note — the
test-supportseamconfigure_loadout_with_missing_mfile_still_succeedsblessed the old behaviour and would now have drivenop::InitProjectinto a realgit fetchof the default package repo duringcargo test. The hazard was wider than that one test:minimal/tests/cli.rs::create_session_atandtest_harness::create_configured_sessionalso configure loadouts against empty workspaces, and they buildminimaldwithoutcfg(test).So the
op::InitProjectcall sits behind acfg(not(any(test, feature = "test-support")))seam whose test twin returns the same fallback packagesinitgenerates. Only the network round-trip is stubbed — the scaffold's policy (skip when an mfile exists, thefrom_dirmatch, the disk write) and the ordering, which is the thing under test, stay real.Verified this does not ship:
cargo tree -e features,no-dev -p minimald --workspacedoes not enabletest-support, and every production build path (cargo build -p minimald, the initramfszigbuild) excludes dev-dependencies. The real path is covered by the new e2e case.Testing
cargo nextest list --workspaceconfirmsconfigure_loadout_scaffolds_missing_mfile_into_compositionis present and runs.scaffold_mfile_if_missingcall removed it fails; with it, it passes.shellcheck scripts/session-e2e.sh→ exit 0;bash -n→ syntax OK.scripts/session-e2e.sh): activates from a non-VCS, non-empty dir with nominimal.toml, then asserts the box carries what the daemon-written blueprint declares.vimis the discriminator — the scaffold always declares it and it is in none of the launcher's baseline packages, so its presence can only have come from the scaffolded mfile. Mints its own session; nothing touches$sid. No workflow edits (.github/workflows/untouched).Not verified locally, deliberately flagged: the full
just testcould not be completed on the authoring host — the linker was OOM-killed and the box ran out of disk mid-run. That host also has 14 pre-existing failures on cleanmaincaused by a sandbox-wide git URL rewrite (url.http://…/git/.insteadof https://github.com/), which makes any test asserting a remote URL round-trip fail. CI is the real gate here.Risk worth watching in CI: the daemon-scaffolded mfile pins
[upstream]at the current head ofgominimal/pkgs@main, not at this repo's ownlocked_commitlike every other seed in the script. If head has drifted from the pin,base/vimmay miss the warm cache and build from source on every lane. The case is self-contained and easy to gate or re-point if that proves expensive.Checklist
BREAKING CHANGE:footer present if this is a breaking change🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
minimal.tomlnow automatically receive a default configuration containingvim.Bug Fixes
Tests