Repository navigation
fix(showcase): settle mcp-apps D5/D6 on the full iframe cascade - #6226
Merged
Merged
Conversation
The `completeOnMount` gate added in d70d48a named the `mcp-app-iframe` testid, which only Angular's `copilot-mcp-apps-widget` declared. react-core and vue build the sandbox iframe imperatively with no testid, so every React/Vue integration timed the turn out at 30s with `reason=surface-missing` and never reached `assertIframePresent` — whose `iframe[sandbox]` fallback would have passed. D5 + D6 `mcp-apps` went red on all 18 integrations that support the feature (first_failure_at 2026-07-28 23:03Z) while the demos rendered correctly by hand. Fixed on both sides of the contract: - react-core and vue now set `data-testid="mcp-app-iframe"` and a `title` on the host-created iframe, matching Angular. Pinned by a test in each package. - `completeOnMount` accepts CSS `selectors` alongside `testIds`, so the probe settles on the same cascade its module doc and assertion already use (`[data-testid="mcp-app-iframe"], iframe[sandbox]`). A comma-joined entry is one conjunctive surface whose branches `querySelectorAll` unions, so the delta/`minNewMounts` semantics are unchanged and `testIds` is now sugar for the equivalent selector. This half greens the fleet on the next sweep without waiting for a package release, since the integrations pin @copilotkit/react-core 1.61.2. A spec naming no surface now throws instead of burning the turn budget and reporting a misleading `surface-missing`. Verified against live staging: after clicking the pill, the old gate matched 0 elements and the cascade matched 1 (the sandboxed iframe was there all along). Also recorded in showcase/GOTCHAS.md.
Contributor
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-07-29 03:37:37 PDT — 0 finding(s). |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
Contributor
|
Size Change: +144 B (+0.01%) Total Size: 1.19 MB 📦 View Changed
ℹ️ View Unchanged
|
3 tasks done
AlemTuzlak
marked this pull request as ready for review
July 29, 2026 12:58
AlemTuzlak
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
July 29, 2026 12:58
AlemTuzlak
enabled auto-merge
July 29, 2026 13:10
mme
approved these changes
Jul 29, 2026
AlemTuzlak
added a commit
that referenced
this pull request
Jul 29, 2026
…real LLM (#6228) ## What does this PR do? Two `built-in-agent` demos were broken against a real model while their D5/D6 rows stayed **green** — `d5:built-in-agent/gen-ui-agent`, `d5:built-in-agent/byoc` and both `e2e:` rows all pass. Neither failure is reachable under aimock, so the fixtures could never have caught them (`showcase/GOTCHAS.md` #8). Both root causes were confirmed against the live OpenAI API. ### 1. `gen-ui-agent` stopped mid-plan on every run `@tanstack/ai`'s `chat()` applies `maxIterations(5)` when no `agentLoopStrategy` is passed (`@tanstack/[email protected]`, `src/activities/chat/index.ts`: `config.params.agentLoopStrategy || maxIterationsStrategy(5)`). Nothing errors when the budget runs out — the run just ends. `GEN_UI_AGENT_PROMPT` scripts **7** `set_steps` calls (1 initial + in_progress/completed per step × 3) plus a closing message, so the walk died two calls short with the last step pinned at `pending` and no narration. Captured from the staging SSE stream: ``` TOOL_CALL_START: 5, STATE_DELTA: 5, TEXT_MESSAGE_*: 0 call 5 (final): step1 completed, step2 completed, step3 pending ``` Reproduced locally with the real model, the real prompt and the real `set_steps` tool: | budget | `set_steps` calls | final statuses | narration | |---|---|---|---| | default (5) | 5 | `completed, completed, pending` | **none** | | `maxIterations(25)` | 7 | `completed, completed, completed` | 333 chars | Every demo factory now passes the shared `DEMO_AGENT_LOOP_STRATEGY` (25 — several times the longest scripted walk, still bounded, since each iteration is a model call). The two non-streaming tool-free `chat()` calls (`subagent-tools`, `a2ui-factory`'s secondary designer) keep the default: they have no loop to exhaust. ### 2. `declarative-json-render` rendered nothing at all `RUN_STARTED` → `RUN_FINISHED`, zero events between, no console error, no error banner. `text.format: { type: "json_object" }` has a server-side precondition that the word "json" appear in the request's `input`. The adapter sends `systemPrompts` as `instructions` and only `messages` as `input`, so with the JSON directive living solely in `SYSTEM_PROMPT` the API rejected every single run: ``` 400 Response input messages must contain the word 'json' in some form to use 'text.format' of type 'json_object'. (param: input) ``` The directive now rides in `messages` — as `role: "user"`, because `TanStackChatMessage` admits only `user | assistant | tool` and the runtime deliberately hoists system messages into `systemPrompts`, the very half that is not input. It is invisible in the UI (the chat renders from AG-UI events, not from what the backend sends the model). `json_object` enforcement is kept; verified live that the run then streams a complete, `JSON.parse`-able spec. That 400 was **invisible** because the hand-rolled converters forward a whitelist of chunk types and dropped `RUN_ERROR` — every one except `reasoning-factory`. The `type: "tanstack"` factories were already fine (the runtime's `convertTanStackStream` rethrows, `tanstack.ts:419`), so the four `type: "custom"` converters now call the shared `throwOnRunError`. This is why a fleet-wide silent failure went unnoticed, and it is fixed independently of the JSON-mode bug. ### 3. The progress card stopped claiming completion it doesn't have `InlineAgentStateCard` printed `All ${total} steps complete` whenever `status === "complete"`, ignoring the step data — so a truncated run announced completion above a list that visibly showed step 3 unstarted, which is what made an agent stopping early read as a UI glitch. The wording now derives from the steps (`describeProgress`, extracted as a pure function so it is testable without a DOM), a stalled run says so, and the check-mark icon is gated on the data too. ## Verification - 18 new unit tests, all green: agent-loop budget sized off the prompt itself, `throwOnRunError`, the `json_object` input precondition + converter behaviour, and the card's wording across running / done / stalled / empty - `oxlint` 0 warnings 0 errors on the changed dirs; `oxfmt` clean - Live end-to-end runs against real OpenAI for both root causes (tables above) - Pre-existing and unrelated: this integration is not a pnpm-workspace member, so `tsc --noEmit` here reports 73 errors from version skew in a standalone install (`gpt-5.4` outside the pinned adapter's model union, `@ag-ui/client` not exposed as a direct dep). Both hit untouched files and untouched lines; my two real type errors were fixed. CI runs vitest only in `showcase/scripts` and `showcase/harness`, so these tests are developer-local, same as the pre-existing `tanstack-factory.test.ts` beside them. ## Related PRs and Issues - Sibling real-LLM-vs-aimock fix: #6226 - Same class as #6224 (ms-agent .NET real-LLM demo defects) ## Checklist - [x] I have read the Contribution Guide - [x] If the PR changes or adds functionality, I have updated the relevant documentation (`showcase/GOTCHAS.md` — two new entries) - [x] "Allow edits by maintainers" is checked 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a fleet-wide false red on
mcp-appsD5/D6: red on all 18 integrations that support the feature sincefirst_failure_at2026-07-28 23:03Z, while the demos rendered correctly by hand.Root cause. The
completeOnMountgate added in d70d48a named themcp-app-iframetestid, which only Angular'scopilot-mcp-apps-widgetdeclares.react-coreandvuebuild the sandbox iframe imperatively (document.createElement("iframe")) with no testid, so the settle gate could never be satisfied — every React/Vue integration timed the turn out at 30s withreason=surface-missingand never reachedassertIframePresent, whoseiframe[sandbox]fallback would have passed.crewai-crewsandlangroidstayed green only because they skip the feature (errorClass: "skipped-incapable").Verified against live staging (
showcase-built-in-agent-staging, after clicking the "Sketch a system diagram" pill):Fixed on both sides of the contract:
Product —
react-coreandvueMCPAppsActivityRenderernow setdata-testid="mcp-app-iframe"andtitle="Interactive MCP application"on the host-created iframe, matching Angular. Pinned by a new test in each package, so dropping the attribute fails in the package that owns it rather than silently reddening the fleet a day later.Harness —
completeOnMountaccepts CSSselectorsalongsidetestIds, so the probe settles on the cascade its own module doc and assertion already declare:querySelectorAllunions comma-separated branches, so one entry expresses "any conforming form of this surface" while the conjunctive-across-entries andminNewMountsdelta semantics stay exactly as before;testIds: ["x"]is now sugar forselectors: ['[data-testid="x"]'], so every other probe is untouched. This half matters on its own: the integrations pin@copilotkit/[email protected], so a testid-only fix would leave 18 cells red until a release plus a fleet redeploy.Also: a
completeOnMountspec naming no surface now throws instead of burning the whole turn budget and reporting a misleadingsurface-missing. The trap is recorded inshowcase/GOTCHAS.mdnext to the siblingcopilot-assistant-messagetestid gotcha.Verification
conversation-runner.test.ts+d5-mcp-apps.test.ts— 101/101, including new red-green pairs: aselectorscascade greens, a never-mounting cascade still redssurface-missing, a leftover-only surface still reds, an empty spec fails loud@copilotkit/vueMCPAppsActivityRenderer.test.ts— 6/6@copilotkit/react-coreMCPAppsActivityRenderer.e2e.test.tsx— 17/17oxfmtclean,check-typesclean on both packagestypecheckwants the gitignored generatedshowcase/shell/src/data/frontend-catalog.json; 6src/probestests assert POSIX path separatorsRelated PRs and Issues
Checklist
showcase/GOTCHAS.md)🤖 Generated with Claude Code