Skip to content

fix(web-ui): tolerate missing model identity in model-round events - #1936

Merged
bobleer merged 1 commit into
GCWing:mainfrom
guantw:fix/acp-agent-model-round-streaming
Aug 1, 2026
Merged

fix(web-ui): tolerate missing model identity in model-round events#1936
bobleer merged 1 commit into
GCWing:mainfrom
guantw:fix/acp-agent-model-round-streaming

Conversation

@guantw

@guantw guantw commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Problem

When BitFun runs as an ACP client chatting with an external ACP agent (Codex, Claude Code, etc.), the FlowChat transcript stays empty: the agent keeps running, permission prompts may appear, files may be modified, but assistant text / tool results never show up.

Root cause

Since commit 4d73585 ("feat(agentic): support configurable subagent models"), handleModelRoundStart in EventHandlerModule.ts treats modelConfigId and effectiveModelName as required and calls .trim() on them unconditionally. The native AgenticEvent::ModelRoundStarted projection always carries both fields, but the ACP client emitter (acp_client_api.rs) builds the agentic://model-round-started payload by hand and does not include them.

Failure chain:

  1. ACP model round starts -> event lacks the two fields -> .trim() on undefined throws a TypeError.
  2. No ModelRound is created for that round.
  3. Subsequent agentic://text-chunk / tool events look up the round via addModelRoundItem and are dropped ("Model round not found").
  4. Transcript stays empty while the upstream agent keeps working.

Fix

  • Make modelConfigId / effectiveModelName optional on ModelRoundStartedEvent and ModelRoundCompletedEvent (AgentAPI.ts).
  • Omit them from the created ModelRound when absent instead of fabricating placeholder values (external ACP agents have no BitFun model identity).
  • updateSubagentParentTaskModel reads from the created round and only runs when a model name is present.

Verification

  • pnpm --dir src/web-ui run test:run src/flow_chat/services/flow-chat-manager/EventHandlerModule.test.ts - 25/25 passed
  • pnpm run type-check:web - passed

The ACP client emitter builds agentic://model-round-started payloads by hand and does not carry modelConfigId/effectiveModelName, which the native projection always provides. Since 4d73585 the UI treated these fields as required and called .trim() unconditionally, so external ACP agent rounds threw on start, no ModelRound was created, and subsequent text-chunk/tool events were dropped - leaving the transcript empty while the agent kept working.

Make both fields optional on the event contracts and omit them from the round when absent instead of fabricating placeholder values. The subagent parent task model update now reads from the created round and only runs when a model name exists.
@guantw
guantw force-pushed the fix/acp-agent-model-round-streaming branch from 0c22aaf to ef0aa08 Compare July 31, 2026 13:39
@bobleer
bobleer merged commit 23f5177 into GCWing:main Aug 1, 2026
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.

2 participants