Skip to content

feat(session): Support file operation rollback#3346

Open
lhpqaq wants to merge 4 commits intoagentscope-ai:mainfrom
lhpqaq:undo
Open

feat(session): Support file operation rollback#3346
lhpqaq wants to merge 4 commits intoagentscope-ai:mainfrom
lhpqaq:undo

Conversation

@lhpqaq
Copy link
Copy Markdown
Contributor

@lhpqaq lhpqaq commented Apr 13, 2026

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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

Testing

image image

Local Verification Evidence

pre-commit run --all-files
# paste summary result

pytest
# paste summary result

Additional Notes

[Optional: any other context]

lhpqaq added 3 commits April 7, 2026 18:09
# 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
Copilot AI review requested due to automatic review settings April 13, 2026 14:17
@github-project-automation github-project-automation bot moved this to Todo in QwenPaw Apr 13, 2026
@lhpqaq lhpqaq requested a deployment to maintainer-approved April 13, 2026 14:17 — with GitHub Actions Waiting
@github-actions
Copy link
Copy Markdown

Welcome to QwenPaw! 🐾

Hi @lhpqaq, this is your 2nd Pull Request.

🙌 Join Developer Community

Thanks 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:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.


Tip

⭐ If you find QwenPaw useful, please give us a Star!

Star QwenPaw

Staying ahead

Star QwenPaw on GitHub and be instantly notified of new releases.

Your star helps more developers discover this project! 🐾

Copy link
Copy Markdown
Contributor

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 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 SnapshotService to snapshot workspace state, record history, and perform undo/redo.
  • Record rollback history around each agent run in AgentRunner.query_handler.
  • Add /undo + /redo handlers 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.

Comment thread src/qwenpaw/app/rollback/service.py Outdated
Comment thread src/qwenpaw/app/rollback/service.py Outdated
Comment thread src/qwenpaw/app/rollback/service.py
Comment thread console/src/components/LanguageSwitcher/index.tsx
Comment thread src/qwenpaw/app/runner/runner.py Outdated
@lhpqaq lhpqaq temporarily deployed to maintainer-approved April 13, 2026 14:45 — with GitHub Actions Inactive
@xieyxclack xieyxclack added Under Review OpenTask Refer to https://github.com/agentscope-ai/CoPaw/issues/2291 labels Apr 14, 2026
@xieyxclack xieyxclack requested a review from rayrayraykk April 15, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OpenTask Refer to https://github.com/agentscope-ai/CoPaw/issues/2291 Under Review

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants