Repository navigation
fix(showcase): unbreak gen-ui-agent and declarative-json-render on a real LLM - #6228
Merged
Merged
Conversation
Contributor
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-07-29 06:32:00 PDT — 0 finding(s). |
AlemTuzlak
marked this pull request as ready for review
July 29, 2026 12:59
AlemTuzlak
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
July 29, 2026 12:59
AlemTuzlak
enabled auto-merge
July 29, 2026 13:10
mme
previously approved these changes
Jul 29, 2026
…real LLM
Two built-in-agent demos were broken against a real model while their D5/D6
rows stayed green, because aimock exercises neither failure. Both root causes
were confirmed against the live OpenAI API.
gen-ui-agent stopped mid-plan on every run. `@tanstack/ai`'s `chat()` applies
`maxIterations(5)` when no `agentLoopStrategy` is passed, and 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 x 3) plus a
closing message, so the walk died two calls short with the last step pinned at
`pending` and no narration. Reproduced with the real model and the real prompt:
default budget -> 5 calls, "completed, completed, pending", no message
maxIterations(25) -> 7 calls, all completed, 333-char summary
Every demo factory now passes the shared DEMO_AGENT_LOOP_STRATEGY (25 —
several times the longest scripted walk, still bounded). The two non-streaming
tool-free `chat()` calls keep the default: they have no loop to exhaust.
declarative-json-render rendered nothing at all: RUN_STARTED -> RUN_FINISHED,
no events, no console error, no banner. `text.format: { type: "json_object" }`
has a server-side precondition that the word "json" appear in the request
`input`, but 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 run with
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 `user`, since TanStackChatMessage
admits no `system` role and the runtime hoists system messages into
systemPrompts — the half that is not input). 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 fine (the runtime's converter rethrows), so
the four `type: "custom"` converters now call the shared throwOnRunError.
Also: the gen-ui-agent progress card announced "All N steps complete" whenever
the RUN ended, ignoring the step data, so a truncated run read as a UI glitch
instead of an agent that stopped early. The wording is now derived from the
steps (`describeProgress`, extracted pure so it is testable without a DOM) and
a stalled run says so.
Both gotchas recorded in showcase/GOTCHAS.md.
AlemTuzlak
force-pushed
the
fix/built-in-agent-real-llm-demos
branch
from
July 29, 2026 13:31
85df6c8 to
5c89395
Compare
@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: |
lukasmoschitz
approved these changes
Jul 29, 2026
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?
Two
built-in-agentdemos were broken against a real model while their D5/D6 rows stayed green —d5:built-in-agent/gen-ui-agent,d5:built-in-agent/byocand bothe2e: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-agentstopped mid-plan on every run@tanstack/ai'schat()appliesmaxIterations(5)when noagentLoopStrategyis 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_PROMPTscripts 7set_stepscalls (1 initial + in_progress/completed per step × 3) plus a closing message, so the walk died two calls short with the last step pinned atpendingand no narration.Captured from the staging SSE stream:
Reproduced locally with the real model, the real prompt and the real
set_stepstool:set_stepscallscompleted, completed, pendingmaxIterations(25)completed, completed, completedEvery 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-freechat()calls (subagent-tools,a2ui-factory's secondary designer) keep the default: they have no loop to exhaust.2.
declarative-json-renderrendered nothing at allRUN_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'sinput. The adapter sendssystemPromptsasinstructionsand onlymessagesasinput, so with the JSON directive living solely inSYSTEM_PROMPTthe API rejected every single run:The directive now rides in
messages— asrole: "user", becauseTanStackChatMessageadmits onlyuser | assistant | tooland the runtime deliberately hoists system messages intosystemPrompts, 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_objectenforcement 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 exceptreasoning-factory. Thetype: "tanstack"factories were already fine (the runtime'sconvertTanStackStreamrethrows,tanstack.ts:419), so the fourtype: "custom"converters now call the sharedthrowOnRunError. 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
InlineAgentStateCardprintedAll ${total} steps completewheneverstatus === "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
throwOnRunError, thejson_objectinput precondition + converter behaviour, and the card's wording across running / done / stalled / emptyoxlint0 warnings 0 errors on the changed dirs;oxfmtcleantsc --noEmithere reports 73 errors from version skew in a standalone install (gpt-5.4outside the pinned adapter's model union,@ag-ui/clientnot exposed as a direct dep). Both hit untouched files and untouched lines; my two real type errors were fixed. CI runs vitest only inshowcase/scriptsandshowcase/harness, so these tests are developer-local, same as the pre-existingtanstack-factory.test.tsbeside them.Related PRs and Issues
Checklist
showcase/GOTCHAS.md— two new entries)🤖 Generated with Claude Code