Repository navigation
fix(mcp): keep app forms, file updates and context in sync after live testing - #164277
Conversation
Remove narrating comments, redundant request and navigation intermediates, an inferred schema annotation, and unused private parameter defaults. Preserve request capture order and all runtime boundaries.
Reuse the shared record guard and consolidate reservation cleanup. Remove unused form state and redundant aliases, flatten context projection, and trim verbose commentary and declaration style drift.
Remove duplicate binding and URI validation, a redundant choice-value intermediate, and the unused cross-module URI validator export. Reuse the declared form-origin type instead of repeating callback fields. Remove revision narration and normalize string construction without changing error text, authority checks, wire payloads, or async boundaries.
…p-b' and 'steipete/mcp-apps-deslop-c' into steipete/mcp-apps-deslop
Keep McpAppSettingSchema private after the UI cleanup removed its only external type annotation, so production and full-tree export scans pass. Restore the original question-media record predicate: sharing it through the normalization package changes UI chunking. The isolated comparison measures 40 fewer startup gzip bytes with the local predicate, preserving validation behavior and the existing performance ceiling.
Exclude pending elicitation time from the runtime deadline while preserving ordinary request timeouts and parent cancellation. The SDK absolute deadline includes the existing 120-second question allowance; repeated questions share that allowance so a server cannot renew a tool indefinitely. Approval already completes before dispatch and is covered by the registered-route regression. Fake-clock app and model calls now return after a 70-second human wait; ordinary calls still expire at 60 seconds.
Publish the cleared revision through the existing host-context event and discard older in-flight UI refreshes. Removing already-consumed context succeeds; an outdated receipt still cannot remove a newer update. Registered Gateway and mounted component regressions cover consumption and late removal.
Retain the subscribe request device-revocation capture for the watcher lifetime. The accepted RPC previously released that capture before file notifications arrived. View, session, requester and revocation checks remain current; watcher closure now logs its reason. Registered subscription proof covers real append and atomic rename. Registered launch proof separately confirms retained interaction authority survives launch request disposal and rejects later revocation; one-shot approval is not widened.
Use fixed marker/thumbnail columns and shrinkable copy in a flex option row. The previous three-column grid placed four children into overlapping/wrapped columns. Chromium component geometry and inspected screenshots cover 320, 400, 440 and 480 pixel widths.
Render ended-session and reconstructed-preview states in the view chrome. The existing typed expiry signal and read-only capability control the state; entrypoint panels supply their existing launch operation for Relaunch. The ten-minute view lease and authorization policy are unchanged.
Describe the selected session and adopt that same key through the canonical session creator only when no row exists, then discover apps. Existing rows and refreshes avoid repeated creation. This preserves the session-owned harness and tool-policy contract instead of inventing a sessionless runtime. A mounted global catalog regression fails before the orchestration fix. Complementary registered Gateway proof exercises missing-row denial, sessions.create and discovery before any model turn.
Honor tool preference, then resource preference, defaulting inline; advertised resource modes constrain the chosen mode. Intersect those modes with initialized app capabilities and immediately publish the negotiated host context. Resource hints can no longer widen the initialized capabilities.
Classify malformed upstream resource lists as UNAVAILABLE with stable detail code MCP_APP_UNSUPPORTED_MENTION_RESULT. Render localized plain-language copy in the resource picker; request validation retains INVALID_REQUEST. The host continues to reject nonconforming resource data.
Match the visible 1-9 badges to rendered option buttons and omit inaccessible Other badges. Hidden implicit-resource choices neither consume shortcut numbers nor respond to keys. Resource preview requests retain their original option indices in their separate owner.
Keep only x-openai-thumbnail and extensions-based settings metadata; remove the unused form-resource constructor requestId and stop forwarding it from callers. The public harness adapter parameter shape is unchanged. Fetched https://developers.openai.com/plugins/build/extensions/ with curl (HTTP 200); it names x-openai-thumbnail and Plugin settings without an experimental placement. The suggested /plugins/build/extensions/settings page returned HTTP 404. The linked formal specification is on GitHub and was not fetched under this work order. No experimental-placement contract was found in the fetched official documentation. A registered app form regression proves the unsupported alias is ignored while canonical thumbnails survive. The actual SDK runtime catalog no longer advertises experimental settings; registered resource lifecycle tests cover the constructor cutover.
Only offer Relaunch recovery copy when the view retains an entrypoint launch callback. Expired transcript and question previews cannot safely reconstruct a tool launch, so direct them to send a new message instead. Preserve the existing expiry event and panel Relaunch path. Two mounted-view assertions fail before this change; all 20 view tests pass afterward.
Keep the view below its existing 700-line cap by moving its unchanged Lit stylesheet into a module loaded with the view. Use the context-provider test helper as the actual relaunch fixture parent and add required loop braces. No limit or baseline changes. The final lint attempt exposed these three issues; scoped type-aware lint and all 28 mounted-view/catalog tests pass after repair.
Use the existing test-client factory to supply the full GatewayBrowserClient contract and preserve the mounted frame owner identity. Remove the invalid partial-client cast. The UI component type lane and all 20 mounted-view tests pass with this fixture.
Share guarded context publication across existing refresh paths, render notice copy in place, and reuse the session target. Remove a one-use display intermediate and a redundant comment. Preserve synchronous clear receipts, revision checks, authority checks, and timeout bounds. Document the shared 120-second human-input allowance in one sentence. This removes 25 production lines; regression tests are unchanged.
Move per-request cancellation, the bounded human-input allowance, and local timeout provenance into the existing client lifecycle owner. Each server creates its own lifecycle so failure backoff still recognizes only its own request timeouts. This removes over-cap growth from the catalog runtime without changing the line ratchet, timeout values, authority checks, or tests. The registered timeout regressions and elicitation binder tests pass.
Register file notifications with the read scope used by the subscribe route. Targeted broadcasts still enforce view, session, requester, connection and device authority; unknown events remain denied. Exercise file-entrypoint launch, append and atomic rename through the real broadcaster. The regression failed with no socket frame before registration and passes after; isolated Parts Lab Playwright proof confirms both ETag changes.
Authorize host-context notifications with the read scope used by the bound view. The live broadcaster previously dropped this unregistered event, including targeted receipts. Preserve revision tracking and connection targeting. The registered-route regression fails before registration and passes after two successive context updates. Mounted AppsPage coverage verifies both conversation controllers clear three chips and the bridge context on the latest receipt.
Use the existing shared allowance constant for ten-minute questions and per-call human input. SDK total deadlines become the configured active-work timeout plus 600 seconds. Ordinary requests, approval ordering and the ten-minute view lease are unchanged. Fake-timer route regressions fail under the 120-second allowance and pass with 500-second human waits; repeated questions expire at 660 seconds for a 60-second request budget. Document the per-call shared limit.
Fold one-use prompt and resource projections, share identical catalog callbacks, and remove redundant validation scaffolding and branches. Preserve URI and resource admission, revision comparison, fresh result arrays, subscription order and all authority checks. Remove 43 production lines with existing tests unchanged. Nine owner test files pass; the branch remains net positive because further candidates would alter observable projections or lifecycle contracts.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 8:04 AM ET / 12:04 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR repairs MCP app form deadlines, file and context notifications, fresh-session discovery, display preferences, and UI recovery while simplifying nearby code. Merge readiness✅ Ready for maintainer review Both previous blockers are resolved, with no additional actionable correctness finding. The repairs remain necessary on current main, and the recorded live evidence supports the changed behavior. Priority: P2 Review scores
Verification
How this fits togetherMCP apps are interactive plugin views hosted by OpenClaw. The Gateway connects their tools, forms, files, and selected context to the owning conversation, while the Control UI renders the app and recovery controls. flowchart TD
A[Plugin MCP server] --> B[Gateway app runtime]
C[Conversation and requester authority] --> B
B --> D[Human input forms]
E[Workspace file changes] --> F[Scoped notifications]
B --> F
F --> G[Control UI app view]
D --> G
G --> H[Next conversation turn]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +102, Tests +1388, Docs +1. Total +1491 across 60 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the repairs within the existing MCP lifecycle, Gateway authority, session, and UI owners, preserving settings interoperability and actionable recovery. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the dropped-notification mechanism and configured deadline conflict, with registered regressions and reported live failures. This read-only review did not execute a reproduction. Is this the best way to solve the issue? Yes, the patch repairs existing owners and restores the documented settings contract; the previous setup-error and board-recovery concerns are addressed without a parallel runtime or new configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 063685e96d00. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Restore the experimental settings capability documented for MCP 2025-11-25 and earlier, retaining extensions precedence. Keep sandbox setup failures visible alongside reconstructed-view guidance; typed session expiry retains its recovery state.
|
Addressed both findings in 808d080: restored the documented experimental settings advertisement with extensions precedence, and preserved genuine setup errors for reconstructed views. Both regressions fail before the fixes and pass afterward; focused proof and inspected synthetic before/after images are in the PR body. The earlier board layout failure is also fixed in 533d3bd. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
… testing (openclaw#164277) * refactor(ui): deslop MCP app UI Remove narrating comments, redundant request and navigation intermediates, an inferred schema annotation, and unused private parameter defaults. Preserve request capture order and all runtime boundaries. * refactor(mcp): deslop MCP app runtime Reuse the shared record guard and consolidate reservation cleanup. Remove unused form state and redundant aliases, flatten context projection, and trim verbose commentary and declaration style drift. * refactor(harness): deslop MCP app harness Remove duplicate binding and URI validation, a redundant choice-value intermediate, and the unused cross-module URI validator export. Reuse the declared form-origin type instead of repeating callback fields. Remove revision narration and normalize string construction without changing error text, authority checks, wire payloads, or async boundaries. * fix(mcp-apps): keep cleanup within export and UI budgets Keep McpAppSettingSchema private after the UI cleanup removed its only external type annotation, so production and full-tree export scans pass. Restore the original question-media record predicate: sharing it through the normalization package changes UI chunking. The isolated comparison measures 40 fewer startup gzip bytes with the local predicate, preserving validation behavior and the existing performance ceiling. * fix(mcp): keep elicitation-backed tool calls alive while a human answers Exclude pending elicitation time from the runtime deadline while preserving ordinary request timeouts and parent cancellation. The SDK absolute deadline includes the existing 120-second question allowance; repeated questions share that allowance so a server cannot renew a tool indefinitely. Approval already completes before dispatch and is covered by the registered-route regression. Fake-clock app and model calls now return after a 70-second human wait; ordinary calls still expire at 60 seconds. * fix(ui): clear the app context strip when a turn consumes it Publish the cleared revision through the existing host-context event and discard older in-flight UI refreshes. Removing already-consumed context succeeds; an outdated receipt still cannot remove a newer update. Registered Gateway and mounted component regressions cover consumption and late removal. * fix(gateway): deliver file-change notifications to subscribed app views Retain the subscribe request device-revocation capture for the watcher lifetime. The accepted RPC previously released that capture before file notifications arrived. View, session, requester and revocation checks remain current; watcher closure now logs its reason. Registered subscription proof covers real append and atomic rename. Registered launch proof separately confirms retained interaction authority survives launch request disposal and rejects later revocation; one-shot approval is not widened. * fix(ui): keep rich-form thumbnails beside their labels Use fixed marker/thumbnail columns and shrinkable copy in a flex option row. The previous three-column grid placed four children into overlapping/wrapped columns. Chromium component geometry and inspected screenshots cover 320, 400, 440 and 480 pixel widths. * fix(ui): show expired and reconstructed app views as inactive Render ended-session and reconstructed-preview states in the view chrome. The existing typed expiry signal and read-only capability control the state; entrypoint panels supply their existing launch operation for Relaunch. The ten-minute view lease and authorization policy are unchanged. * fix(ui): discover apps on the Apps page before any session exists Describe the selected session and adopt that same key through the canonical session creator only when no row exists, then discover apps. Existing rows and refreshes avoid repeated creation. This preserves the session-owned harness and tool-policy contract instead of inventing a sessionless runtime. A mounted global catalog regression fails before the orchestration fix. Complementary registered Gateway proof exercises missing-row denial, sessions.create and discovery before any model turn. * fix(ui): honor the app's preferred display mode on launch Honor tool preference, then resource preference, defaulting inline; advertised resource modes constrain the chosen mode. Intersect those modes with initialized app capabilities and immediately publish the negotiated host context. Resource hints can no longer widen the initialized capabilities. * fix(ui): report unsupported mention results plainly Classify malformed upstream resource lists as UNAVAILABLE with stable detail code MCP_APP_UNSUPPORTED_MENTION_RESULT. Render localized plain-language copy in the resource picker; request validation retains INVALID_REQUEST. The host continues to reject nonconforming resource data. * fix(ui): accept numeric shortcuts for every rendered option Match the visible 1-9 badges to rendered option buttons and omit inaccessible Other badges. Hidden implicit-resource choices neither consume shortcut numbers nor respond to keys. Resource preview requests retain their original option indices in their separate owner. * refactor(mcp): drop unshipped compatibility aliases Keep only x-openai-thumbnail and extensions-based settings metadata; remove the unused form-resource constructor requestId and stop forwarding it from callers. The public harness adapter parameter shape is unchanged. Fetched https://developers.openai.com/plugins/build/extensions/ with curl (HTTP 200); it names x-openai-thumbnail and Plugin settings without an experimental placement. The suggested /plugins/build/extensions/settings page returned HTTP 404. The linked formal specification is on GitHub and was not fetched under this work order. No experimental-placement contract was found in the fetched official documentation. A registered app form regression proves the unsupported alias is ignored while canonical thumbnails survive. The actual SDK runtime catalog no longer advertises experimental settings; registered resource lifecycle tests cover the constructor cutover. * fix(ui): keep inactive app recovery actionable Only offer Relaunch recovery copy when the view retains an entrypoint launch callback. Expired transcript and question previews cannot safely reconstruct a tool launch, so direct them to send a new message instead. Preserve the existing expiry event and panel Relaunch path. Two mounted-view assertions fail before this change; all 20 view tests pass afterward. * refactor(ui): separate MCP App view styles Keep the view below its existing 700-line cap by moving its unchanged Lit stylesheet into a module loaded with the view. Use the context-provider test helper as the actual relaunch fixture parent and add required loop braces. No limit or baseline changes. The final lint attempt exposed these three issues; scoped type-aware lint and all 28 mounted-view/catalog tests pass after repair. * test(ui): use the Gateway client fixture for relaunch Use the existing test-client factory to supply the full GatewayBrowserClient contract and preserve the mounted frame owner identity. Remove the invalid partial-client cast. The UI component type lane and all 20 mounted-view tests pass with this fixture. * refactor(mcp-apps): trim live-fix additions Share guarded context publication across existing refresh paths, render notice copy in place, and reuse the session target. Remove a one-use display intermediate and a redundant comment. Preserve synchronous clear receipts, revision checks, authority checks, and timeout bounds. Document the shared 120-second human-input allowance in one sentence. This removes 25 production lines; regression tests are unchanged. * refactor(mcp): keep request deadlines with client lifecycle Move per-request cancellation, the bounded human-input allowance, and local timeout provenance into the existing client lifecycle owner. Each server creates its own lifecycle so failure backoff still recognizes only its own request timeouts. This removes over-cap growth from the catalog runtime without changing the line ratchet, timeout values, authority checks, or tests. The registered timeout regressions and elicitation binder tests pass. * fix(gateway): authorize app resource update delivery Register file notifications with the read scope used by the subscribe route. Targeted broadcasts still enforce view, session, requester, connection and device authority; unknown events remain denied. Exercise file-entrypoint launch, append and atomic rename through the real broadcaster. The regression failed with no socket frame before registration and passes after; isolated Parts Lab Playwright proof confirms both ETag changes. * fix(gateway): deliver consumed app context receipts Authorize host-context notifications with the read scope used by the bound view. The live broadcaster previously dropped this unregistered event, including targeted receipts. Preserve revision tracking and connection targeting. The registered-route regression fails before registration and passes after two successive context updates. Mounted AppsPage coverage verifies both conversation controllers clear three chips and the bridge context on the latest receipt. * fix(mcp): give app forms the view lease's ten minutes Use the existing shared allowance constant for ten-minute questions and per-call human input. SDK total deadlines become the configured active-work timeout plus 600 seconds. Ordinary requests, approval ordering and the ten-minute view lease are unchanged. Fake-timer route regressions fail under the 120-second allowance and pass with 500-second human waits; repeated questions expire at 660 seconds for a 60-second request budget. Document the per-call shared limit. * refactor(mcp-apps): fund live fixes with nearby cleanup Fold one-use prompt and resource projections, share identical catalog callbacks, and remove redundant validation scaffolding and branches. Preserve URI and resource admission, revision comparison, fresh result arrays, subscription order and all authority checks. Remove 43 production lines with existing tests unchanged. Nine owner test files pass; the branch remains net positive because further candidates would alter observable projections or lifecycle contracts. * fix(ui): preserve board app recovery ownership * fix(mcp): preserve settings compatibility and visible setup errors Restore the experimental settings capability documented for MCP 2025-11-25 and earlier, retaining extensions precedence. Keep sandbox setup failures visible alongside reconstructed-view guidance; typed session expiry retains its recovery state.
Related: #161747
What Problem This Solves
Fixes: after #161747 landed, a live test of MCP plugin apps against a purpose-built demo server found that rich forms were cancelled by the 60 s MCP request timeout while the person was still answering, file viewers never received live-update notifications, the "App context" strip stayed stale after a turn consumed it, expired or reconstructed app views failed silently, the Apps page errored on a fresh install, launches ignored the app's preferred display mode, and several smaller UI defects (overlapping thumbnails, keyboard shortcuts, raw Zod errors). The landed diff also carried leftover slop from its team-session origin.
User Impact
User impact: MCP app forms wait for the person answering them (one shared ten-minute allowance per tool call, matching the view lease) instead of timing out mid-form; file viewers get live updates after the file changes on disk; the context strip clears when the context is sent and removing already-sent context no longer errors; views whose lease ended show "This app session ended" with a Relaunch action, and reconstructed transcript views say "Send a message to interact again"; the Apps page works before any session exists; apps open inline unless they prefer fullscreen; thumbnails, numeric shortcuts (1–9) and mention-search errors render correctly. No configuration changes.
Why This Change Was Made
Two notification events (
mcp.app.resourceUpdated,mcp.app.hostContextChanged) were never registered with the Gateway broadcaster's event-scope guard, so the live broadcaster dropped them while unit tests with a mocked broadcaster kept passing; both regressions now go through the real broadcaster. The elicitation handler holds a human-input lease that suspends the per-request deadline only while a question is pending, so ordinary tool calls keep their configured timeout. The file watcher retains the subscribe request's device-revocation capture for its lifetime and logs its close reason instead of closing silently. The UI consumes facts the Gateway already had (reconstruction state, consumed-context receipts, preferred display modes) rather than adding new owners. A behavior-neutral deslop pass over the landed diff and nearby cleanup fund most of the additions; the inactive-view state, session adoption and lease logic account for the remaining production growth.Evidence
Live test on an isolated Gateway with a demo MCP Apps server ("Parts Lab": global/thread/file entrypoints, settings, mentions, model context, rich-form elicitation, resource subscriptions). Findings and the re-verification log are summarized below; each fix has a regression at the registered Gateway route or mounted component.
-32001 Request timed outat 60 s); after the broadcaster-scope fix, file append and atomic rename changed the viewer's ETag and the Apps-page context strip cleared after the turn (worker Playwright proof plus mounted AppsPage coverage).f224fac35509cd3b35dcb19e674ffd0ca7b3c37f: focused tests (290 across the touched files), format, diff-check, type-aware oxlint, tsgo lanes, Knip, madge, fullcheck-changed, matched-base startup JS 373,179 B (CI'sui:check-performance:basemode; the ordinary local check is already over its ceiling on currentmainitself at 373,753 B). Independent Codex autoreview at P1: four findings, all on inheritedmaincommits or a false prerequisite, dispositions recorded.e40ed06f23cb8bd939c9a6ff537eba7136074686without conflicts or overlapping changed paths, preserving all 24 reviewed commits. Integrated head3fa8ecd843a80d381878535e3b84973f36e14964passedpnpm format:check,git diff --check,git diff origin/main --check, andnode scripts/run-tsgo.mjswithtsconfig.core.jsonandtsconfig.ui.json. No branch fixtures or budgets required resolution; the earlier focused tests were not rerun.window.confirm()for app→conversation messages with a pane-owned confirmation (embedded hosts suppress native dialogs); per-view approval grants for app-initiated app-only tools.Before/after (synthetic fixtures):
CI follow-up
CI run
37120318762at3fa8ecd843a80d381878535e3b84973f36e14964found a dashboard layout regression inchecks-ui-e2e (8/9): a read-only board app incorrectly received the conversation recovery banner, shifting its full-height iframe by 48 px. The fail-fast monitor canceled 20 sibling jobs; that attempt is failed/canceled evidence, not passing coverage.Fixed in
533d3bd4284febb5445094e3ea343d9600da1cd4by making the embedding surface explicit. The board keeps its existing grant, renewal, and Retry/Remove owner; conversation previews retain their recovery message and entrypoint Relaunch action. The read-only fixture and zero-inset browser assertions remain unchanged. No configuration or authorization change.The unchanged pre-fix browser case reproduced the exact 48 px failure. After the fix, all 5 board E2E cases passed (27.70 s wall; retained-runtime case 1.810 s), along with 36 view/board/transcript unit tests (18.00 s total; 21 view tests in 8.56 s, modified case 2 ms), focused formatting, type-aware oxlint, UI tsgo, and diff-check. Fresh independent Codex autoreview through P2 found no actionable issues. New-head CI is required before landing.
Review follow-up
Addressed both ClawSweeper findings in
808d08038ca0c4cd8339aa7dbb02c043181aea16. The pinned protocol specification explicitly supportsexperimental["openai/settings"]for MCP 2025-11-25 and earlier. The shared decoder again accepts it afterextensionsprecedence, so direct and native catalog consumers retain settings discovery. The existing real SDK catalog test now protects that documented contract.Reconstructed views now show genuine sandbox setup failures alongside their recovery guidance. Only typed ended-session errors are replaced by the recovery state. The four existing invalid-sandbox cases were extended to reconstructed payloads; all four failed before the fix and pass afterward. The board recovery repair remains unchanged.
Proof: the settings catalog case failed with
undefinedbefore the decoder fix; the full six-case registered MCP suite then passed (54.36 s Vitest / 67.81 s wrapper with--maxWorkers=1, including a 40.405 s cold compiled-worker preparation; settings case 34 ms). This existing suite exercises real SDK negotiation and registered Gateway dispatch with fake timers. Direct checks also passed for extensions-only, experimental-only, and extensions precedence. All 21 view tests passed (9.37 s Vitest / 13.27 s wrapper; changed cases 72–92 ms). Focused format, type-aware lint, core/UI tsgo, and diff checks passed. A fresh combined isolated Codex autoreview through P2 completed with no actionable findings.