Skip to content

Support resuming AI sessions from a selected UUID#332

Merged
tninja merged 7 commits into
mainfrom
copilot/enhance-resume-session-support
May 9, 2026
Merged

Support resuming AI sessions from a selected UUID#332
tninja merged 7 commits into
mainfrom
copilot/enhance-resume-session-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Resume now recognizes a selected UUID in the current buffer and seeds the resume args prompt with it, matching the existing C-u R flow without requiring a prefix arg. This makes it faster to reopen a known prior session directly from copied/session-linked IDs.

  • Resume arg resolution

    • Taught the shared backend start-command resolver to detect an active region containing a UUID in 8-4-4-4-12 form.
    • Limited the behavior to resume commands only (resume / --resume).
    • When a UUID is selected, resume prompts for args and appends the session id after the existing resume switches.
  • Behavioral guardrails

    • Non-UUID selections continue to behave exactly as before.
    • Existing explicit-prefix resume behavior remains unchanged.
  • Targeted ERT coverage

    • Added tests for:
      • --resume flows prefilled with the selected UUID
      • resume subcommand flows prefilled with the selected UUID
      • non-UUID selections being ignored

Example:

;; Buffer selection:
123e4567-e89b-12d3-a456-426614174000

;; Invoke resume without C-u:
M-x ai-code-cli-resume

;; Prompt is prefilled like:
--resume 123e4567-e89b-12d3-a456-426614174000

Copilot AI changed the title [WIP] Enhance resume session to support session-id level selection Support resuming AI sessions from a selected UUID May 8, 2026
Copilot finished work on behalf of tninja May 8, 2026 22:04
Copilot AI requested a review from tninja May 8, 2026 22:04
@tninja tninja marked this pull request as ready for review May 8, 2026 23:07
@tninja tninja requested a review from Copilot May 8, 2026 23:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the CLI resume UX across backends by detecting a selected UUID in the active region and using it to prefill the resume-args prompt (without requiring a prefix argument), aligning the flow with the existing interactive C-u resume behavior.

Changes:

  • Added UUID-shaped region detection (8-4-4-4-12) and used it to trigger/seed prompting for resume commands only (resume / --resume).
  • Updated shared start-command resolution so selected UUIDs are appended to the default args and included in the resolved command/args plist.
  • Added targeted ERT coverage for --resume, resume subcommand, and non-UUID selections.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ai-code-backends-infra.el Adds UUID detection from the active region and extends command resolution to prefill resume args when a UUID is selected.
test/test_ai-code-backends-infra.el Adds ERT tests validating UUID-prefill behavior for both --resume and resume flows, and ensuring non-UUID selections are ignored.

@tninja
Copy link
Copy Markdown
Owner

tninja commented May 9, 2026

@copilot we can trim the leading and trimming space from the selected region, and then do UUID detection.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 9, 2026

@copilot we can trim the leading and trimming space from the selected region, and then do UUID detection.

Already covered in 7b19659: ai-code-backends-infra--selected-session-id trims the selected region with string-trim before running UUID detection, so leading and trailing whitespace are ignored.

Copilot finished work on behalf of tninja May 9, 2026 03:08
@tninja tninja merged commit cc41e33 into main May 9, 2026
5 checks passed
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.

Enhance: Resume session should support session-id level selection

3 participants