Conversation
This was referenced Apr 16, 2026
8c25372 to
8e29b28
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
After defining the Responses API call schema, the analytics client and reducer need to know how to turn a core-facing input into the final backend event. This PR wires that schema into the existing analytics pipeline while keeping Responses item processing inside the analytics crate.
What changed
This adds
AnalyticsEventsClient::track_responses_api_call, which accepts aCodexResponsesApiCallInput, carries the precomputed item metadata and item counts into aCustomAnalyticsFact::ResponsesApiCall, derives token fields, and records the custom fact.The reducer now ingests
CustomAnalyticsFact::ResponsesApiCalland emits acodex_responses_api_call_eventonly when the required context is available: connection metadata, thread lifecycle metadata, turn metadata, and resolved turn config. The emitted event is enriched with thread source, initialization mode, parent/subagent fields, client/runtime metadata, model/provider, and reasoning effort in the same style as the existing turn analytics events.This also adds serialization and reducer tests for the new event. The tests cover the backend payload shape and verify that a custom Responses API call fact is reduced into the expected event once the normal analytics prerequisites have been observed.
Verification
Verified with
cargo test -p codex-analytics, including the new serialization and reducer coverage forcodex_responses_api_call_event.Stack created with Sapling. Best reviewed with ReviewStack.