Skip to content

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

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

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

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:21
@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-06T07:31:26.340568Z 12dcd3a New commits
🔒 Security Review ✅ Completed 2026-12-06T07:31:51.726574Z 12dcd3a 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 186e7da, 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-539 branch from 186e7da to e53f4f6 Compare December 4, 2026 23:01
@dpiet-oai
dpiet-oai requested a review from a team December 4, 2026 23:01

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

No actionable findings after static re-review of the refreshed promotion, including independent verification. Every file blob and mode at this commit matches the already reviewed and approved internal source https://github.com/openai/openai-java-internal/pull/539 at a1bba2a94134ca68e3c899859771a3fe669b8bdc. The current PR retains the same 13-file subagent usage change on the updated public baseline; no new feature behavior was introduced. Hosted CI is still running with no failures observed. No candidate code or tests were executed locally.

@dpiet-oai
dpiet-oai force-pushed the castiron/promotions/pr-539 branch from e53f4f6 to e7f4a2a 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; still pending: CI / build, OkTest. No candidate code or local tests were executed.

@dpiet-oai
dpiet-oai force-pushed the castiron/promotions/pr-539 branch from e7f4a2a to a4bd24c Compare December 5, 2026 02:01
@dpiet-oai
dpiet-oai requested a review from a team December 5, 2026 02:01

@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 the refreshed head with an independent reviewer. No actionable findings. The base update preserves the approved optional subagent usage implementation and wire regression tests; the overlapping AgentSession changes correctly retain the memory/history builder overloads from main. Reviewed schema and generated metadata integration as well.

Static review only; no local tests run. Hosted lint, build-logic, version-matrix, and dependency-submission checks passed; the main build and OkTest are still running.

@dpiet-oai
dpiet-oai force-pushed the castiron/promotions/pr-539 branch from a4bd24c to 0d22cca 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: 5 success, 8 in_progress. No candidate code or tests were run locally.

Castiron-Internal-PR: openai/openai-java-internal#539
Castiron-Source-SHA: 0ad8482e11bfa846981a1d87136889b9f13d5ed9
Castiron-Public-Base-SHA: 95db934
@dpiet-oai
dpiet-oai force-pushed the castiron/promotions/pr-539 branch from 0d22cca to 12dcd3a Compare December 6, 2026 07:30
@dpiet-oai
dpiet-oai requested a review from a team December 6, 2026 07:30

@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 optional subagent usage field matches the schema and reuses the existing token usage model. The list and retrieve tests cover populated, null, and omitted usage.

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