Skip to content

Deduplicate large tool output strings in rollout traces - #62407

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/a003197ea998639b6c2ae27f408990c0186406bd
Nov 19, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/a003197ea998639b6c2ae27f408990c0186406bd

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Deduplicate large tool output strings in rollout traces

Why

Repeated tool output, such as the same image returned in several results,
can consume the trace bundle budget. When output bytes are unavailable,
the surrounding result can still carry terminal metadata and conversation
links.

What changed

  • Store JSON string values of at least 64 KiB, measured after encoding,
    separately from their tool result or runtime event. Identical encoded
    values share one record per bundle, while each occurrence retains its
    position and complete captures reconstruct the original JSON bytes.
  • Keep separate compression shards open for content and surrounding
    records. Budget for the serialized event and fall back to a single
    capped or omitted payload when the split layout or its references
    exceed the applicable limit.
  • Track missing values separately from literal null so reduction can
    preserve surviving terminal metadata and keep tool output IDs attached
    to their original items.

Testing

Add regression tests for shared image and text payloads, byte-for-byte
reconstruction, recording completion under tight bundle limits, and
reduction with missing output.

## Why

Repeated tool output, such as the same image returned in several results,
can consume the trace bundle budget. When output bytes are unavailable,
the surrounding result can still carry terminal metadata and conversation
links.

## What changed

- Store JSON string values of at least 64 KiB, measured after encoding,
  separately from their tool result or runtime event. Identical encoded
  values share one record per bundle, while each occurrence retains its
  position and complete captures reconstruct the original JSON bytes.
- Keep separate compression shards open for content and surrounding
  records. Budget for the serialized event and fall back to a single
  capped or omitted payload when the split layout or its references
  exceed the applicable limit.
- Track missing values separately from literal `null` so reduction can
  preserve surviving terminal metadata and keep tool output IDs attached
  to their original items.

## Testing

Add regression tests for shared image and text payloads, byte-for-byte
reconstruction, recording completion under tight bundle limits, and
reduction with missing output.

GitOrigin-RevId: a003197ea998639b6c2ae27f408990c0186406bd
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/a003197ea998639b6c2ae27f408990c0186406bd branch from dc44c1f to 508a429 Compare November 19, 2026 02:41
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-19T02:41:26.363307Z dc44c1f PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 508a429 into main Nov 19, 2026
10 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/a003197ea998639b6c2ae27f408990c0186406bd branch November 19, 2026 02:41
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 19, 2026

This branch was previously deployed

1 inactive deployment
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.

8 participants