feat(session): Support file operation rollback#3346
feat(session): Support file operation rollback#3346lhpqaq wants to merge 4 commits intoagentscope-ai:mainfrom
Conversation
# Conflicts: # src/qwenpaw/app/runner/control_commands/__init__.py # src/qwenpaw/app/runner/control_commands/redo_handler.py # src/qwenpaw/app/runner/control_commands/undo_handler.py # src/qwenpaw/app/runner/runner.py
|
Hi @lhpqaq, this is your 2nd Pull Request. 🙌 Join Developer CommunityThanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page: We truly appreciate your enthusiasm—and look forward to your future contributions! 😊 We'll review your PR soon. |
There was a problem hiding this comment.
Pull request overview
Adds workspace snapshotting + linear undo/redo so agent-driven file operations can be rolled back, and exposes the feature via new /undo and /redo control commands (with console command hints + i18n).
Changes:
- Introduce
SnapshotServiceto snapshot workspace state, record history, and perform undo/redo. - Record rollback history around each agent run in
AgentRunner.query_handler. - Add
/undo+/redohandlers and surface the commands in the Console UI + translations; add test coverage for snapshot/rollback behavior.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/qwenpaw/app/rollback/service.py |
New snapshot/history/undo/redo implementation backed by an internal git-dir. |
src/qwenpaw/app/rollback/__init__.py |
Exports rollback service types. |
src/qwenpaw/app/runner/runner.py |
Tracks workspace state before agent run and records history after. |
src/qwenpaw/app/runner/control_commands/undo_handler.py |
Adds /undo control command. |
src/qwenpaw/app/runner/control_commands/redo_handler.py |
Adds /redo control command. |
src/qwenpaw/app/runner/control_commands/__init__.py |
Registers and exports the new control commands. |
tests/test_rollback.py |
New tests covering snapshot init/track/patch/revert + linear undo/redo semantics. |
console/src/pages/Chat/index.tsx |
Adds /undo and /redo to command suggestions. |
console/src/locales/en.json |
Adds i18n strings for undo/redo descriptions. |
console/src/locales/zh.json |
Adds i18n strings for undo/redo descriptions. |
console/src/locales/ja.json |
Adds i18n strings for undo/redo descriptions. |
console/src/locales/ru.json |
Adds i18n strings for undo/redo descriptions. |
console/src/components/LanguageSwitcher/index.tsx |
Updates the RU icon mapping (currently to a USD icon). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


Description
Support file operation rollback (e.g. recovering accidentally deleted files). Task 6 in #2291.
Related Issue: Relates to #2590
Security Considerations: [If applicable, e.g. channel auth, env/config handling]
Type of Change
Component(s) Affected
Checklist
pre-commit run --all-fileslocally and it passespytestor as relevant) and they passTesting
Local Verification Evidence
Additional Notes
[Optional: any other context]