Repository navigation
fix(minimal,sessions): resolve sessions by unique id prefix and refuse uuid-shaped names - #1986
Merged
Merged
Conversation
…e uuid-shaped names A name lookup that finds no record now falls back to matching the input as an id prefix when it is 4 to 32 hex digits (dashes allowed), so the short id the CLI prints resolves. One match resolves, several are an error naming the candidates, and an exact name always wins. validate_session_name refuses a name that parses as a session UUID, so a session can no longer be named with another session's id.
Contributor
|
Warning Review limit reached
This review includes 6 billable files and costs up to $1.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 20 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (6)
Comment |
Contributor
|
Approved: no findings at Nothing to do. Clobber: none: |
mitodrummer
approved these changes
Oct 5, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 5, 2026
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.
Problem
min ls, and announcements such asqa-h (01a0fe9d)), but no command accepts it:min session exec 01a0fe9d -- truefails withNo session found matching '01a0fe9d'.SessionLookup::parsesends anything that is not a full UUID as a name lookup, and the resolver has no fallback.min session destroy --force <uuid>destroys the other session, and the session carrying the UUID-shaped name answers to that id from then on.validate_session_namerefused empty, padded, control-character, reserved and non-DNS-label names, but accepted a UUID.Fix
validate_session_name(crates/sessions/src/store.rs) refuses a name that parses as a session UUID, in hyphenated or simple form:invalid session name: must not be a session id. The gate is shared bycreateand the renamesave, soactivate --nameandrenameare both covered.get_session_record(crates/minimal/src/cmd/mod.rs), whichresolve_sessionandresolve_session_version_gatedshare, falls back to an id-prefix match when a name lookup finds no record and the input is 4 to 32 hex digits (dashes allowed). It lists the sessions and compares the input against each id without dashes, ignoring case:'<p>' matches sessions a1b2c3d4…, a1b29e8f…; use more characters;No session found matching '<p>'error;min session policy(text and-o json) now sends its follow-up lookups by the resolved id, so a prefix reaches the same session as the record lookup. In JSON mode an ambiguous prefix reports as session-not-found rather than daemon-unreachable.sessionargument help anddocs/reference/cli-min.mdnow say "UUID, unique id prefix, or session name".Tests
New tests:
sessions:store::tests::create_and_rename_refuse_a_uuid_shaped_name.minimal:a_unique_id_prefix_resolves_to_its_session,an_ambiguous_id_prefix_names_the_candidates,a_non_hex_or_short_input_is_not_an_id_prefix,an_exact_name_wins_over_an_id_prefix.Commands run on macOS arm64:
just test(sessions + minvmd): 985 passed, 0 failed, 19 skippedjust clippy(sessions + minvmd,-D warnings): cleanCROSS_CONTAINER_OPTS="--env HOME=/tmp" cross test -p minimal --target aarch64-unknown-linux-musl --locked -- prefix exact_name duplicate_session: libtest result: ok. 14 passed; 0 failed, including the 4 new testsCROSS_CONTAINER_OPTS="--env HOME=/tmp" cross test -p minimal --target aarch64-unknown-linux-musl --locked --no-fail-fast: lib 345 passed, 6 failed; every integration target passed. All 6 failures also fail on main in this container: 3resolver::advisory_*(sudo: not found),legacy_network_spellings_parse_with_hint, and the timing-bounda_stopped_vm_does_not_hold_a_box_name_resolution/a_stopped_vm_does_not_hold_a_listingCROSS_CONTAINER_OPTS="--env HOME=/tmp" cross clippy -p minimal --target aarch64-unknown-linux-musl --locked --all-targets -- -D warnings: cleancargo fmt --check: cleanjust minimal-cli: builds;min session exec --helpshows the new argument helpjust lint-prose docs/reference/cli-min.md: no new alerts (same count as on main; the edited lines carry none)Refs gominimal/inbox#911