Files
coder/aibridge/fixtures
Danny Kopping 08a6359cac feat: record all tool call types (#26855)
## 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.*
2026-07-06 09:10:21 +02:00
..

These fixtures were created by adding logging middleware to API calls to view the raw requests/responses.

...
opts = append(opts, option.WithMiddleware(LoggingMiddleware))
...

func LoggingMiddleware(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
    reqOut, _ := httputil.DumpRequest(req, true)

    // Forward the request to the next handler
    res, err = next(req)
    fmt.Printf("[req] %s\n", reqOut)

    // Handle stuff after the request
    if err != nil {
        return res, err
    }

    respOut, _ := httputil.DumpResponse(res, true)
    fmt.Printf("[resp] %s\n", respOut)

    return res, err
}