feat(chat): show the model pdev actually used instead of pdev/auto

Merged
HA
1mo ago
+192-16

What & why

pdev chats labelled every reply with the selected alias (pdev/auto), not the model that answered. pdev 0.1.2 (release, from superset-sh/router#2) now reports the model its router resolved in _meta.piAcp.model.

  • AcpAdapter reads _meta.piAcp.model on live chunks, whole v2 messages and session/load replay, as either an id or a { provider, modelId } pair, and strips the vercel-ai-gateway/ prefix. Agents that send nothing keep the selected model's label.
  • For pdev (agentInfo.name is paradev/pdev) the pdev/ prefix is dropped from model option labels, since the picker is already pdev's.
  • Bundles pdev 0.1.2. It also fixes a silent failure: when the model call failed (e.g. a provider 400 on max_tokens for zai/glm-5.3-flashx), pdev ended the turn with end_turn and the chat showed a finished turn with no reply. It now fails session/prompt with the error, which the adapter already shows as a failed turn and an error notice.

How I tested it

  • packages/chat-runtime: bun test 283 pass, typecheck clean; four new adapter tests (resolved model on a live message, gateway prefix stripped, pdev/ dropped from labels with fallback, model kept on v2 replay).
  • apps/desktop/scripts/build-bundled-pdev.test.ts pass; bun run bundle:pdev downloads 0.1.2 and the checksums match.
  • Ran the compiled pdev 0.1.2 over ACP against the production router: chunks carry "_meta":{"piAcp":{"model":"zai/glm-5.3-flash"}}. Against a fake router returning the 400: 0.1.1 returns {"stopReason":"end_turn"}, 0.1.2 returns a JSON-RPC error with the 400 text.
  • Not verified in the desktop UI with screenshots.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (Biome on changed files, chat-runtime typecheck)
  • "Allow edits from maintainers" is checked on fork PRs (not a fork PR)

Summary by cubic

pdev chats labelled every reply with the selected alias (pdev/auto) instead of the model that answered. The adapter now reads the model pdev reports in _meta.piAcp.model on live chunks, whole v2 messages, and session/load replay, accepting an id or a { provider, modelId } pair and stripping the vercel-ai-gateway/ prefix; agents that send nothing keep the selected model's label.

  • pdev option labels drop the pdev/ prefix since the picker is already pdev's.
  • Bundles pdev 0.1.2, which also fixes a silent failure where a failed model call ended the turn with no reply; it now fails session/prompt with the error.

Summary by CodeRabbit

  • New Features
    • Model names from agent metadata are now shown in chat messages, with unnecessary provider prefixes removed.
    • Model option labels are simplified for supported agents.
  • Updates
    • The bundled pdev version is updated to 0.1.2 for supported platforms.