-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add resume functionality for CLI sessions across backends #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 adds resume functionality for CLI sessions across backends, allowing users to continue previously started AI CLI sessions. The feature is implemented with backend-specific support and provides a unified interface through the codex resume command.
- Adds a new
ai-code-cli-resumecommand with backend-specific resume implementations - Updates the AI Code Commands menu to include a "Resume AI CLI" option
- Implements resume support for codex backend with proper session restoration
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ai-code-interface.el | Adds "Resume AI CLI" menu item to the AI Code Commands interface |
| ai-code-codex-cli.el | Implements codex-cli-resume function for the codex backend with session restoration |
| ai-code-backends.el | Adds resume functionality infrastructure with backend configuration and fallback handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
ai-code-codex-cli.el
Outdated
| (claude-code-program-switches nil)) | ||
| (claude-code--start arg '("resume") nil t) | ||
| (claude-code--term-send-string claude-code-terminal-backend "") | ||
| (goto-char (point-min)))) |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goto-char (point-min) call will move to the beginning of the current buffer, but after calling claude-code--start with force-switch-to-buffer set to t, the current buffer may not be the terminal buffer. This could result in moving the cursor in an unrelated buffer instead of the CLI session buffer.
| (goto-char (point-min)))) | |
| (with-current-buffer claude-code-terminal-backend | |
| (goto-char (point-min)))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ileixe let me know if this AI suggested buffer specification make sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense. Changed
ai-code-backends.el
Outdated
| (let ((resume resume)) | ||
| (fset 'ai-code-cli-resume | ||
| (lambda (&optional arg) | ||
| (interactive "P") | ||
| (let ((current-prefix-arg arg)) | ||
| (call-interactively resume))))) |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable shadowing (let ((resume resume))) is unnecessary and confusing. The outer resume variable is already lexically scoped and can be used directly in the lambda closure without this redundant binding.
| (let ((resume resume)) | |
| (fset 'ai-code-cli-resume | |
| (lambda (&optional arg) | |
| (interactive "P") | |
| (let ((current-prefix-arg arg)) | |
| (call-interactively resume))))) | |
| (fset 'ai-code-cli-resume | |
| (lambda (&optional arg) | |
| (interactive "P") | |
| (let ((current-prefix-arg arg)) | |
| (call-interactively resume)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ileixe should we remove this let binding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
|
Thanks @ileixe for the contribution! It is useful feature. Would you mind help take a look at the review feedback and see if it make sense? |
Thanks for review. Updated. |
Hi, I want to use
codex resumeso added the feature. Please take a look.