Skip to content

feat: --resume And --save Command-line Arguments#201

Closed
shuxueshuxue wants to merge 16 commits intoQwenLM:mainfrom
shuxueshuxue:main
Closed

feat: --resume And --save Command-line Arguments#201
shuxueshuxue wants to merge 16 commits intoQwenLM:mainfrom
shuxueshuxue:main

Conversation

@shuxueshuxue
Copy link
Copy Markdown

@shuxueshuxue shuxueshuxue commented Aug 5, 2025

TLDR

This PR adds --resume and --save command-line arguments to enable checkpoint-based conversation persistence in non-interactive mode. Users can now save their conversation history to named checkpoints and resume from them later.
This is crucial for developing sdk similar to Claude Code.

Dive Deeper

This implementation adds two new features to the CLI:

  1. --resume - Loads a previous conversation from a checkpoint file
    - Accepts either a checkpoint tag (e.g., "session1") or a full file path
    - Restores the full conversation context so the model can continue where it left off
  2. --save - Saves the current conversation to a checkpoint file
    - Saves the complete conversation history in the logger checkpoint format
    - Can be used together with --resume to continue and save sessions
    - Checkpoint files are stored in ~/.qwen/tmp//checkpoint-.json

The implementation follows the existing patterns in the codebase:

  • Added new fields to CliArgs interface and ConfigParameters
  • Integrated with yargs for command-line parsing
  • Added getter/setter methods in the Config class
  • Implemented load/save logic in nonInteractiveCli.ts

Reviewer Test Plan

To test this feature:

  1. Basic save and resume:
# Save a conversation
  qwen -p "My favorite color is blue" --save "test1"

  # Resume and continue
  qwen -p "What's my favorite color?" --resume "test1"
  # Should respond with "blue"
  1. Chaining conversations:
  # Start a conversation
  qwen -p "Remember that I like pizza" --save "food"

  # Continue and save to new checkpoint
  qwen -p "I also enjoy sushi" --resume "food" --save "food2"

  # Load the extended conversation
  qwen -p "What foods do I like?" --resume "food2"
  # Should mention both pizza and sushi
  1. Error handling:
  # Try to resume non-existent checkpoint
  qwen -p "Hello" --resume "nonexistent"
  # Should show clean error message
  1. Full path support:
  # Save with custom path
  qwen -p "Test message" --save "/tmp/my-checkpoint.json"

  # Resume from full path
  qwen -p "Repeat my message" --resume "/tmp/my-checkpoint.json"

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

@shuxueshuxue shuxueshuxue changed the title --resume And --save Command-line Arguments feat: --resume And --save Command-line Arguments Aug 5, 2025
@shuxueshuxue shuxueshuxue force-pushed the main branch 2 times, most recently from c837bfb to 6de556e Compare August 6, 2025 11:50
halfaipg pushed a commit to AIPowerGrid/grid-code that referenced this pull request Aug 16, 2025
…at should now work in all scenarios (QwenLM#201)

* env flags SANDBOX_{MOUNTS,ENV}, improved debugging through sandbox that should now work in all scenarios

* Merge remote-tracking branch 'origin/main' into sandbox_flags_improved_debugging
@bl-ue
Copy link
Copy Markdown
Contributor

bl-ue commented Aug 18, 2025

Hi! FYI—a series of PRs are being merged which add automatic save/resume support to Gemini CLI, as well as a --resume command line argument, and a bunch more. See google-gemini/gemini-cli#4401 for an analysis of the implementation and links to the PRs. (I'm noting this down in case it will make merging this #201 PR difficult.)

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