Repository navigation
Conversation
ACP sends tool output as ToolCallContent[], where each entry wraps a
ContentBlock one level deep ({type:'content', content:{type:'text', text}}).
The tool_call handler only passed toolCallId/title/status to addToolCall and
discarded content entirely, so every tool result was invisible in the chat
UI. See issue formulahendry#69.
- add renderToolContent() to flatten the nested shape and cover the diff,
terminal and locations variants rather than assuming text is the only
possible data
- thread content through addToolCall/updateToolCall and both the tool_call
and tool_call_update dispatch paths
- a supplied content replaces the stored text (ACP v1 updates carry whole
fields, not deltas), while an update that omits content keeps what is
already on screen
- persist content in chatHistory so a reload does not silently discard it
- render through escapeHtml: agent output is untrusted and must never reach
innerHTML as raw markup
- add src/test/toolcallcontent.check.js, wired into pretest
ponytail: image/resource blocks render as a [type] label rather than being
displayed. Replace with real rendering when a caller needs it.
|
Update: #70 already targets this issue Opened this before checking the full open-PR list — turns out Both fixes drop the same root cause: Where they differ:
The substantive gap is the variant coverage and the missing test. #70 covers On the Happy to close this if #70 is preferred — no attachment either way. The |
|
Correction to the above: I wrote So the real gap is narrower than I stated: #70 has no automated regression test, whereas this PR adds 16 assertions run from |
|
Closing in favour of #70, which is further along (opened 2026-09-17, collapsible layout, mock agent, CHANGELOG). This adds a variant-coverage gap and 16 automated assertions that #70 lacks, but both PRs edit the same functions in ChatWebviewProvider.ts (addToolCallDOM, addToolCallInline, updateToolCall) and will conflict on merge. Two conflicting PRs for one issue is worse than one good one. The two findings worth keeping are both posted on #70: the diff/terminal/locations fallthrough that renders as an empty block, and the empty-text falsy bug. If #70 needs a test, the check is at https://github.com/thabs1234/vscode-acp/tree/fix/tool-call-content/src/test/toolcallcontent.check.js and rebase is trivial. |
Fixes #69
tool_callupdates arrive from ACP with the agent's actual output incontent, but the handler only forwardedtoolCallId,titleandstatus.Every tool result was silently dropped, so a chat transcript showed tool
names and statuses but none of what the tool produced.
ACP wraps the payload one level deep —
ToolCallContent[]with each entry ofthe form
{ type: 'content', content: ContentBlock }. The obvious fix ofreading
ContentBlock[]directly returns nothing, which is worth calling outbecause it looks correct.
Changes:
renderToolContent()flattens the nested shape and also covers thediff,terminalandlocationsvariants, rather than assuming text is the onlydata an agent can send
contentis threaded throughaddToolCall/updateToolCalland both thetool_callandtool_call_updatedispatch pathscontentreplaces the stored text. An update that omitscontentkeeps whatis already on screen instead of blanking it.
contentis persisted inchatHistoryso reloading a session does notdiscard it again
escapeHtmlhelper. Tool output isagent-controlled and must not reach
innerHTMLas raw markup.Verification:
src/test/toolcallcontent.check.jscovers the nested shape, empty andabsent content, the
diff/terminal/ unknown variants, multiple blocks,falsy-but-valid text values, and asserts content is escaped before insertion
pretest;npm run pretestpasses (typecheck, webpack, eslint)One judgement call worth review: image and resource blocks render as a
[type]label instead of being displayed. Nothing in the ACP spec or theissue asks for inline image rendering, so this is deliberately left as a label
rather than pulling in a new dependency.