feat: record provider_item_id for tool usage - #26856
Merged
Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
dannykopping
force-pushed
the
dk/record-all-tool-types
branch
from
June 30, 2026 11:08
d48ce9d to
f2e690f
Compare
dannykopping
force-pushed
the
dk/tool-usage-provider-item-id
branch
from
June 30, 2026 11:08
3665432 to
676bc3e
Compare
dannykopping
force-pushed
the
dk/record-all-tool-types
branch
from
June 30, 2026 12:12
f2e690f to
a876e19
Compare
dannykopping
force-pushed
the
dk/tool-usage-provider-item-id
branch
from
June 30, 2026 12:12
676bc3e to
114508d
Compare
dannykopping
marked this pull request as ready for review
June 30, 2026 12:16
pawbana
approved these changes
Jul 2, 2026
|
|
||
| // TestRecordToolUsageProviderItemID exercises the RecordToolUsage RPC against a | ||
| // real database and confirms that the item_id (the Responses output item's | ||
| // unique id) is persisted independently of the tool_call_id correlation key, |
Contributor
There was a problem hiding this comment.
I'm not exactly sure what this test checks.
I don't understand why checking for lack of correlation between item_id and tool_call_id is important but maybe I'm missing something.
Contributor
Author
There was a problem hiding this comment.
I clarified the intent a bit. It's just there to show that the two fields can be tracked separately since they serve different purposes.
dannykopping
force-pushed
the
dk/tool-usage-provider-item-id
branch
from
July 6, 2026 06:55
114508d to
9493f3a
Compare
dannykopping
force-pushed
the
dk/record-all-tool-types
branch
from
July 6, 2026 06:55
a876e19 to
3c594fa
Compare
dannykopping
force-pushed
the
dk/tool-usage-provider-item-id
branch
from
July 6, 2026 07:09
9493f3a to
eefaf25
Compare
dannykopping
changed the base branch from
dk/record-all-tool-types
to
graphite-base/26856
July 6, 2026 07:10
Plumbs the Responses output item id through to the aibridge tool usage record so it is captured independently of the tool_call_id correlation key. Hosted tools (web_search_call, etc.) only have an item id; agentic tools have both. Conflating them caused data-consistency ambiguity. - migration 000534: add nullable provider_item_id column - proto: add item_id field 11 to RecordToolUsageRequest - server handler: persist item_id and add it to structured logging - translator: map ToolUsageRecord.ItemID to proto ItemId - test: real-DB round-trip asserting item_id persists for both hosted and agentic tools, independently of provider_tool_call_id
dannykopping
force-pushed
the
graphite-base/26856
branch
from
July 6, 2026 07:10
3c594fa to
08a6359
Compare
dannykopping
force-pushed
the
dk/tool-usage-provider-item-id
branch
from
July 6, 2026 07:10
eefaf25 to
7e89ba2
Compare
Signed-off-by: Danny Kopping <danny@coder.com>
dannykopping
force-pushed
the
dk/tool-usage-provider-item-id
branch
from
July 6, 2026 07:11
7e89ba2 to
14dcac9
Compare
Contributor
Author
Merge activity
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Plumbs the Responses output item id (added as
ToolUsageRecord.ItemIDin #26855) through to the database, captured independently of theprovider_tool_call_idcorrelation key. Hosted tools (web_search_call, etc.) only have an item id; agentic tools have both.provider_item_idis specific to the OpenAI Responses API; it stays empty for chat completions and Anthropic messages, which have no separate item id.Changes
000534: nullableprovider_item_idcolumn onaibridge_tool_usages.item_idfield 11 onRecordToolUsageRequest.provider_item_idand adds it to structured logging.ToolUsageRecord.ItemIDto the proto field.Tests
TestRecordToolUsageProviderItemID: real-database round-trip assertingprovider_item_idpersists for both hosted and agentic tools, independently ofprovider_tool_call_id.Stacked on #26855. Linear: AIGOV-96
This PR was produced by opencode (agent) using the
anthropic/claude-opus-4-8model, under human direction and review.