fix(session): include available sessions in --resume error for invalid identifier#1
Open
Zahed-Riyaz wants to merge 40 commits intomainfrom
Open
fix(session): include available sessions in --resume error for invalid identifier#1Zahed-Riyaz wants to merge 40 commits intomainfrom
Zahed-Riyaz wants to merge 40 commits intomainfrom
Conversation
Co-authored-by: Sam Roberts <158088236+g-samroberts@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
….md (google-gemini#20679) Co-authored-by: Sam Roberts <158088236+g-samroberts@users.noreply.github.com>
…emini#20376) Co-authored-by: Jacob Richman <jacob314@gmail.com>
…ogle-gemini#21693) Co-authored-by: Jacob Richman <jacob314@gmail.com>
…mini#20689) Co-authored-by: Chris Williams <chrisjwilliams@google.com> Co-authored-by: Chris Williams <diodesign@gmail.com> Co-authored-by: Sam Roberts <158088236+g-samroberts@users.noreply.github.com>
17909d4 to
594e493
Compare
Replace .length/.slice() with grapheme-aware cpLen/cpSlice from textUtils to avoid splitting multi-byte characters (e.g. emojis) when truncating session display names in the --resume error message. Adds a test case with emoji-only display names to cover this path.
google-gemini#21496) Co-authored-by: Adam Weidman <adamfweidman@google.com>
…ow the subcommand pattern of other commands (google-gemini#21213)
…h on untrusted code. (google-gemini#21791)
…ni#17916) Co-authored-by: cynthialong0-0 <82900738+cynthialong0-0@users.noreply.github.com>
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.
Summary
When
--resumeis given an identifier that doesn't match any session (e.g.--resume 99when only 3 sessions exist, or a typo'd UUID), the CLI now prints a compact list of available sessions directly in the error output before exiting. Previously the user had to run a separate--list-sessionscommand to find valid identifiers.Details
Before:
After:
Implementation:
SessionError.invalidSessionIdentifier(identifier, sessions?)to accept an optionalSessionInfo[]. When provided, it formats a compact inline summary (index, display name truncated to 60 chars, relative time) and emits valid--resume Nhints.SessionSelector.findSession()already hassortedSessionsin scope when it throws — the only change needed there is passing it to the error factory.Run --list-sessions for the full list.note is appended.Related Issues
Related to google-gemini#21429 (follow-up: this PR addresses the UX gap left open after that fix).
How to Validate
geminithen exit).gemini --resume 99(or any out-of-range number). Verify the error output lists available sessions with indices and relative times, and ends with valid--resume Nhints — without needing a separate--list-sessionsinvocation.gemini --resume not-a-real-uuid. Confirm the same inline list appears.gemini --resume(no value) in a directory with sessions — should still resolve tolatestas before (no change to that path).gemini --resume latestin an empty project — should still start a fresh session with a warning (no change to that path).gemini --list-sessions— output and behavior unchanged.Pre-Merge Checklist
sessionUtils.test.tscovering unit-level formatting and integration viaSessionSelector.findSessionsessionsparameter is optional, all existing call sites unaffected