Skip to content

Add --resume flag for quick conversation resumption#84

Open
Copilot wants to merge 4 commits intomainfrom
copilot/add-resume-flag
Open

Add --resume flag for quick conversation resumption#84
Copilot wants to merge 4 commits intomainfrom
copilot/add-resume-flag

Conversation

Copy link

Copilot AI commented Feb 7, 2026

Implementation of --resume Flag - COMPLETED ✅

Summary

Successfully implemented a --resume flag that allows users to resume their last conversation with a simple command-line flag.

Changes Made

  • Added --resume flag to top-level CLI struct in crates/paws_main/src/cli.rs

    • Flag automatically resumes the most recently updated conversation
    • Added conflicts_with constraint to prevent usage with --conversation-id AND --conversation
  • Extracted helper method last_conversation_id_or_err() to eliminate code duplication

    • Reused in three places: init_conversation(), ConversationCommand::Resume, and handle_resume_conversation()
    • Ensures consistent error handling across all resume operations
  • Updated UI::init_conversation() in crates/paws_main/src/ui.rs

    • Added logic to handle the --resume flag
    • Uses helper method for clean, maintainable code
  • Added comprehensive tests

    • Test for basic --resume flag parsing
    • Test for --resume with other compatible flags
    • Test for conflict between --resume and --conversation-id
    • Test for conflict between --resume and --conversation
    • Test for default behavior without flag
    • All 72 CLI tests passing

Testing

  • ✅ All 72 CLI tests pass (added 1 new test)
  • ✅ All 156 unit tests in paws_main pass
  • ✅ Entire workspace compiles successfully
  • ✅ Help output displays flag correctly with both conflicts mentioned
  • ✅ Conflict detection works as expected

Usage

# Resume the last conversation
paws --resume

# Error: Cannot use with --conversation-id
paws --resume --conversation-id <id>

# Error: Cannot use with --conversation
paws --resume --conversation conversation.json

# Can be used with other compatible flags
paws --resume --verbose

Code Quality Improvements

  • Eliminated code duplication by extracting last_conversation_id_or_err() helper
  • Consistent error handling across all resume operations
  • Clear separation of concerns with reusable helper method
Original prompt

introduce a --resume flag which would resume the last conversation


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 7, 2026 08:09
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>
Copilot AI changed the title [WIP] Add --resume flag to resume last conversation Add --resume flag for quick conversation resumption Feb 7, 2026
Copilot AI requested a review from manthanabc February 7, 2026 08:13
@manthanabc manthanabc marked this pull request as ready for review February 7, 2026 14:18
Copilot AI review requested due to automatic review settings February 7, 2026 14:18
Copy link

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

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 --resume to the CLI with a clap conflicts_with constraint against --conversation-id.
  • Updated UI::init_conversation() to resolve conversation ID via api.last_conversation() when --resume is 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.

Comment on lines 46 to 47
/// conversation. Cannot be used with --conversation-id.
#[arg(long, conflicts_with = "conversation_id")]
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

--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.

Suggested change
/// 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")]

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Added conflicts_with = "conversation" constraint and updated the help text. Also added a test to verify the conflict is enforced. (fc0a94e)

Comment on lines 2297 to 2304
} 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
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

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)

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines 2297 to 2301
} else if self.cli.resume {
// Resume the last conversation
let last_conversation = self
.api
.last_conversation()

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Owner

Choose a reason for hiding this comment

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

@copilot address this

…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>
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.

2 participants