Skip to content

Log upstream inline image limit rejections#15888

Open
fjord-oai wants to merge 1 commit intomainfrom
fjord/original_image_size_warn-sync---4i5oof0m2upvfe
Open

Log upstream inline image limit rejections#15888
fjord-oai wants to merge 1 commit intomainfrom
fjord/original_image_size_warn-sync---4i5oof0m2upvfe

Conversation

@fjord-oai
Copy link
Copy Markdown
Contributor

@fjord-oai fjord-oai commented Mar 26, 2026

Summary

Add observability for upstream inline image limit rejections.

This change detects Responses API bad requests that look like inline image byte-limit or image-count-limit failures, logs them with structured fields, and records a Statsig-backed counter so we can monitor how often this is happening before the graceful local handling lands.

Changes

  • Added inline_image_request_limit_bad_request_observation(...) in core/src/api_bridge.rs to recognize upstream bad-request copy for:
    • inline image byte limit
    • image count limit
  • Added structured warning logs in map_api_error(...) for those upstream rejections, including:
    • bytes_exceeded
    • images_exceeded
    • response_status
    • response_body
  • Added client-side metric emission in core/src/client.rs when an upstream request is rejected for an inline image limit:
    • metric: codex.responses.inline_image_limit
    • outcome: upstream_rejected
    • tags: bytes_exceeded, images_exceeded
  • Covered both the parser and metric emission with focused tests in:
    • core/src/api_bridge_tests.rs
    • core/src/client_tests.rs

git stack

@fjord-oai fjord-oai force-pushed the fjord/original_image_size_warn-sync---4i5oof0m2upvfe branch from 1546450 to 50877ee Compare March 26, 2026 17:36
@fjord-oai
Copy link
Copy Markdown
Contributor 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: 50877ee692

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

@fjord-oai fjord-oai force-pushed the fjord/original_image_size_warn-sync---4i5oof0m2upvfe branch from 50877ee to e5d5aa8 Compare March 26, 2026 19:06
@fjord-oai
Copy link
Copy Markdown
Contributor 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

client
.compact_input(&payload, extra_headers)
.await
.map_err(map_api_error)

P2 Badge Emit inline-image limit metric for compact requests

compact_conversation_history sends prompt.get_formatted_input() (which can contain inline images) to /responses/compact, but errors are only map_api_error-mapped and returned. Unlike streaming paths, this method never calls record_upstream_inline_image_request_limit_observation, so upstream byte/count-limit rejections are not counted in codex.responses.inline_image_limit.

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

@fjord-oai fjord-oai force-pushed the fjord/original_image_size_warn-sync---4i5oof0m2upvfe branch from e5d5aa8 to f9d681d Compare March 26, 2026 19:41
@fjord-oai
Copy link
Copy Markdown
Contributor 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: f9d681d7c3

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

@fjord-oai fjord-oai force-pushed the fjord/original_image_size_warn-sync---4i5oof0m2upvfe branch 2 times, most recently from ea904b2 to 5905fbc Compare March 26, 2026 20:21
@fjord-oai
Copy link
Copy Markdown
Contributor 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".

@fjord-oai fjord-oai force-pushed the fjord/original_image_size_warn-sync---4i5oof0m2upvfe branch from 5905fbc to 7a79e98 Compare March 28, 2026 18:54
@fjord-oai fjord-oai force-pushed the fjord/original_image_size_warn-sync---4i5oof0m2upvfe branch 7 times, most recently from 1ab1f71 to 01e2694 Compare March 30, 2026 23:26
git-stack-id: fjord/original_image_size_warn-sync---4i5oof0m2upvfe
git-stack-title: Log upstream inline image limit rejections
@fjord-oai fjord-oai force-pushed the fjord/original_image_size_warn-sync---4i5oof0m2upvfe branch from 01e2694 to 0771a56 Compare March 30, 2026 23:49
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.

2 participants