Skip to content

Cap diagnostic log payloads#23180

Draft
etraut-openai wants to merge 2 commits into
mainfrom
etraut/cap-log-payloads
Draft

Cap diagnostic log payloads#23180
etraut-openai wants to merge 2 commits into
mainfrom
etraut/cap-log-payloads

Conversation

@etraut-openai
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai commented May 17, 2026

Why

This PR caps risky diagnostic payloads before emitting tracing events, so every log sink receives a bounded value that's limited to 16K (keeping head and tail and truncating in the middle).

What Changed

This adds codex-utils-log, a small utility crate for rendering diagnostic payloads with a bounded head/tail preview. Oversized values include original_bytes, shown_bytes, omitted_bytes, and a sha256 digest so logs remain useful for correlation without storing the whole payload.

It also caps no-newline MCP stderr buffering before those bytes are logged.

Affected Log Points

  • MCP client notifications: logging/message data/logger plus cancelled/progress/resource-update fields.
  • MCP stderr: local stdio and executor-backed stderr, including no-newline stderr streams.
  • Core turn diagnostics: MCP tool-call errors, turn errors, submission debug logs, non-tool output item debug logs, and realtime conversation events.
  • App-server JSON-RPC/events: unexpected incoming notifications/responses/errors, outbound server notifications, and send/callback errors that can include queued payloads.
  • Codex API wire diagnostics: Responses SSE/websocket payload logs, realtime call/websocket payload logs, unsupported/parse-failure realtime event payloads, and model-list decode failure bodies.
  • TUI/app diagnostics: turn diff logs, pasted image path logs, panic hook payloads, app-server enqueue/send errors, and markdown stream delta traces.
  • Auth/analytics response bodies: token refresh failures, server error parsing, and analytics event request failure bodies.

Verification

  • cargo test -p codex-utils-log
  • cargo test -p codex-rmcp-client stderr_log
  • cargo check -p codex-core -p codex-tui -p codex-app-server -p codex-login -p codex-analytics
  • just fix -p codex-utils-log -p codex-rmcp-client -p codex-core -p codex-tui -p codex-app-server -p codex-api -p codex-login -p codex-analytics
  • just bazel-lock-check

@etraut-openai etraut-openai force-pushed the etraut/cap-log-payloads branch from 643ddff to 88b816c Compare May 17, 2026 18:45
@etraut-openai
Copy link
Copy Markdown
Collaborator Author

@codex review

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: 83e56dfc5e

ℹ️ 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/app-server/src/outgoing_message.rs Outdated
Comment thread codex-rs/rmcp-client/src/logging_client_handler.rs Outdated
Comment thread codex-rs/utils/log/src/lib.rs Outdated
@etraut-openai etraut-openai force-pushed the etraut/cap-log-payloads branch from 83e56df to a73999a Compare May 17, 2026 19:17
@etraut-openai
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant