Skip to content

fix(c-generative-ui): three polish followups (flat args, loop cap, chip text)#440

Merged
blove merged 1 commit into
mainfrom
claude/genui-polish
May 18, 2026
Merged

fix(c-generative-ui): three polish followups (flat args, loop cap, chip text)#440
blove merged 1 commit into
mainfrom
claude/genui-polish

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 18, 2026

Summary

Three small followups to PR #436 that polish the c-generative-ui demo.

1. render_spec flat args

gpt-5 reasoning='minimal' frequently emits render_spec args as {"elements": ..., "root": ...} instead of the wrapped {"spec": {"elements": ..., "root": ...}} the tool signature required. Pydantic rejected the first call; the LLM retried successfully; but the user saw an ugly Error invoking tool 'render_spec' with kwargs ... spec: Field required block in the chat.

Fix: flatten the tool signature to render_spec(elements: dict, root: str). Matches the spec's actual schema and matches what the LLM naturally emits. Tool body just wraps them back into {"elements": elements, "root": root} before serializing. Zero retries observed in the smoke run.

2. Loop-termination prompt tightening

The agent loop was running render_spec + the 4 data tools TWICE per first turn — wasted LLM calls. Existing prompt said "return without further tool calls" but gpt-5 ignored it.

Fix: add explicit "Critical: if render_spec and the data tools have already been called this turn, you are DONE. Return with no tool_calls. Do NOT call render_spec again. Do NOT re-call the data tools." Smoke now shows exactly 1 render_spec + 4 data tools per first turn.

3. Welcome chip text aligned with aviation theme

Chip said "Show me a Q3 sales dashboard with three metrics" but the backend is aviation-themed. When the user clicked the chip, the LLM saw "Q3 sales" + an aviation tool catalog, got confused, and wrote a fictional sales dashboard description in prose instead of calling tools.

Fix: chip values now match the backend — "Show me a dashboard of airline operations." and "Filter to only the cancelled flights." (Replaces the broken second chip "Create a contact form" which was never relevant to this demo.)

Files

  • cockpit/chat/generative-ui/python/src/graph.py — flatten render_spec signature
  • cockpit/langgraph/streaming/python/src/dashboard_graph.py — umbrella mirror
  • cockpit/chat/generative-ui/python/prompts/dashboard.md — tighten loop instructions + update tool signature reference
  • cockpit/langgraph/streaming/python/prompts/dashboard.md — umbrella mirror
  • cockpit/chat/generative-ui/angular/src/app/generative-ui.component.ts — chip text

Test plan

  • Real-LLM smoke against per-cap (3-turn): 1 render_spec call, 4 data tools, 0 Pydantic errors, clean conversational summary
  • pnpm nx run cockpit-chat-generative-ui-python:build — green
  • pnpm nx run cockpit-langgraph-streaming-python:build — green
  • pnpm nx run cockpit-chat-generative-ui-angular:build — green
  • CI

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 18, 2026 8:17pm

Request Review

1. render_spec(elements, root) instead of render_spec(spec) — matches what
   gpt-5 reasoning='minimal' naturally emits; eliminates the visible
   Pydantic 'spec: Field required' retry artifact in the chat.

2. Tighten prompt: explicit 'if render_spec and the data tools have already
   been called this turn, you are DONE' — stops the double-loop where
   gpt-5 re-runs all tools on the second iteration.

3. Welcome chip text now matches the aviation backend ('Airline operations
   dashboard' / 'Filter to cancelled flights' instead of the off-theme
   'Q3 sales dashboard' / 'contact form').

Mirrors to umbrella graph + prompt per the full-copy policy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@blove blove force-pushed the claude/genui-polish branch from 6225e42 to 3f66724 Compare May 18, 2026 20:08
@blove blove merged commit eaa255f into main May 18, 2026
18 checks passed
@blove blove deleted the claude/genui-polish branch May 18, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant