Conversation
This was referenced Apr 16, 2026
3e56a65 to
5ea466f
Compare
rhan-oai
commented
Apr 21, 2026
| AppUsed(CodexAppUsedEventRequest), | ||
| HookRun(CodexHookRunEventRequest), | ||
| Compaction(Box<CodexCompactionEventRequest>), | ||
| #[allow(dead_code)] |
Collaborator
Author
There was a problem hiding this comment.
to pass lint tests, removed in next commit
c220805 to
5ea466f
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
We need a Responses API call analytics event that can support context-window-health analysis without logging raw prompt, tool, or model content. This PR adds the analytics-side event schema and item-metadata extraction primitives that describe the shape and approximate size of the
ResponseItems involved in a Responses API call.What changed
This adds the
codex_responses_api_call_eventrequest shape, including thread and turn identifiers, thread lifecycle metadata, client/runtime metadata, Responses API identifiers, model metadata, terminal status, timing, token counts, and per-item metadata.It introduces
CodexResponsesApiCallInput,CodexResponsesApiCallFact,CodexResponsesApiCallStatus,CodexResponsesApiItemMetadata,CodexResponsesApiItemPhase, andCodexResponseItemTypeincodex-rs/analytics/src/facts.rs. The public API intentionally exposes only the core-facing input/status types fromcodex_analytics; the event fact and item metadata remain analytics-internal.It also adds
codex-rs/analytics/src/response_items.rs, which maps protocolResponseItems into metadata-only analytics records. The mapper captures fields such as item phase, item index, response item type, role, status, message phase, call id, tool name, payload byte size, text part count, and image part count. It avoids raw content while preserving enough structure to analyze context-window composition.Finally, this adds small serialization/byte helpers in
codex-rs/analytics/src/lib.rsthat are shared by the response item metadata mapper.Verification
Verified with
cargo test -p codex-analytics, which covers the new response item metadata mapping tests.Stack created with Sapling. Best reviewed with ReviewStack.