Skip to content

feat(automations): click-to-edit prompt arguments in instructions - #3323

Merged
viniciusventura29 merged 2 commits into
mainfrom
viniciusventura29/edit-automation-tool-modal
May 12, 2026
Merged

viniciusventura29 merged 2 commits into
mainfrom
viniciusventura29/edit-automation-tool-modal

Conversation

@viniciusventura29

@viniciusventura29 viniciusventura29 commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

What is this contribution about?

Lets users click a slash-prompt pill (e.g. /Predict And Apply) inside an Automation's Instructions field and reopen its arguments dialog prefilled with the previously submitted values. Today, fixing a typo in those values requires deleting the pill and re-inserting it because the user-supplied arguments are discarded after getPrompt is called — only the rendered MCP messages are persisted.

The mention node now also stores the input values alongside metadata, exposes a click handler that dispatches a mention:edit DOM event when the prompt has values, and SlashMention listens for it to reopen PromptArgsDialog in edit mode. On save, the existing node is updated in place via setNodeMarkup (no duplicate pill). If the prompt's argument schema drifted on the MCP since insertion, matching names prefill and new fields stay blank.

How to Test

  1. Open an automation and add an instruction prompt that takes arguments (e.g. /predict & apply); fill in a value and confirm the pill renders.
  2. Click the pill — the dialog should reopen prefilled with the value you submitted; change it, hit "Save", and confirm the pill stays in place.
  3. Reload the page and click the pill again — the new value should still be prefilled.
  4. Confirm prompts without arguments are not clickable, and read-only message history still renders normally.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Click a slash-prompt pill in Automation Instructions to edit its arguments with prefilled values and update it in place; no delete/reinsert, and MCP messages stay in sync.

  • New Features

    • Persist prompt argument values on the mention node (as data-values) and reopen via mention:edit.
    • Edit mode pre-fills values and shows "Save".
    • On save, update the node in place via setNodeMarkup and refresh from getPrompt (no duplicate pill).
    • Handle schema drift: prefill matching names; new fields blank; prompts without args stay non-clickable; read-only history unchanged.
  • Bug Fixes

    • Remap the mention’s position across editor transactions during the async dialog flow; if the mention disappears before submit, show a toast instead of silently no-oping.

Written for commit ede1bb5. Summary will update on new commits.

Persist the user-supplied prompt argument values on the mention node and
reopen the arguments dialog prefilled with them when the pill is clicked,
updating the rendered prompt in place on save instead of forcing a delete +
re-insert. If the prompt's argument schema has drifted, matching names
prefill and the rest stay blank.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions

github-actions Bot commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Release Options

Suggested: Minor (2.313.0) — based on feat: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.312.5-alpha.1
🎉 Patch 2.312.5
❤️ Minor 2.313.0
🚀 Major 3.0.0

Current version: 2.312.4

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

When the prompts query is cold, the click handler awaits a fetch before
opening the dialog; any keystrokes during that window shifted the captured
position so the eventual setNodeMarkup silently no-op'd. Track the position
through every editor transaction (via editor.on("transaction")) until the
dialog closes, resolve it at submit time, and toast an error if the
mention disappeared instead of failing silently.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@viniciusventura29
viniciusventura29 merged commit 481a16f into main May 12, 2026
16 checks passed
@viniciusventura29
viniciusventura29 deleted the viniciusventura29/edit-automation-tool-modal branch May 12, 2026 02:20
pedrofrxncx pushed a commit that referenced this pull request May 12, 2026
)

* feat(automations): click-to-edit prompt arguments in instructions

Persist the user-supplied prompt argument values on the mention node and
reopen the arguments dialog prefilled with them when the pill is clicked,
updating the rendered prompt in place on save instead of forcing a delete +
re-insert. If the prompt's argument schema has drifted, matching names
prefill and the rest stay blank.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix(automations): remap mention position across async dialog lifecycle

When the prompts query is cold, the click handler awaits a fetch before
opening the dialog; any keystrokes during that window shifted the captured
position so the eventual setNodeMarkup silently no-op'd. Track the position
through every editor transaction (via editor.on("transaction")) until the
dialog closes, resolve it at submit time, and toast an error if the
mention disappeared instead of failing silently.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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