Skip to content

Victorwads/my work version - #732

Draft
victorwads wants to merge 7 commits into
open-pencil:masterfrom
victorwads:victorwads/my-work-version
Draft

victorwads wants to merge 7 commits into
open-pencil:masterfrom
victorwads:victorwads/my-work-version

Conversation

@victorwads

@victorwads victorwads commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

@victorwads
victorwads marked this pull request as draft September 18, 2026 21:56
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The changes add optional MCP canvas following with settings, localization, documentation, and tests. Page colors now derive from page background data and persist through imports, page switches, exports, and saves. FIG imports use scoped variable resolution and imported-state guards to preserve component overrides. Auto-layout preserves fixed text dimensions beside smaller HUG siblings.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to f026a

Lazy FIG imports may lose resolved component overrides, and optional canvas following can report successful MCP operations as failures. These issues should be fixed before merge.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Pr Description: Context ⚠️ Warning The PR body does not provide review context. GitHub metadata shows that it contains only links to PRs #728 and #725. It does not explain the combined change, why the change is needed, or how this PR w… Replace the two-link body with the repository PR template sections. Add one concise Summary that explains the combined MCP follow-agent and Figma import-fidelity changes and their purpose. Add one to three meaningful What changed details. A…
Description check ❓ Inconclusive No pull request description was provided, so the relationship between the changes and their intended outcome cannot be confirmed. Add a concise description of the main changes, affected behavior, and relevant tests.
Title check ❓ Inconclusive The title "Victorwads/my work version" is vague and does not identify the pull request's actual changes, which cover imported page backgrounds, component synchronization, variable-color resolution, la… Replace the title with a concise description of the main changes, such as "Fix imported page backgrounds, component overrides, and MCP agent tracking".
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Pr Readability: English ✅ Passed The PR title is “Victorwads/my work version”; its descriptive words are English, and “Victorwads” is a name. The PR body contains only links to related pull requests, not non-English prose. No explici…
Pr Description: Template ✅ Passed The PR body contains only two complete, valid links to PRs #728 and #725. It contains no unfilled template placeholder, template comment, TODO/TBD text, empty heading, or dangling issue reference such…
Full details: Pr Description: Context

Explanation

The PR body does not provide review context. GitHub metadata shows that it contains only links to PRs #728 and #725. It does not explain the combined change, why the change is needed, or how this PR was validated. CONTRIBUTING.md requires a Summary covering the problem, reason, and outcome; meaningful What changed details; and actual validation results, including relevant checks not run and changelog status. The linked PRs contain context for their individual work, but they do not document this combined PR or its integration changes.

Resolution

Replace the two-link body with the repository PR template sections. Add one concise Summary that explains the combined MCP follow-agent and Figma import-fidelity changes and their purpose. Add one to three meaningful What changed details. Add the commands that were actually run and their results, state relevant checks that were not run and why, record changelog status, and complete the AI assistance section.

Full details: Title check

Explanation

The title "Victorwads/my work version" is vague and does not identify the pull request's actual changes, which cover imported page backgrounds, component synchronization, variable-color resolution, layout behavior, and MCP agent tracking.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: open-pencil/open-pencil/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 359ba370-f91c-4f24-9922-ffc4e94f5233

📥 Commits

Reviewing files that changed from the base of the PR and between 1204b67 and f026a89.

⛔ Files ignored due to path filters (2)
  • tests/e2e/canvas/page-background.spec.ts-snapshots/imported-navy-page-openpencil-darwin.png is excluded by !**/*.png
  • tests/e2e/canvas/text/fixed-stretch-visual.spec.ts-snapshots/fixed-stretch-labels-openpencil-darwin.png is excluded by !**/*.png
📒 Files selected for processing (38)
  • CHANGELOG.md
  • packages/core/src/editor/component-sync.ts
  • packages/core/src/editor/page-viewports.ts
  • packages/core/src/editor/pages.ts
  • packages/core/src/figma-api/page-backgrounds.ts
  • packages/core/src/io/formats/fig/export.ts
  • packages/core/src/kiwi/fig/import.ts
  • packages/core/src/kiwi/fig/lazy-import.ts
  • packages/core/src/kiwi/fig/parse/transfer.ts
  • packages/core/src/kiwi/fig/population/delta.ts
  • packages/core/src/kiwi/fig/variable-color-resolver.ts
  • packages/core/src/layout.ts
  • packages/core/src/layout/yoga-helpers.ts
  • packages/docs/programmable/mcp-server.md
  • packages/fig/src/instance-overrides/populate.ts
  • packages/fig/tests/scoped-instance-overrides.test.ts
  • packages/scene-graph/src/index.ts
  • packages/vue/src/i18n/locales/de/automation.json
  • packages/vue/src/i18n/locales/es/automation.json
  • packages/vue/src/i18n/locales/fr/automation.json
  • packages/vue/src/i18n/locales/it/automation.json
  • packages/vue/src/i18n/locales/ja/automation.json
  • packages/vue/src/i18n/locales/pl/automation.json
  • packages/vue/src/i18n/locales/ru/automation.json
  • packages/vue/src/i18n/locales/zh-cn/automation.json
  • packages/vue/src/i18n/messages/automation.ts
  • src/app/automation/bridge/tool-handlers.ts
  • src/app/automation/mcp/follow-agent.ts
  • src/app/automation/mcp/preferences.ts
  • src/components/settings/mcp/MCPSettingsPanel.vue
  • tests/e2e/canvas/page-background.spec.ts
  • tests/e2e/canvas/text/fixed-stretch-visual.spec.ts
  • tests/engine/app/automation/follow-agent.test.ts
  • tests/engine/editor/page-backgrounds.test.ts
  • tests/engine/io/fig/import/population-delta.test.ts
  • tests/engine/layout/auto-layout/text/fixed-stretch.test.ts
  • tests/helpers/canvas/page-background.ts
  • tools/i18n/mixed-script-baseline.txt

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.

rootIds
)
withFigVariableColorResolver(context.changeMap, () => {
graph.preserveSourceMetadataDuring(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🤖 get_repo_knowledge executed:

get_repo_knowledge open-pencil/open-pencil /tmp/coderabbit-repo-knowledge/open-pencil-open-pencil-36f3d216/learnings /tmp/coderabbit-repo-knowledge/open-pencil-open-pencil-36f3d216/conventions

Length of output: 6578


🏁 Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- lazy-import outline ---'
ast-grep outline packages/core/src/kiwi/fig/lazy-import.ts
printf '%s\n' '--- lazy-import source ---'
cat -n packages/core/src/kiwi/fig/lazy-import.ts
printf '%s\n' '--- bound symbols ---'
rg -n -S 'preserveSourceMetadataDuring|applyImportedStateDuring|populateAndApplyOverrides|scheduleComponentSync|isApplyingImportedState' packages/core/src

Repository: open-pencil/open-pencil

Length of output: 6523


🏁 Script executed:

printf '%s\n' '--- lazy-import source ---'
cat -n packages/core/src/kiwi/fig/lazy-import.ts
printf '%s\n' '--- relevant definitions and call sites ---'
rg -n -S 'preserveSourceMetadataDuring|applyImportedStateDuring|populateAndApplyOverrides|scheduleComponentSync|isApplyingImportedState' packages/core/src

Repository: open-pencil/open-pencil

Length of output: 5777


🏁 Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- relevant outlines ---'
ast-grep outline packages/core/src/kiwi/fig/instance-overrides.ts
ast-grep outline packages/core/src/editor/graph-events.ts
ast-grep outline packages/core/src/editor/component-sync.ts
printf '%s\n' '--- instance override definitions ---'
rg -n -A100 -B20 -S 'function populateAndApplyOverrides|export function populateAndApplyOverrides|populateAndApplyOverrides' packages/core/src/kiwi packages/core/src
printf '%s\n' '--- graph events ---'
cat -n packages/core/src/editor/graph-events.ts
printf '%s\n' '--- component sync ---'
cat -n packages/core/src/editor/component-sync.ts
printf '%s\n' '--- scope implementations and flags ---'
rg -n -A35 -B15 -S 'preserveSourceMetadataDuring|applyImportedStateDuring|isApplyingImportedState' packages packages/core/src

Repository: open-pencil/open-pencil

Length of output: 50380


🏁 Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- locate bound definitions ---'
rg -l -S 'function populateAndApplyOverrides|export function populateAndApplyOverrides|preserveSourceMetadataDuring|applyImportedStateDuring|isApplyingImportedState' packages/fig packages/scene-graph packages/core/src | sort
printf '%s\n' '--- populateAndApplyOverrides implementation ---'
rg -n -A180 -B20 -S 'function populateAndApplyOverrides|export function populateAndApplyOverrides' packages/fig
printf '%s\n' '--- scope definitions ---'
rg -n -A45 -B20 -S 'preserveSourceMetadataDuring|applyImportedStateDuring|isApplyingImportedState' packages/scene-graph packages/fig

Repository: open-pencil/open-pencil

Length of output: 34973


🏁 Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- SceneGraph event emission and sync ---'
rg -n -A80 -B20 -S 'applyNodeChanges|syncInstances|populateInstanceChildren' packages/scene-graph/src/index.ts packages/scene-graph/src
printf '%s\n' '--- sync implementation references ---'
rg -n -A60 -B20 -S 'syncInstances\(' packages/scene-graph packages/fig

Repository: open-pencil/open-pencil

Length of output: 47966


Use the imported-state scope for lazy population.

populateAndApplyOverrides updates nodes and emits events that reach scheduleComponentSync. preserveSourceMetadataDuring does not set isApplyingImportedState, so the scheduler can queue a microtask. flushComponentSync can then reset resolved lazy overrides through syncInstances. Replace this wrapper with applyImportedStateDuring and add a lazy-population regression test.

Comment on lines 80 to 86
store.requestRender()
store.flashNodes(extractNodeIds(result))
}
if (mcpFollowAgent.value) await followAgentActivity(target, toolName, toolArgs, result)
return { ok: true, result }
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '55,100p' src/app/automation/bridge/tool-handlers.ts
sed -n '1,90p' src/app/automation/mcp/follow-agent.ts
rg -n 'handleTool|tool-handlers|followAgentActivity|switchPage\(|zoomToFit\(' src/app/automation src/app/tabs packages/core/src/editor | head -120

Repository: open-pencil/open-pencil

Length of output: 5728


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- tool handler ---'
sed -n '1,115p' src/app/automation/bridge/tool-handlers.ts
printf '%s\n' '--- bridge handlers ---'
sed -n '1,100p' src/app/automation/bridge/handlers.ts
printf '%s\n' '--- webmcp runtime ---'
sed -n '1,100p' src/app/automation/webmcp/runtime.ts
printf '%s\n' '--- follow-agent preference references ---'
rg -n -C 3 'mcpFollowAgent|follow agent|followAgent|follow-agent' src packages --glob '*.{ts,tsx}' | head -240
printf '%s\n' '--- switchPage implementation ---'
sed -n '160,215p' packages/core/src/editor/pages.ts
printf '%s\n' '--- viewport methods ---'
sed -n '1,115p' packages/core/src/editor/viewport.ts

Repository: open-pencil/open-pencil

Length of output: 18289


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- tool handler ---'
sed -n '1,115p' src/app/automation/bridge/tool-handlers.ts
printf '%s\n' '--- bridge handlers ---'
sed -n '1,100p' src/app/automation/bridge/handlers.ts
printf '%s\n' '--- webmcp runtime ---'
sed -n '1,100p' src/app/automation/webmcp/runtime.ts
printf '%s\n' '--- follow-agent preference references ---'
rg -n -C 3 'mcpFollowAgent|followAgentActivity|follow-agent' src packages --glob '*.{ts,tsx}' | head -240
printf '%s\n' '--- switchPage implementation ---'
sed -n '160,215p' packages/core/src/editor/pages.ts
printf '%s\n' '--- viewport methods ---'
sed -n '1,115p' packages/core/src/editor/viewport.ts

Repository: open-pencil/open-pencil

Length of output: 17438


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- command-handler callers ---'
rg -n -C 5 'createAutomationCommandHandlers|handleRequest\(' src --glob '*.{ts,tsx}' | head -260
printf '%s\n' '--- MCP transport error boundaries ---'
rg -n -C 5 'createAutomationCommandHandlers|handleRequest|JSON-RPC|jsonrpc|MCP|mcp' src/app --glob '*.{ts,tsx}' | head -360
printf '%s\n' '--- follow-agent dependencies ---'
sed -n '1,90p' src/app/automation/mcp/follow-agent.ts
rg -n -C 4 'async function preparePage|function preparePage|resolvePageFonts|switchTab|function switchTab' packages/core/src src/app/tabs --glob '*.{ts,tsx}' | head -280
printf '%s\n' '--- relevant tests ---'
rg -n -C 4 'followAgentActivity|mcpFollowAgent|follow agent|createAutomationToolHandler|handleRequest' src packages --glob '*.{test,spec}.{ts,tsx}' | head -300

Repository: open-pencil/open-pencil

Length of output: 37829


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- websocket error response ---'
sed -n '45,78p' src/app/automation/bridge/server.ts
printf '%s\n' '--- page preparation ---'
sed -n '1,175p' packages/core/src/editor/pages.ts
printf '%s\n' '--- MCP settings UI contract ---'
rg -n -C 6 'followAgentDescription|mcpFollowAgent|Follow agent' src packages --glob '*.{ts,tsx,vue}' | head -220
printf '%s\n' '--- non-render tool definitions ---'
rg -n -C 5 \"name: 'switch_page'|name: 'zoom|name: 'get_|mutates: false|mutates: true\" packages/core/src src --glob '*.{ts,tsx}' | head -320

Repository: open-pencil/open-pencil

Length of output: 14984


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- websocket error response ---'
sed -n '45,78p' src/app/automation/bridge/server.ts
printf '%s\n' '--- page preparation ---'
sed -n '1,175p' packages/core/src/editor/pages.ts
printf '%s\n' '--- MCP settings UI contract ---'
rg -n -C 6 'followAgentDescription|mcpFollowAgent|Follow agent' src packages --glob '*.{ts,tsx,vue}' | head -220
printf '%s\n' '--- non-render tool definitions ---'
rg -n -C 5 "name: 'switch_page'|name: 'zoom|name: 'get_|mutates: false|mutates: true" packages/core/src src --glob '*.{ts,tsx}' | head -320

Repository: open-pencil/open-pencil

Length of output: 22921


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- automation target resolution ---'
sed -n '1,180p' src/app/automation/bridge/target.ts
printf '%s\n' '--- page tool implementation ---'
sed -n '1,70p' packages/core/src/tools/read/pages.ts
printf '%s\n' '--- tool definition mutation semantics ---'
rg -n -C 5 'mutates|execution.*mutation|type ToolDef|defineTool' packages/core/src/tools --glob '*.ts' | head -260

Repository: open-pencil/open-pencil

Length of output: 24711


Keep follow-agent failures separate from tool results.

A non-render tool can return a result successfully, but createAutomationToolHandler awaits followAgentActivity before returning { ok: true, result }. When page_id targets a different page, followAgentActivity awaits store.switchPage(), whose page preparation awaits population and font-loading operations that can reject. The rejection reaches src/app/automation/bridge/server.ts, which converts it into an { ok: false, error } response. This changes a successful MCP operation into an error when the optional “Follow agent” UI behavior fails.

Catch errors at this post-execution call and return the tool result regardless of follow-agent failure.

Suggested correction
-    if (mcpFollowAgent.value) await followAgentActivity(target, toolName, toolArgs, result)
+    if (mcpFollowAgent.value) {
+      try {
+        await followAgentActivity(target, toolName, toolArgs, result)
+      } catch (error) {
+        console.warn('[MCP] Failed to follow agent activity:', error)
+      }
+    }
     return { ok: true, result }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
store.requestRender()
store.flashNodes(extractNodeIds(result))
}
if (mcpFollowAgent.value) await followAgentActivity(target, toolName, toolArgs, result)
return { ok: true, result }
}
}
store.requestRender()
store.flashNodes(extractNodeIds(result))
}
if (mcpFollowAgent.value) {
try {
await followAgentActivity(target, toolName, toolArgs, result)
} catch (error) {
console.warn('[MCP] Failed to follow agent activity:', error)
}
}
return { ok: true, result }
}
}

This branch has not been deployed

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

1 participant