fix: announce which session bare min and min attach entered - #1016
Conversation
A bare `min` (and `min attach` with no session arg) auto-resolves a session for the current directory and drops the operator into its shell with no output — the resolved session is written only to `tracing::info!`, invisible at the default log level. On the no-sessions path the activate step prints just a bare UUID to stdout with no framing. Print a single stderr line before handing off to the shell: - `Attaching to session <name> (<short-id>)` on the unambiguous auto-resolve path (added in `resolve_smart_attach`, so both bare `min` and `min attach` are covered; the picker path is left untouched since a selection is its own confirmation). - `Created session <name> (<short-id>)` on the activate-then-attach path. The label prefers the session name and appends the leading UUID block as a short id so two same-named sessions from the same directory stay distinguishable; an unnamed session falls back to the short id alone. Both lines are suppressed under `--no-input` and when stderr is not a terminal, so the bare-id stdout scripting contract stays intact for CI and scripts.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Comment |
Fixes #1014
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABKk0kog
What was broken
A bare
min(andmin attachwith no session argument) auto-resolves a session for the current directory and hands off to its shell with no user-visible output. The resolved session was written only totracing::info!incrates/minimal/src/lib.rs, invisible at the default log level, so the operator had no way to confirm they landed in the session they expected rather than a stale one built from the same directory. On the no-sessions path,cmd_activate --attachprinted only a bare UUID to stdout with no framing.The change
Single file,
crates/minimal/src/lib.rs:session_announce_label(id, name)— prefers the session name and appends the leading UUID block as a short id (name (abcdef01)); falls back to the short id alone when the session is unnamed.should_announce_session(global)— the suppression gate: announce only when stderr is a terminal and--no-inputis not set.resolve_smart_attach: on the unambiguousSmartResolve::Attacharm, printAttaching to session <label>to stderr before returning. This one site covers both baremin(cmd_default) andmin attachwith no session argument. TheSmartResolve::Pickarm is deliberately left untouched — a picker selection is its own confirmation.cmd_activate: on the activate-then-attach path (args.attach), printCreated session <label>to stderr, after the id is emitted to stdout.The bare-id
println!to stdout is left exactly as-is, so the scripting/CI contract that parses the session id from stdout stays intact; the new lines go only to stderr and only for interactive TTY sessions.Diagnosis checked against the code: the confirmation is gated on
global.no_input(a real, widely-used global arg) and stderr's TTY state, both reachable on the attach path. The change lives in the sharedresolve_smart_attachhelper whose two callers —cmd_defaultandcmd_attach— are exactly the reported reproduction paths.The scoped Distillery precedent pass (
project: minimal) surfaced no prior entry addressing session-attach identity feedback, so there is nothing load-bearing to cite.Verification
All commands run from the workspace root with
--locked(CI parity); each exited 0.cargo fmt --all --check --manifest-path target/Cargo.toml— clean, no drift.cargo clippy --workspace --locked --manifest-path target/Cargo.toml -- -D warnings—Finished, no warnings.cargo build --workspace --locked --manifest-path target/Cargo.toml—Finished, all four binaries built.cargo test --workspace --locked --manifest-path target/Cargo.toml— all green;minimalcrate unit tests125 passed; 0 failed, including the newsession_announce_label_prefers_name_with_short_id.Note
Announce which session
minandmin attachentered on stderr--attach, the CLI prints a one-line confirmation to stderr (e.g.Created session name (short-id)) before attaching.resolve_smart_attach, the CLI printsAttaching to session name (short-id)to stderr before connecting.--no-inputis set or stderr is not a terminal, using the newshould_announce_sessionhelper in lib.rs.Macroscope summarized 977e481.