Add --resume flag for quick conversation resumption#84
Conversation
Co-Authored-By: Paws <noreply@pawscode.dev> Co-authored-by: manthanabc <48511543+manthanabc@users.noreply.github.com>
Co-Authored-By: Paws <noreply@pawscode.dev> Co-authored-by: manthanabc <48511543+manthanabc@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a top-level --resume flag to resume the most recently updated conversation, integrating it into the existing conversation ID resolution flow in UI::init_conversation().
Changes:
- Added
--resumeto the CLI with a clapconflicts_withconstraint against--conversation-id. - Updated
UI::init_conversation()to resolve conversation ID viaapi.last_conversation()when--resumeis set. - Added CLI parsing tests for
--resume, including the conflict with--conversation-id.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/paws_main/src/ui.rs | Adds --resume handling in conversation initialization via api.last_conversation(). |
| crates/paws_main/src/cli.rs | Introduces the --resume flag and adds CLI parsing/conflict tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/paws_main/src/cli.rs
Outdated
| /// conversation. Cannot be used with --conversation-id. | ||
| #[arg(long, conflicts_with = "conversation_id")] |
There was a problem hiding this comment.
--resume can currently be combined with --conversation (conversation JSON path). In UI::init_conversation() the resume branch runs before conversation, so providing both silently ignores --conversation, which is confusing/ambiguous. Consider adding a clap conflict with the conversation arg (and updating the help text + tests accordingly) so the user must choose one conversation source.
| /// conversation. Cannot be used with --conversation-id. | |
| #[arg(long, conflicts_with = "conversation_id")] | |
| /// conversation. Cannot be used with --conversation-id or --conversation. | |
| #[arg(long, conflicts_with = "conversation_id", conflicts_with = "conversation")] |
There was a problem hiding this comment.
Added conflicts_with = "conversation" constraint and updated the help text. Also added a test to verify the conflict is enforced. (fc0a94e)
crates/paws_main/src/ui.rs
Outdated
| } else if self.cli.resume { | ||
| // Resume the last conversation | ||
| let last_conversation = self | ||
| .api | ||
| .last_conversation() | ||
| .await? | ||
| .ok_or_else(|| anyhow::anyhow!("No conversation found to resume"))?; | ||
| last_conversation.id |
There was a problem hiding this comment.
This --resume branch duplicates existing “resume last conversation” logic already implemented elsewhere in ui.rs (e.g., the conversation resume subcommand path and handle_resume_conversation). Duplicating this logic in multiple places makes it easier for behavior/error handling to drift over time; consider extracting a small helper (e.g., last_conversation_id_or_err()) and reusing it here.
There was a problem hiding this comment.
Extracted last_conversation_id_or_err() helper method and reused it in all three places: init_conversation(), ConversationCommand::Resume, and handle_resume_conversation(). This eliminates the duplication and ensures consistent error handling. (fc0a94e)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 629f5f2271
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
crates/paws_main/src/ui.rs
Outdated
| } else if self.cli.resume { | ||
| // Resume the last conversation | ||
| let last_conversation = self | ||
| .api | ||
| .last_conversation() |
There was a problem hiding this comment.
Clear resume flag when starting a new conversation
The new self.cli.resume branch in init_conversation is now taken even after /new, because on_new() resets conversation and conversation_id but never resets resume before calling init_conversation. In a session launched with paws --resume, running /new will keep reopening the most recent conversation instead of creating a fresh one, so users cannot start a new session from a resumed run.
Useful? React with 👍 / 👎.
…act helper method - Add conflicts_with constraint between --resume and --conversation flags - Extract last_conversation_id_or_err() helper to avoid code duplication - Reuse helper in init_conversation(), ConversationCommand::Resume, and handle_resume_conversation() - Add test for --resume and --conversation conflict Co-Authored-By: Paws <noreply@pawscode.dev> Co-authored-by: manthanabc <48511543+manthanabc@users.noreply.github.com>
Implementation of --resume Flag - COMPLETED ✅
Summary
Successfully implemented a
--resumeflag that allows users to resume their last conversation with a simple command-line flag.Changes Made
Added
--resumeflag to top-level CLI struct incrates/paws_main/src/cli.rsconflicts_withconstraint to prevent usage with--conversation-idAND--conversationExtracted helper method
last_conversation_id_or_err()to eliminate code duplicationinit_conversation(),ConversationCommand::Resume, andhandle_resume_conversation()Updated
UI::init_conversation()incrates/paws_main/src/ui.rs--resumeflagAdded comprehensive tests
Testing
Usage
Code Quality Improvements
last_conversation_id_or_err()helperOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.