fix: auto-generate typable session names when --name is absent - #1125
Merged
norrietaylor merged 1 commit intoJul 31, 2026
Merged
Conversation
A session created without `--name` was sent to the daemon with a `None` name, so `min ls` showed `-` in the NAME column and every attach and destroy meant pasting a UUID. When `--name` is absent, `cmd_activate` now mints `<dir-basename>-<4 hex>` client-side and passes it as `SessionConfig.name`: the basename is lowercased and stripped to the accepted name alphabet, and a rare autogen collision retries with fresh hex a bounded number of times. A user-supplied `--name` is untouched, so its collision still surfaces the daemon's already-exists error rather than being silently suffixed. The `--no-prompt` stdout (the bare UUID) and `ls --raw` are unchanged.
norrietaylor
marked this pull request as ready for review
July 31, 2026 07:33
norrietaylor
enabled auto-merge (squash)
July 31, 2026 07:33
norrietaylor
approved these changes
Jul 31, 2026
norrietaylor
deleted the
inbox-patch/autogen-session-names-59f9315fe11383b6
branch
July 31, 2026 07:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABK4Q6ew
A session activated without
--namewas created with no name, somin lsrendered-in the NAME column and every attach/destroy meant pasting the session UUID.cmd_activatenow mints a typable<dir-basename>-<4 hex>name client-side and sends it asSessionConfig.name; the basename is lowercased and reduced to the accepted session-name alphabet, and a rare autogen collision retries with fresh hex a bounded number of times (informed by #265, which added the daemon-side name-uniqueness gate). A user-supplied--nameis passed through untouched, so its collision still surfaces the existing already-exists error instead of being silently suffixed. The--no-promptstdout (bare UUID) andmin ls --rawoutput are unchanged.Verification
cargo fmt --all --check --manifest-path target/Cargo.toml — clean
cargo clippy --workspace --locked --manifest-path target/Cargo.toml -- -D warnings — exit 0, no warnings
cargo build --workspace --locked --manifest-path target/Cargo.toml — exit 0
cargo test --workspace --locked --manifest-path target/Cargo.toml — exit 0 (minimal lib: 147 passed, incl. 4 new)
Note
Auto-generate typable session names in
cmd_activatewhen--nameis absent--nameis omitted,cmd_activatenow generates a session name in the format<sanitized-dir-basename>-<hex4>instead of leaving the name unset.sanitize_name_componenthelper lowercases and strips non-alphanumeric characters (keeping-,_,.) from the project directory basename, falling back to'session'for empty results.random_hex4helper derives 4 lowercase hex digits per call usingRandomState::hash_one, avoiding an external RNG dependency.'already exists'in the daemon error), the activation loop retries up to 8 times (AUTOGEN_NAME_RETRIES) with a fresh hex suffix; user-supplied names and non-collision errors are not retried.config.namerather thanargs.name, so autogenerated names are displayed correctly.Macroscope summarized 5f2406b.