Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

improvement: preserve undo history after MCP tool execution#708

Merged
breaking-brake merged 1 commit intomainbreaking-brake/cc-wf-studio:mainfrom
improvement/preserve-undo-history-on-mcp-applybreaking-brake/cc-wf-studio:improvement/preserve-undo-history-on-mcp-applyCopy head branch name to clipboard
Apr 4, 2026
Merged

improvement: preserve undo history after MCP tool execution#708
breaking-brake merged 1 commit intomainbreaking-brake/cc-wf-studio:mainfrom
improvement/preserve-undo-history-on-mcp-applybreaking-brake/cc-wf-studio:improvement/preserve-undo-history-on-mcp-applyCopy head branch name to clipboard

Conversation

@breaking-brake
Copy link
Copy Markdown
Owner

@breaking-brake breaking-brake commented Apr 4, 2026

Summary

Preserve undo/redo history when update_nodes or apply_workflow MCP tools modify the canvas.

Closes #707

What Changed

setActiveWorkflow() always called temporal.clear() to prevent cross-workflow undo. This was correct when opening a different workflow file, but when called from MCP apply paths, it wiped the undo entry that setCanvas() just created.

Before

  • MCP tool modifies canvas → undo history immediately cleared → user cannot undo

After

  • MCP tool modifies canvas → undo history preserved → user can undo/redo
  • Opening a different workflow file still clears history as before

Changes

  • src/webview/src/stores/workflow-store.ts - Added options?: { clearHistory?: boolean } parameter to setActiveWorkflow (default: true for backward compatibility)
  • src/webview/src/App.tsx - Pass { clearHistory: false } in MCP apply (2 paths) and Slack import

Testing

  • Manual E2E testing completed
  • Build passes (npm run format && npm run lint && npm run build)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Undo/redo history is now preserved when workflows are applied, imported, or accepted from AI suggestions, allowing users to revert recent changes if needed.

- Added clearHistory option to setActiveWorkflow (default: true)
- Pass clearHistory: false in MCP apply and Slack import paths
- Workflow file open still clears history as before

Closes #707

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 4, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Modified setActiveWorkflow to accept an optional clearHistory parameter, enabling MCP-applied workflow changes to preserve undo/redo history. Three call sites in App.tsx now explicitly pass { clearHistory: false } when applying MCP changes, while retaining default history clearing for standard workflow switches.

Changes

Cohort / File(s) Summary
Workflow Store Interface & Implementation
src/webview/src/stores/workflow-store.ts
Updated setActiveWorkflow signature to accept optional options?: { clearHistory?: boolean } parameter. Implementation now conditionally clears temporal history based on options?.clearHistory !== false, preserving history when explicitly requested.
MCP Apply Integration
src/webview/src/App.tsx
Updated three setActiveWorkflow call sites (MCP acceptance, Slack import, and direct apply paths) to pass { clearHistory: false }, preventing unintended history loss when MCP tools modify the workflow canvas.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through history's hall,
Where undo threads once would fall,
With options passed, we now can choose—
Preserve the steps we dare not lose!
MCP updates dance without a care,
While history lingers in the air.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main improvement: preserving undo history when MCP tools execute workflow changes on the canvas.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #707 by adding an optional clearHistory parameter to setActiveWorkflow and passing clearHistory: false in MCP apply paths.
Out of Scope Changes check ✅ Passed All changes are directly scoped to resolving issue #707; no extraneous modifications to unrelated functionality are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improvement/preserve-undo-history-on-mcp-apply

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@breaking-brake breaking-brake merged commit eaf8f2a into main Apr 4, 2026
3 of 4 checks passed
@breaking-brake breaking-brake deleted the improvement/preserve-undo-history-on-mcp-apply branch April 4, 2026 06:03
@breaking-brake breaking-brake mentioned this pull request Apr 4, 2026
braking-brake-semantic-release Bot pushed a commit that referenced this pull request Apr 4, 2026
## [3.32.2](v3.32.1...v3.32.2) (2026-04-04)

### Improvements

* add parallel execution instructions for built-in sub-agents ([#709](#709)) ([c659e6d](c659e6d))
* preserve undo history after MCP tool execution ([#708](#708)) ([eaf8f2a](eaf8f2a)), closes [#707](#707)
@braking-brake-semantic-release
Copy link
Copy Markdown

🎉 This PR is included in version 3.32.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undo history cleared after update_nodes/apply_workflow MCP tool execution

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.