Skip to content

fix: auto-generate typable session names when --name is absent - #1125

Merged
norrietaylor merged 1 commit into
mainfrom
inbox-patch/autogen-session-names-59f9315fe11383b6
Jul 31, 2026
Merged

fix: auto-generate typable session names when --name is absent#1125
norrietaylor merged 1 commit into
mainfrom
inbox-patch/autogen-session-names-59f9315fe11383b6

Conversation

@gominimal-aw-bot

@gominimal-aw-bot gominimal-aw-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABK4Q6ew

A session activated without --name was created with no name, so min ls rendered - in the NAME column and every attach/destroy meant pasting the session UUID. cmd_activate now mints a typable <dir-basename>-<4 hex> name client-side and sends it as SessionConfig.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 --name is passed through untouched, so its collision still surfaces the existing already-exists error instead of being silently suffixed. The --no-prompt stdout (bare UUID) and min ls --raw output 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)

Generated by inbox-patch ·

Note

Auto-generate typable session names in cmd_activate when --name is absent

  • When --name is omitted, cmd_activate now generates a session name in the format <sanitized-dir-basename>-<hex4> instead of leaving the name unset.
  • A sanitize_name_component helper lowercases and strips non-alphanumeric characters (keeping -, _, .) from the project directory basename, falling back to 'session' for empty results.
  • A random_hex4 helper derives 4 lowercase hex digits per call using RandomState::hash_one, avoiding an external RNG dependency.
  • On name collision ('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.
  • The post-create session announcement now reads from config.name rather than args.name, so autogenerated names are displayed correctly.

Macroscope summarized 5f2406b.

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
norrietaylor marked this pull request as ready for review July 31, 2026 07:33
@norrietaylor
norrietaylor requested a review from a team as a code owner July 31, 2026 07:33
@norrietaylor
norrietaylor enabled auto-merge (squash) July 31, 2026 07:33
@norrietaylor
norrietaylor merged commit 75e2671 into main Jul 31, 2026
29 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/autogen-session-names-59f9315fe11383b6 branch July 31, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant