Skip to content

feat(api): add subagent token usage - #4373

Open
dpiet-oai wants to merge 1 commit into
mainfrom
castiron/promotions/pr-475
Open

dpiet-oai wants to merge 1 commit into
mainfrom
castiron/promotions/pr-475

Conversation

@dpiet-oai

Copy link
Copy Markdown
Contributor

Summary

Read best-effort token usage for a subagent when listing or retrieving it.

Changes

  • Expose optional token usage with input, output, cache, and reasoning counts.
  • Clarify how subagent usage contributes to session and root turn totals.

@dpiet-oai
dpiet-oai requested a review from a team as a code owner December 4, 2026 20:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 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-12-05T05:01:25.497937Z 42a9263 New commits
🔒 Security Review ✅ Completed 2026-12-05T05:01:13.677005Z 42a9263 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.

Reviewed 51a3c9f, including independent static review. Verified the complete file tree matches the previously approved internal candidate and reviewed the public diff: optional nullable subagent token usage, serialization and model integration, list/retrieve coverage for populated/null/omitted usage, and session/root-turn aggregation documentation. No actionable findings.

Hosted CI is still running with no failures observed. No local tests or candidate code were run.

@dpiet-oai
dpiet-oai force-pushed the castiron/promotions/pr-475 branch from 51a3c9f to e76b663 Compare December 5, 2026 01:00
@dpiet-oai
dpiet-oai requested a review from a team December 5, 2026 01:01

@markstuart-oai markstuart-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.

I've been checking the optional usage field and the tests for populated, null, and omitted values on list and retrieve.

@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 re-review and an independent second review. The entire file tree, including file modes, exactly matches the approved internal version. The feature diff preserves optional/nullable subagent usage, nested token counts, accounting documentation, and populated/null/omitted response coverage. No actionable findings. Hosted CI has no observed failures; all checks completed successfully or skipped as applicable. No candidate code or local tests were executed.

Castiron-Internal-PR: openai/openai-python-internal#475
Castiron-Source-SHA: f32572bc154b36c2f18f808cc1a9f26f117a8d61
Castiron-Public-Base-SHA: 3098933
@dpiet-oai
dpiet-oai force-pushed the castiron/promotions/pr-475 branch from e76b663 to 42a9263 Compare December 5, 2026 05:00
@dpiet-oai
dpiet-oai requested a review from a team December 5, 2026 05:01

@markstuart-oai markstuart-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.

The generated subagent usage change matches the reviewed internal SDK patch across every changed file. This baseline update preserves the optional usage field and the list and retrieve regression coverage.

Static review only.

codex://threads/01a1c7cc-3ae0-7900-8710-5a1fbeb062d5

@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.

Re-reviewed this exact commit after the baseline refresh, including an independent static review. No actionable findings. The optional nullable subagent usage model, session/root-turn accounting documentation, and populated/null/omitted list/retrieve coverage remain intact. Feature source and tests are unchanged from the previously reviewed revision; refreshed files integrate the current base and generation metadata.

Hosted CI at review time: 17 success, 9 skipped. No candidate code or tests were run locally.

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.

4 participants