Repository navigation
fix(showcase): repair ms-agent .NET real-LLM demo defects - #6224
Merged
Merged
Conversation
Staging click-through on ms-agent-dotnet / ms-agent-harness-dotnet hit several GOTCHAS #8 defects: aimock D6 was green while live LLMs failed. A2UI (beautiful-chat sales dashboard, declarative-gen-ui pills): - Force the page-registered catalogId (models invent "sales_dashboard"). - Sanitize/normalize flat components; salvage type-as-key nests; drop entries missing id/component (SummaryCard without id, charts without type). - Strengthen secondary design prompts with the flat catalog contract. Shared state + subagents side panels: - Tool invocation drops AsyncLocal set by SetActiveThread, so writes landed in the global slot while snapshots keyed by AgentSession/AgentThread. Mirror writes and fall back on read (same pattern as D5ParityAgents). - Wire the dead TryBuildDeterministicReply path for the "Remember something" pill so notes update without relying on the model calling set_notes. Open generative UI advanced + beautiful-chat calculator: - Prompt for clickable keypad (not form/submit) and notifyHost ping wiring. Verified: ms-agent-dotnet unit suite 79/79 green in Docker SDK 9; harness agent builds clean and cvdiag tests 5/5.
Contributor
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-07-29 02:43:29 PDT — 0 finding(s). |
AlemTuzlak
marked this pull request as ready for review
July 29, 2026 09:44
AlemTuzlak
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
July 29, 2026 09:44
lukasmoschitz
approved these changes
Jul 29, 2026
3 tasks done
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.
Summary
Fixes staging click-through failures on ms-agent-dotnet and ms-agent-harness-dotnet demos. Same class of bug as #6200 (GOTCHAS #8): aimock D6 was green while real LLMs failed.
Root causes & fixes
Catalog not found: sales_dashboardcatalogId; stronger secondary design promptwithout a type;SummaryCardmissingiddeclarative-gen-ui-catalogstate.delegationsnotifyHost/evaluateExpressionwiringtype=button, noform, click handlersVoice auth error
Not a code defect in the voice route:
GuardedOpenAITranscriptionServicecorrectly fails whenOPENAI_API_KEYis missing on the Next.js process. Staging needs that env var on the showcase frontend service (transcription hits real OpenAI, not aimock).MCP Excalidraw empty iframe
Left as follow-up — likely external MCP host / sandbox CSP; no agent-side bug found in wiring.
Test plan
dotnet testms-agent-dotnet (79/79) in Docker SDK 9 — includes new A2UI force-catalog / type-as-key / drop-invalid tests/react/ms-agent-dotnet/beautiful-chat— Sales Dashboard paints; calculator interactive/react/ms-agent-harness-dotnet/declarative-gen-ui— all four pills paint without A2UI errors/react/ms-agent-harness-dotnet/shared-state-read-write— Remember something updates notes/react/ms-agent-harness-dotnet/subagents— left panel shows running/completed delegations/react/ms-agent-harness-dotnet/open-gen-ui-advanced— calculator keypad + ping hostOPENAI_API_KEYpresent on staging frontend, then mic works