fix: gate init "create a session" hint on active session - #781
fix: gate init "create a session" hint on active session#781gominimal-aw-bot[bot] wants to merge 1 commit into
Conversation
The init command's post-creation 'Next steps' block printed 'minimal activate . # create a session' (and the 'minimal attach' hint) unconditionally, so running 'minimal init' from inside an active session suggested creating a session that already exists. Compute the hint lines in a pure init_next_steps helper and omit the activate/attach hints when MINIMAL_SESSION_ID is set and non-empty. Closes: #771
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This guards a state that can't currently occur — the stale hint doesn't reproduceI tried to confirm the repro from #771 and it doesn't hold up. The claimed flow is:
Step 1's premise is false: Evidence
So Why it looked plausibleThe chain was machine-generated and never verified against a running session: #771 was inbox-auto-routed with an LLM-written repro (it assumed SuggestionOne-line check inside a real session settles it: If it's empty (per the code above, it will be), I'd close #771 as not-reproducible. If we want |
|
Closing as invalid — this targets the wrong root cause. The real repro (see the reporter's terminal): That gate is dead code: The correct fix keys off the caller (activate auto-scaffold vs standalone |
…e mfile `minimal activate` on a project without a `minimal.toml` auto-scaffolds one via `run_init_flow`, which printed a "Next steps" block suggesting `minimal activate . # create a session` — nonsensical there, since `activate` is already running and creates the session in the same command. Just drop the block; `init` still reports the created path and the next action is clear from context. Supersedes #781, which gated the hint on `MINIMAL_SESSION_ID` — a channel-routing var never set in this host-side flow. Closes: #771 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e mfile (#785) `minimal activate` on a project without a `minimal.toml` auto-scaffolds one via `run_init_flow`, which printed a "Next steps" block suggesting `minimal activate . # create a session` — nonsensical there, since `activate` is already running and creates the session in the same command. Just drop the block; `init` still reports the created path and the next action is clear from context. Supersedes #781, which gated the hint on `MINIMAL_SESSION_ID` — a channel-routing var never set in this host-side flow. Closes: #771 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes #771
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABI2fYCw
Problem
Running
minimal initfrom inside an already-active session printed astale "Next steps" block that told the user to run
minimal activate . # create a session, even thoughMINIMAL_SESSION_IDwas set (the session UUID even appeared in the surrounding output). The init
path in
crates/minimal/src/lib.rsemitted the activate (andattach) hintsunconditionally and never consulted
MINIMAL_SESSION_ID.Change
In
run_init_flow(crates/minimal/src/lib.rs), the post-creation hint linesare now computed by a small pure helper,
init_next_steps(matched, in_session). When the process is already inside a session — detected viastd::env::var("MINIMAL_SESSION_ID")being set and non-empty, the same envvar contract used elsewhere in the crate (
client.rs) and inminimald— the"create a session" and "attach" hints are omitted, leaving only the still-valid
minimal updatestep. Outside a session, behavior is unchanged:activateisalways suggested and
attachis added only when the plan matched an existingsession.
The
matched/in_sessiondecision is extracted into the pure helper purely soit can be unit-tested without touching the filesystem or environment; the
printing loop is otherwise a direct translation of the previous
eprintln!block.
A neighbouring open PR, #682, touches the reverse activate↔init interaction
(prompting to init when
activatefinds nominimal.toml); it is a distinctscenario and does not overlap this change.
Verification
Gate run from the workspace root against
crates/minimal:cargo fmt --all --check --manifest-path target/Cargo.toml— clean, exit 0.cargo clippy --workspace --manifest-path target/Cargo.toml -- -D warnings— no warnings,Finishedexit 0.cargo build --workspace --manifest-path target/Cargo.toml— exit 0.cargo test --workspace --manifest-path target/Cargo.toml— exit 0; all suites0 failed, including the two new testsinit_next_steps_omits_session_hints_when_in_sessionandinit_next_steps_shows_session_hints_when_not_in_session.