Skip to content

fix(critpt): include both turns in token usage - #3580

Merged
bxyu-nvidia merged 1 commit into
mainfrom
codex/critpt-total-token-usage
Sep 21, 2026
Merged

bxyu-nvidia merged 1 commit into
mainfrom
codex/critpt-total-token-usage

Conversation

@Kipok

@Kipok Kipok commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

CritPt currently reports only the formatting turn's token usage, dropping the solve turn. Sum both turns into the existing response usage so the standard input, output, and total token metrics cover the complete task. This follows Artificial Analysis's methodology, which includes both solving and answer parsing.

The change reuses the shared usage accumulator and adds no metrics or configuration. If either turn omits usage, report null rather than a partial total. The second-turn output still goes to the same verifier; prompts and scoring are unchanged. Existing saved rollouts retain their old counts, so historical second-turn-only token metrics are not directly comparable.

No separate issue is needed for this focused accounting bug. The original integration and discussion in #1588 were reviewed. The agent README documents the corrected usage semantics.

Validation (server-only change):

  • gym env test +entrypoint=responses_api_agents/critpt_agent +should_validate_data=true — 27 passed.
  • python -m pytest tests/unit_tests/test_openai_utils.py -o addopts= -q — 242 passed.
  • python -m pytest resources_servers/critpt/tests -o addopts= -q — 57 passed outside the sandbox (the sandboxed TestClient hung).
  • pre-commit run --all-files and git diff --check — passed.
  • New regression cases checked against the original agent: six fail on the original behavior and all pass with the fix. Coverage includes combined counts, absent usage, optional detail counts, and preservation of the second-turn answer.
  • Live two-turn synthetic physics smoke through the agent, model adapter, resource verifier, and standard token extraction: output tokens 64 + 29 = 93, input tokens 40 + 165 = 205, total tokens 104 + 194 = 298. Inspected the formatted answer and verified the returned output matches turn two. The official AA scoring call was replaced with a local synthetic-answer stub; no official grading quota or full benchmark run was used.

@Kipok Kipok added bug Something isn't working area:agent Agent harnesses and Responses API agent behavior needs-review PR is ready for code review and waiting on a reviewer labels Sep 21, 2026
@copy-pr-bot

copy-pr-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@bxyu-nvidia

Copy link
Copy Markdown
Contributor

/ok to test 4fd1e74

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team September 21, 2026 23:01
@bxyu-nvidia
bxyu-nvidia merged commit 10a21f2 into main Sep 21, 2026
42 checks passed
@bxyu-nvidia
bxyu-nvidia deleted the codex/critpt-total-token-usage branch September 21, 2026 23:10

This branch was previously deployed

1 inactive deployment
public — 4fd1e74c Deployed Sep 21, 2026 by copy-pr-bot[bot] via release / finalize / notify #3396
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants