Skip to content

[codex-analytics] Track CodexErr details in turn analytics#25707

Merged
rhan-oai merged 1 commit into
mainfrom
rhan/codex-turn-err
Jun 2, 2026
Merged

[codex-analytics] Track CodexErr details in turn analytics#25707
rhan-oai merged 1 commit into
mainfrom
rhan/codex-turn-err

Conversation

@rhan-oai
Copy link
Copy Markdown
Collaborator

@rhan-oai rhan-oai commented Jun 1, 2026

Summary

  • add analytics-only CodexErr telemetry to codex_turn_event while leaving existing turn_error unchanged
  • record terminal CodexErr facts from core immediately before the existing turn error event is sent
  • emit source-truth codex_error_* fields for downstream analytics, including the raw CodexErr::InvalidRequest(String) message as codex_error_subreason

Validation

  • just test -p codex-analytics
  • attempted just test -p codex-core, but the local run timed out across unrelated integration suites in this environment and is not being used as validation

@rhan-oai rhan-oai changed the title [codex] Track CodexErr details in turn analytics [codex-analytics] Track CodexErr details in turn analytics Jun 1, 2026
@rhan-oai rhan-oai force-pushed the rhan/codex-turn-err branch 7 times, most recently from 1b568c2 to e27c689 Compare June 2, 2026 00:40
@rhan-oai rhan-oai marked this pull request as ready for review June 2, 2026 00:58
@rhan-oai rhan-oai requested a review from a team as a code owner June 2, 2026 00:58
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e27c6892e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/analytics/src/facts.rs Outdated
Self {
kind: error.into(),
subreason: match error {
CodexErr::InvalidRequest(message) => Some(message.clone()),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound invalid-request telemetry payloads

When a terminal CodexErr::InvalidRequest comes from an HTTP 400 response, codex-api/src/api_bridge.rs constructs it from the entire response body (CodexErr::InvalidRequest(body_text)), and this new code copies that string verbatim into codex_error_subreason. For provider/API 400s with a large or diagnostic response body, the turn analytics event can become unexpectedly large and may include raw upstream error contents; please cap and sanitize/classify this value before adding it to telemetry.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

@owenlin0 owenlin0 Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh this is a good call out, let's put a cap on max size and truncate?

Fatal,
Io,
Json,
#[cfg(target_os = "linux")]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could probably drop these annotations? as in, we could define them for all OSes but only linux would ever emit it

I think we try to avoid these OS-specific annotations unless they're absolutely necessary

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm nvm, codex says we need these since these variants don't exist at all in macos/windows builds. disregard

@rhan-oai rhan-oai force-pushed the rhan/codex-turn-err branch 2 times, most recently from 6328cb4 to 34cde64 Compare June 2, 2026 18:00
@rhan-oai rhan-oai force-pushed the rhan/codex-turn-err branch from 34cde64 to 4c9529f Compare June 2, 2026 18:24
@rhan-oai rhan-oai merged commit 8e4b92d into main Jun 2, 2026
46 of 47 checks passed
@rhan-oai rhan-oai deleted the rhan/codex-turn-err branch June 2, 2026 18:40
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants