Repository navigation
fix(showcase/built-in-agent): repair six real-LLM defects D6 was masking - #6200
Merged
Merged
Conversation
Every affected cell was D6-green (or D4-gated) while the deployed demo was visibly broken. The common cause is GOTCHAS #8: aimock replays a scripted tool-call sequence keyed on userMessage + context, so the fixture answers a question the model was never asked. Prompt gaps — ~20 demos shared one prompt-less `createBuiltInAgent()` where the reference wires each to its own graph AND its own system prompt. Adds `createBuiltInAgent({ systemPrompt })` + `demo-prompts.ts`, ported from the reference graphs: - gen-ui-tool-based plotted zeros; the assistant said "I used placeholder values since no sales figures were provided". Nondeterministic — some runs invented real values, which is how it passed review. - gen-ui-agent published its plan once then narrated, freezing the progress card on step 1 of 4. - a2ui-recovery painted five identical cards: nothing constrained the supervisor to one `generate_a2ui` call, and the pills literally ask it to "self-correct". The retry loop lives inside the tool, so supervisor retries are duplication. subagents' delegation panel was permanently empty — the frontend reads `agent.state.delegations` and no code emitted that slot. The converter now emits a `/delegations` delta per sub-agent result (whole-array `add`, since initial state is `{}` and strict fast-json-patch rejects unresolvable paths while @ag-ui/client swallows the throw), and ports the reference's `_MAX_CRITIQUE_ITERATIONS = 1` cap. declarative-json-render dumped raw JSON for any prompt the model couldn't crib from the worked example. Captured the SSE: the wire is already one closing brace short, so nothing is dropped in transport — model-level enforcement had been removed on the grounds that "the system prompt already enforces JSON-only output". It does not. Restores it via the Responses API's `text.format`, the param the removed `response_format` maps to, verified against the pinned @tanstack/[email protected] -> @tanstack/[email protected] request mapping. declarative-gen-ui and a2ui-recovery were the inverse: capped at D4 (UI ✓ BE ✓ 1P ✗ D6 gated) while working live. Their secondary design-call fixtures gated on `match.responseFormat`, which aimock can never satisfy here — it has no `text.format` handling and only forwards a top-level `response_format` the Responses API doesn't accept. Re-keyed onto `match.toolName` (the outer call declares `generate_a2ui`, the in-tool design call declares nothing) with the tool-less fixtures moved last, since several pills' brief is a substring of the pill text. Tests (both mutation-verified — they fail with the fix reverted): - aimock-a2ui-routing.test.ts drives aimock's real `matchFixture`; 14/16 cases fail on the old fixtures with "no fixture matched the secondary design call". - tanstack-factory.test.ts covers the `/delegations` and `/steps` deltas. Typecheck unchanged at 61 pre-existing errors; oxlint clean on changed files. NOT verified live: the four prompt/`text.format` changes need a real-LLM click-through, which needs a key this environment doesn't have. Reasoning and the exact request mapping are documented inline.
AlemTuzlak
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
July 28, 2026 14:51
Contributor
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-07-28 07:51:45 PDT — 0 finding(s). |
lukasmoschitz
approved these changes
Jul 28, 2026
2 of 9 tasks
AlemTuzlak
added a commit
that referenced
this pull request
Jul 29, 2026
## 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 | Demo | Symptom | Fix | |------|---------|-----| | beautiful-chat Sales Dashboard | `Catalog not found: sales_dashboard` | Force page-registered `catalogId`; stronger secondary design prompt | | declarative-gen-ui KPI / pie / bar / status | Loader never resolves; `without a type`; `SummaryCard` missing `id` | Sanitize + normalize flat A2UI components; drop invalid entries; force `declarative-gen-ui-catalog` | | shared-state-read-write Remember something | Notes panel never updates | AsyncLocal store write misses (tool EC); mirror writes + read fallback; wire dead deterministic reply path for the pill | | subagents left panel | Chat works, side UI empty | Same AsyncLocal store bug for `state.delegations` | | open-gen-ui-advanced calculator / ping host | Form/input calculator; ping no-ops | System prompt for clickable keypad + `notifyHost` / `evaluateExpression` wiring | | beautiful-chat calculator | Buttons do nothing | OGUI guidance: `type=button`, no `form`, click handlers | ### Voice auth error Not a code defect in the voice route: `GuardedOpenAITranscriptionService` correctly fails when `OPENAI_API_KEY` is 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 - [x] `dotnet test` ms-agent-dotnet (79/79) in Docker SDK 9 — includes new A2UI force-catalog / type-as-key / drop-invalid tests - [x] harness agent build + cvdiag tests (5/5) - [ ] Staging click-through after deploy: - [ ] `/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 host - [ ] Voice: confirm `OPENAI_API_KEY` present on staging frontend, then mic works
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.
Six defects reported on staging. All six reproduce; five share one cause.
The shared cause
built-in-agent/src/app/api/copilotkit/route.tsmaps ~20 demos to the same prompt-lesscreateBuiltInAgent(). The reference wires each to its own graph and its own system prompt (28 graphs inlanggraph-python/langgraph.json).aimock replays a scripted tool-call sequence keyed on
userMessage+context, so D6 is green whether or not the model could have reasoned its way there. This isshowcase/GOTCHAS.md#8 verbatim — including its stated "structural tell": grep the integration'sroute.tsfor demos left in the generic fallthrough that LGP wires to a dedicated graph.Per-defect
gen-ui-tool-based0 1 2 3 4with no bars, which is how it passed review.gen-ui-agentset_steps+ its/stepsSTATE_DELTA already worked; nothing told the model to walk pending→in_progress→completed.subagentsgrep -rn delegations src/ | grep -v demos/subagents→ no output. Frontend readsagent.state.delegations; the converter handles/stepsand/notesand has nodelegationscase. Chat works because the tools do run.declarative-json-render\$1.24M,+18% vs Q2). Model-level JSON enforcement had been removed with the note "the system prompt already enforces JSON-only output" — it does not.a2ui-recoverydeclarative-gen-uiUI ✓ BE ✓ 1P ✗ D6 —("gated — blocked by a lower rung"). Not a live bug — a fixture bug. See below.The D4 cap (
declarative-gen-ui,a2ui-recovery)Both demos' secondary design-call fixtures gated on
match.responseFormat: \"json_object\". That matcher can never match this backend:text.format.text.formathandling at all —responsesToCompletionRequestforwards only a top-levelresponse_format(absent in 1.19.1, forwarded in 1.37.4), a key the Responses API doesn't accept and this client doesn't send.effective.response_format?.typeis alwaysundefinedandrouter.tsskips the fixture → the design call never matched → surface never painted → D5 red, D6 never ran.Re-keyed onto
match.toolName, which aimock does normalize out of a Responses request (responsesToolsToCompletionsTools): the outer call declaresgenerate_a2ui, the in-tool design call declares nothing. Tool-less secondary fixtures moved last, because several pills' brief is a substring of the pill text (\"Build my Q2 revenue summary …\"contains\"Q2 revenue summary\") and would otherwise win the outer request.Verification
Reproduced live (staging, real LLM): the zero-axis chart plus its self-incriminating message, the unbalanced JSON on the wire, and the reference rendering the same pill correctly for contrast.
Two mutation-verified test suites — both fail with the fix reverted:
aimock-a2ui-routing.test.tsdrives aimock's realmatchFixture. On the old fixtures 14/16 cases fail withno fixture matched the secondary design call for brief \"…\"— the D5 red, reproduced as a unit test.tanstack-factory.test.tscovers the/delegationsand/stepsdeltas (3 delegation tests fail with the branch disabled; the 2 controls still pass).No regressions:
tsc --noEmitis 61 errors before and after (all pre-existing —gpt-5.4missing from the adapter's model union, zod v3/v4 skew); oxlint clean on changed files; the repo-wide fixture validator passes (858 assertions).text.formatwas verified by reading the request mapping in the pinned@tanstack/[email protected]→@tanstack/[email protected]:modelOptionsis spread straight intoresponses.create(),validateTextProviderOptionsonly inspectsmetadata/conversation/previous_response_id, and the adapter setstext.formatitself only when anoutputSchemais passed (none here, so nothing is clobbered).What is NOT verified
The four prompt/
text.formatchanges have not had a real-LLM click-through — that needs an OpenAI key this environment doesn't have, and D6/aimock cannot verify them by construction (that's the whole point of gotcha #8). Reasoning is documented inline at each site. This area has burned the repo before: a previousresponse_formatattempt made the call return an empty string "verified against real OpenAI", which is whytext.format— the Responses API's own param — is used instead. Worth a live click-through on the staging deploy before this is considered closed.Deliberate non-goals
a2ui-recoveryonly demonstrates recovery under aimock. The heal/exhaust branches need a designer LLM that emits invalid surfaces on demand; a real one succeeds on attempt 1. The single-call constraint fixes the 5-card bug and makes it honest; making recovery visible live needs deliberate fault injection — a product decision, recorded inPARITY_NOTES.md.openai:gpt-4o-mini(gen_ui_agent.py:92). Flagged, not touched.Docs
GOTCHAS.mdgains built-in-agent as a second worked instance of #8 (including that the masking runs both ways, and that1P ✗ D6 —means gated, not failing), plus thetext.formatand dead-responseFormattraps.PARITY_NOTES.mdrecords that the named-agent registry is not prompt-neutral, and that any newstate.<slot>needs a converter branch.