Skip to content

feat: enable interactive form - #2272

Merged
qdaxb merged 10 commits into
wecode-ai:mainfrom
earthAlone2026:feature/enable-interactive-form
Jul 28, 2026
Merged

feat: enable interactive form#2272
qdaxb merged 10 commits into
wecode-ai:mainfrom
earthAlone2026:feature/enable-interactive-form

Conversation

@earthAlone2026

@earthAlone2026 earthAlone2026 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Enable interactive MCP form elicitations in Wework conversations while preserving the existing no-approval behavior for normal MCP tool calls.

This change allows plugins to show user-facing form cards through MCP elicitation/create with mode: "form", maps supported JSON schema fields into Wework request_user_input UI, and returns the submitted values back to the plugin as MCP elicitation results.

Changes

  • Enable Codex runtime MCP elicitations through granular approval policy, with only mcp_elicitations turned on.
  • Disable wrapping normal MCP tool-call approval prompts as MCP elicitation forms via features.tool_call_mcp_elicitation=false.
  • Preserve existing MCP tool-call behavior by defaulting Wework-injected and Wework-managed MCP servers to default_tools_approval_mode="approve".
  • Preserve explicit MCP approval settings such as default_tools_approval_mode="prompt" from request-level and bot-level MCP server config.
  • Refresh the built-in wegent_apps MCP server config during connector configure/app sync so existing local configs receive the approval-mode update.
  • Improve the in-chat visual styling of RequestUserInputCard.
  • Add Chinese and English developer docs for Wework plugin interactive forms, including supported schema shapes, fallback behavior, and approval-boundary guidance.

Summary by CodeRabbit

  • New Features
    • Enabled interactive MCP forms during active tool runs, including single-choice, boolean confirmation, text input, and custom option flows.
  • Documentation
    • Added English/Chinese developer guides covering form triggering, schema-to-UI mapping, and troubleshooting.
  • Bug Fixes
    • Improved MCP configuration sync reliability and tightened form cancellation/decline behavior expectations.
    • Refined Codex runtime approval behavior to support form elicitation safely.
  • Tests
    • Expanded coverage for form request shaping, capability advertising, and approval/policy/config override correctness.
  • Style
    • Updated the interactive form card and option/button styling.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds MCP interactive-form documentation, Codex elicitation and approval configuration, MCP approval-mode propagation, task turn-resolution handling, form-card styling, and desktop automation and E2E validation changes.

Changes

MCP interactive forms and runtime configuration

Layer / File(s) Summary
Interactive forms contract
docs/en/wework/developer-guide/..., docs/zh/wework/developer-guide/...
Documents MCP form requests, forwarding, schema mapping, result actions, constraints, examples, troubleshooting, and implementation checks.
Codex runtime elicitation policy
executor/src/agents/codex.rs, executor/src/agents/mod.rs, executor/src/agents/codex/tests.rs
Disables tool-call MCP elicitation by default and applies granular approval policies that enable MCP elicitations.
MCP approval-mode propagation
executor/src/agents/runtime_capabilities.rs, executor/src/runtime_work/connectors.rs, executor/tests/codex_app_server_contract.rs
Preserves and emits default_tools_approval_mode, enables MCP configuration during synchronization, restores prior state after failures, and expands contract coverage.
Task fork and turn resolution
executor/src/runtime_work/handler/tasks.rs, executor/src/runtime_work/handler/tests.rs
Adds fork-rejection mapping logs, shared approval-policy use for resume requests, and synthetic transcript turn-id resolution.
Interactive form card presentation
wework/src/components/chat/RequestUserInputCard.*
Updates form-card, button, option, badge, header, and custom-input styling with matching test expectations.
Desktop automation and E2E validation
wework/src/e2e/automation.ts, wework/e2e/desktop/..., wework/src-tauri/tauri.conf.json
Adds processing-summary and text-targeted automation, standalone view-image coverage, and stronger fork, provider, scroll, lifecycle, and processing assertions.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MCPServer
  participant CodexAppServer
  participant Executor
  participant Wework
  participant Plugin
  MCPServer->>CodexAppServer: Send elicitation/create with mode form
  CodexAppServer->>Executor: Emit MCP elicitation request
  Executor->>Wework: Forward mcpServer/elicitation/request
  Wework->>Plugin: Return accept, cancel, or decline
Loading

Possibly related PRs

Suggested reviewers: qdaxb

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.95% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: enabling interactive forms.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wework/src/components/chat/RequestUserInputCard.tsx (1)

143-158: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Ensure action buttons meet the 44px mobile touch target.

Both buttons use h-8 (32px), so their height is below the required 44px mobile minimum. Use a responsive height such as h-11 md:h-8 so mobile controls remain touch-friendly without changing desktop density.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/chat/RequestUserInputCard.tsx` around lines 143 - 158,
Update both action buttons in RequestUserInputCard, including the ignore button
and the button identified by request-user-input-submit-button, to use a mobile
height of at least 44px with the existing 32px height retained at the md
breakpoint. Preserve all other styling and behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/en/wework/developer-guide/wework-plugin-interactive-forms.md`:
- Around line 85-91: Remove the unapproved compatibility fallback directive from
the English interactive-forms guidance at
docs/en/wework/developer-guide/wework-plugin-interactive-forms.md:85-91, unless
an approved product decision is documented there; retain only the supported
elicitation and capability-check guidance. Apply the same policy-aligned change
to docs/zh/wework/developer-guide/wework-plugin-interactive-forms.md:85-91 so
the translation matches the English guidance.

In `@executor/src/runtime_work/connectors.rs`:
- Around line 93-104: Update the rollback handling in the write_mcp_config error
path to inspect failures from persist_connector_gateway_config and
clear_connector_gateway_config instead of discarding them. Only restore cloud to
previous_config or None after the corresponding disk rollback succeeds; when
rollback fails, preserve the in-memory state matching the persisted
configuration and return an error that surfaces the rollback failure.

---

Outside diff comments:
In `@wework/src/components/chat/RequestUserInputCard.tsx`:
- Around line 143-158: Update both action buttons in RequestUserInputCard,
including the ignore button and the button identified by
request-user-input-submit-button, to use a mobile height of at least 44px with
the existing 32px height retained at the md breakpoint. Preserve all other
styling and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e3afead0-fdf1-4097-8972-befdb39cb00b

📥 Commits

Reviewing files that changed from the base of the PR and between 0c6be45 and 0ff9f7e.

📒 Files selected for processing (12)
  • docs/en/wework/developer-guide/wework-plugin-interactive-forms.md
  • docs/zh/wework/developer-guide/wework-plugin-interactive-forms.md
  • executor/src/agents/codex.rs
  • executor/src/agents/codex/tests.rs
  • executor/src/agents/mod.rs
  • executor/src/agents/runtime_capabilities.rs
  • executor/src/runtime_work/connectors.rs
  • executor/src/runtime_work/handler.rs
  • executor/src/runtime_work/handler/tasks.rs
  • executor/tests/codex_app_server_contract.rs
  • wework/src/components/chat/RequestUserInputCard.test.tsx
  • wework/src/components/chat/RequestUserInputCard.tsx

Comment thread docs/en/wework/developer-guide/wework-plugin-interactive-forms.md Outdated
Comment thread executor/src/runtime_work/connectors.rs

@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: 1

🧹 Nitpick comments (1)
wework/e2e/desktop/task-flow.e2e.mjs (1)

1828-1834: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Begin the scenario with a snapshot.

This helper clicks immediately after setting the scenario. Capture and assert the initial stable UI state first, then perform the click.

Suggested adjustment
 async function verifyProviderSwitchRetry(control, composerSelector) {
   control.setScenario('provider_switch_retry')
+  const snapshot = JSON.parse(await control.command('snapshot', 'body'))
+  assert.ok(snapshot.testIds.includes('new-chat-button'))
   await control.command('click', '[data-testid="new-chat-button"]')

As per coding guidelines, desktop verification must use existing data-testid selectors, begin with snapshot, and assert visible text or stable elements after critical actions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/e2e/desktop/task-flow.e2e.mjs` around lines 1828 - 1834, Update
verifyProviderSwitchRetry to capture and assert the initial stable UI state with
control.snapshot immediately after setting the provider_switch_retry scenario,
before clicking [data-testid="new-chat-button"]; use existing data-testid
selectors and verify visible text or stable elements before continuing with
waitFor and model selection.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wework/e2e/desktop/task-flow.e2e.mjs`:
- Around line 2189-2196: Update the assertions after switching back in the
conversation flow around middlePositionAfterSwitch to retain the tolerance-based
comparison with middlePositionBeforeSwitch or middleDistanceBeforeSwitch, while
keeping the existing top and bottom guards. Verify the restored scroll position
remains equivalent to the saved position within the established tolerance,
rather than only confirming it is somewhere in the middle.

---

Nitpick comments:
In `@wework/e2e/desktop/task-flow.e2e.mjs`:
- Around line 1828-1834: Update verifyProviderSwitchRetry to capture and assert
the initial stable UI state with control.snapshot immediately after setting the
provider_switch_retry scenario, before clicking [data-testid="new-chat-button"];
use existing data-testid selectors and verify visible text or stable elements
before continuing with waitFor and model selection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d7af47fa-b0a7-4904-985d-1a073ffe7eff

📥 Commits

Reviewing files that changed from the base of the PR and between 90ed022 and 609ea1c.

📒 Files selected for processing (1)
  • wework/e2e/desktop/task-flow.e2e.mjs

Comment on lines +2189 to +2196
const middleDistanceAfterSwitch = distanceFromBottom(middlePositionAfterSwitch)
assert.ok(
Math.abs(middlePositionAfterSwitch.scrollTop - middlePositionBeforeSwitch.scrollTop) <= 32,
`The middle scroll position moved from ${middlePositionBeforeSwitch.scrollTop}px to ${middlePositionAfterSwitch.scrollTop}px`
middlePositionAfterSwitch.scrollTop > 100,
'The restored long conversation unexpectedly returned to the top'
)
assert.ok(
middleDistanceAfterSwitch > 100,
'The restored long conversation unexpectedly returned to the bottom'

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

Retain the saved-position comparison.

These assertions only prove that the conversation is somewhere in the middle after switching back. A regression that restores a different middle position will pass. Keep the previous tolerance-based comparison against middlePositionBeforeSwitch or middleDistanceBeforeSwitch, alongside these top/bottom guards.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/e2e/desktop/task-flow.e2e.mjs` around lines 2189 - 2196, Update the
assertions after switching back in the conversation flow around
middlePositionAfterSwitch to retain the tolerance-based comparison with
middlePositionBeforeSwitch or middleDistanceBeforeSwitch, while keeping the
existing top and bottom guards. Verify the restored scroll position remains
equivalent to the saved position within the established tolerance, rather than
only confirming it is somewhere in the middle.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wework/e2e/desktop/task-flow.e2e.mjs (1)

2136-2146: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use the official label constant for the model option assertion.

officialModelSelector has already been waited on with PROVIDER_SWITCH_OFFICIAL_LABEL, and its text is GPT 5.5 (PROVIDER_SWITCH_OFFICIAL_LABEL), not GPT 5.6 Sol (PROVIDER_SWITCH_SOL_LABEL). Switching this assertion to the official label constant avoids a deterministically failing check.

🐛 Proposed fix
   const disabledModelText = await control.command('getText', officialModelSelector)
   assert.ok(
-    disabledModelText.includes(PROVIDER_SWITCH_SOL_LABEL),
+    disabledModelText.includes(PROVIDER_SWITCH_OFFICIAL_LABEL),
     'The target model option did not display the expected model label'
   )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/e2e/desktop/task-flow.e2e.mjs` around lines 2136 - 2146, Update the
assertion using disabledModelText in the official model option check to compare
against PROVIDER_SWITCH_OFFICIAL_LABEL instead of PROVIDER_SWITCH_SOL_LABEL,
matching the label already validated by waitFor and preserving the existing
assertion message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@wework/e2e/desktop/task-flow.e2e.mjs`:
- Around line 2136-2146: Update the assertion using disabledModelText in the
official model option check to compare against PROVIDER_SWITCH_OFFICIAL_LABEL
instead of PROVIDER_SWITCH_SOL_LABEL, matching the label already validated by
waitFor and preserving the existing assertion message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ed10a02-439f-45af-8b31-4b22056f331f

📥 Commits

Reviewing files that changed from the base of the PR and between 609ea1c and fb65cbd.

📒 Files selected for processing (6)
  • executor/src/agents/codex.rs
  • executor/src/agents/codex/tests.rs
  • executor/tests/codex_app_server_contract.rs
  • wework/e2e/desktop/task-flow.e2e.mjs
  • wework/src-tauri/tauri.conf.json
  • wework/src/e2e/automation.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • wework/src/e2e/automation.ts
  • executor/src/agents/codex/tests.rs
  • executor/tests/codex_app_server_contract.rs
  • executor/src/agents/codex.rs

huanling1 and others added 4 commits July 29, 2026 00:05
…ctive-form-pr2272

# Conflicts:
#	wework/e2e/desktop/scenarios/streaming-text.scenario.mjs
#	wework/e2e/desktop/task-flow.e2e.mjs
…ctive-form-pr2272

# Conflicts:
#	wework/src-tauri/tauri.conf.json
@qdaxb
qdaxb merged commit 0e527ee into wecode-ai:main Jul 28, 2026
36 checks passed
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.

2 participants