Skip to content

Trace retries on one model span in Python and Codex - #6144

Open
markstuart-oai wants to merge 46 commits into
feat/simple-codexfrom
feature/logical-model-call-events
Open

markstuart-oai wants to merge 46 commits into
feat/simple-codexfrom
feature/logical-model-call-events

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Merge options — One squash of this PR for #6106 and the tracing changes together. For separate squashes, #6106 first, then a branch update here against the resulting commit. Review just the follow-up. Draft user guide in #6107.

With operation_detail omitted, a Runner retry has been increasing the model-call count. Enabling content capture has also been changing the SDK span type.

Python Responses and embedded Codex have been producing the same trace across default, "metadata" and "content" settings in the new parity tests.

turn
├─ response                  HTTP 500, then success
│  └─ event                  openai.agents.model.retry, attempt 2
└─ lookup                    tool execution
turn
└─ response                  new input with the tool result
Surface Behavior
SDK One response span per logical Responses or Codex call, including backoff. One generation for a Chat Completions call.
OpenTelemetry One chat span with openai.agents.model.retry events and an openai.agents.model.attempt attribute.
Approvals A function span with a paused or rejected outcome. A separate span at execution after approval.
Capture operation_detail for payload selection only. Existing SDK-visible fields by default, OTel metadata by default, bounded payloads with "content". Capture veto via trace_include_sensitive_data=False.

The Codex tracing patch has been exposing the submitted input, transport outcome and start of authorized tool execution. 68 added and 7 removed Core lines in total, 12 net lines beyond #6106. The SDK binding has been limiting copies at the source. Python has been grouping attempts, creating spans and exporting events. Upstreaming and removal guide

Compatibility

Consumers counting attempts have been able to use span.span_data.operation.retry_timestamps. The SDK has been keeping up to 128 retry observations per call. Retries reported together have been sharing one timestamp. Query change for detailed Responses and Codex spans from generation to response.

Test plan

  • 18 installed Linux wheel cases across both Runner entry points, both providers and all capture settings. One HTTP retry, a dropped stream, a native tool and a Python callback. Separate checks for the privacy veto and explicitly authorized replay after a timeout.
  • Six decoded OTLP HTTP traces for both providers under all three settings. One retry event on the first of two model calls, matching parent links and no default payload.
  • Two upstream Codex regressions (HTTP and WebSocket) with the tracing patch alone. All 26 Rust binding tests and the full SDK verification script.

Checks

  • Independent code review
  • Installed-wheel parity and collector output
  • .agents/skills/code-change-verification/scripts/run.sh

…estart (#6115)

* Resume pending Codex commands and file edits after a worker restart

* Reject repeat execution under an already completed native approval
@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners November 21, 2026 15:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T16:03:10.902009Z a188ba4 New commits
🔒 Security Review ✅ Completed 2026-11-21T16:03:43.245725Z a188ba4 New commits
ℹ️ 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.

@jbeckwith-oai jbeckwith-oai left a comment •

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.

Approved after comprehensive static review and independent Python and native tracing reviews. Reviewed the follow-up to #6106 at 8ede460: logical retry grouping and span lifetime, usage aggregation, capture revocation, OpenAI raw-response retry observation, HTTP/WebSocket request identity and Core callback ordering, native source bounds, approval outcomes, and OpenTelemetry retry events and payload selection. The inherited #6106 changes were reviewed separately. No actionable findings.

Reviewed the provider/stream/capture-mode parity matrix, timeout replay and changed-request cases, privacy veto, and installed-wheel workflow. Responses and Codex now use response spans across capture modes; Chat Completions retains generation spans. Retry observations are capped at 128 and do not imply a hard request or cost budget.

Hosted CI completed: 33 passed, 4 skipped. Static review only; no candidate code, local tests, or native builds executed.

@jbeckwith-oai jbeckwith-oai left a comment •

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.

Approved after static incremental review and an independent second review. This carries forward the terminal command-result fix already reviewed in #6106: restore requires the matching call, an exited process and no live handle; the resolver uses that result rather than depending on a delayed exit event. Reviewed the error paths and delayed-exit installed-wheel fixture, and verified the four incremental patches match the previously reviewed fix. No new actionable findings.

Hosted CI completed: 33 passed, 2 skipped. Static review only; no candidate code, local tests or native builds executed.

This branch has not been deployed

No deployments
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