mirror of
https://github.com/coder/coder.git
synced 2026-09-23 05:43:53 +08:00
## Summary The Responses interceptor previously recorded only `function_call` and `custom_tool_call` output items, so interceptions that did real work via built-in tools (`web_search_call`, `computer_call`, `shell_call`, `mcp_call`, etc.) recorded no tool usage at all. `recordNonInjectedToolUsage` now whitelists every tool-call output type and records it, with the tool name falling back to the item type when none is set. `ToolUsageRecord` also gains an `ItemID` field so the two distinct Responses identifiers are captured without conflation (addresses review feedback on coder/aibridge#273): - `ItemID`: the output item's unique `id` (always present). - `ToolCallID`: the `call_id` correlation id (empty for hosted tools the provider runs server-side). ## Tests - Extends `TestRecordToolUsage` with cases for the new hosted/agentic tool types. - Adds blocking and streaming `web_search` fixtures (scrubbed of credentials and identifying metadata) plus `TestResponsesOutputMatchesUpstream` cases asserting a hosted tool records with an empty `ToolCallID` and a populated `ItemID`. Linear: AIGOV-96 --- *This PR was produced by opencode (agent) using the `anthropic/claude-opus-4-8` model, under human direction and review.*