Skip to content

fix(nooa): declare the terminal response so token-id capture attributes NOOA rollouts - #5180

Closed
furgalep wants to merge 150 commits into
NVIDIA-NeMo:codex/nooa-conformancefrom
furgalep:fix/nooa-terminal-response-id
Closed

furgalep wants to merge 150 commits into
NVIDIA-NeMo:codex/nooa-conformancefrom
furgalep:fix/nooa-terminal-response-id

Conversation

@furgalep

Copy link
Copy Markdown
Collaborator

fix(nooa): declare the terminal response so token-id capture attributes NOOA rollouts

Branch: furgalep/Gym fix/nooa-terminal-response-id (base: NVIDIA-NeMo/Gym PR #4813 head c2fff085). Two commits; the first is Gym core and can be cherry-picked to main on its own.

What changed and why

Token-id capture decides which captured chain the verifier scored by joining the graded response to one captured call: an explicit terminal call id, a declared terminal_response_id, the response id, the last model-authored item id, or content. With no attribution, only a rollout with exactly one chain and no retried final call is delivered; anything else is masked.

The NOOA adapter's response ends with a synthetic final message (NOOA agents return structured values, not a model-authored message), which defeats every content witness. A rollout whose agent spawned a child, or retried its final call, therefore trained on nothing. Gym's own capture code confirms it on an Atom-shaped rollout (root plus child chain, all token ids present): masked with the synthetic message, delivered once a terminal is declared, single-chain rollouts delivered only by the fallback.

  1. Core (nemo_gym/token_id_capture/delivery.py): the declared terminal is read from response.metadata as well as from the rollout record. A harness on the legacy /run path sets the record field itself (swe_agent does); a harness behind an agent-session environment can only speak through its response, and the environment copies nothing from response metadata to the record, so no session harness could declare a terminal before. The record field wins when both are present.
  2. NOOA adapter (observability.py): the projection sets metadata.terminal_response_id to the served id of the root invocation's last completed model call. Children's later calls do not displace it, and the verifier-facing synthetic message stays; the declaration survives it.

Validation

  • tests/unit_tests/test_terminal_attribution.py (+2): a terminal declared only in response metadata attributes and delivers (method declared); the record field takes precedence over metadata.
  • responses_api_agents/nooa_agent/tests/test_observability.py (+2): root plus two child invocations where a child makes the rollout's last call declares the root's last response; the synthetic final message leaves the declaration intact; no served response, no declaration.
  • Full responses_api_agents/nooa_agent/tests, test_terminal_attribution.py, test_token_id_capture.py: all passed. Pre-commit passed.
  • Reproduction script for the three attribution cases: ~/dev/gym-thin-handoff-20261022/evidence-20261028-atom-adapter/attribution_evidence.py.

Rollout evidence

N/A: unit-level and capture-core level. A capture-enabled run (vLLM training config, token ids on, an Atom task with one child spawn) should show terminal_attribution.method: declared and mask_sample: false where it shows none and true today; that run is the gate for marking this ready.

Compatibility

Additive. Responses without the metadata key behave exactly as before. No change to what the verifier sees.

🤖 Generated with Claude Code

Signed-off-by: Nikhil Deshmudre <[email protected]>
(cherry picked from commit 0b083f2)
Signed-off-by: Nikhil Deshmudre <[email protected]>

NOOA-only rebuild of PR NVIDIA-NeMo#3850 from a25cb1c.

NOOA-only scope: shared infrastructure remains identical to main.

Signed-off-by: Nikhil Deshmudre <[email protected]>
Signed-off-by: Nikhil Deshmudre <[email protected]>

NOOA-only rebuild of PR NVIDIA-NeMo#3851 from 8ca3561.

NOOA-only scope: shared infrastructure remains identical to main.

Signed-off-by: Nikhil Deshmudre <[email protected]>
Require Resources-provided access, prepare the isolated runtime during seed, and stop and disconnect before returning close evidence. Retain failed setup and cleanup state for retry. No issue needed: session integration layer of the NOOA sandbox RFC. Validation: native and sandbox session tests passed; real sandbox model rollout in progress.

Signed-off-by: Nikhil Deshmudre <[email protected]>
(cherry picked from commit 79406b4)
Signed-off-by: Nikhil Deshmudre <[email protected]>

NOOA-only rebuild of PR NVIDIA-NeMo#3849 from c6d5441.

NOOA-only scope: shared infrastructure remains identical to main.

Signed-off-by: Nikhil Deshmudre <[email protected]>
Signed-off-by: Nikhil Deshmudre <[email protected]>
(cherry picked from commit b46ff42)
Signed-off-by: Nikhil Deshmudre <[email protected]>

NOOA-only rebuild of PR NVIDIA-NeMo#3845 from f4a2cbb.

NOOA-only scope: shared infrastructure remains identical to main.

Signed-off-by: Nikhil Deshmudre <[email protected]>

(cherry picked from commit c296204)
Signed-off-by: Nikhil Deshmudre <[email protected]>
Signed-off-by: Nikhil Deshmudre <[email protected]>

NOOA-only rebuild of PR NVIDIA-NeMo#4088 from 070c74a.

NOOA-only scope: shared infrastructure remains identical to main.

Signed-off-by: Nikhil Deshmudre <[email protected]>
(cherry picked from commit 49a8ff0)
Signed-off-by: Nikhil Deshmudre <[email protected]>
Adapt useful lifecycle, failure handling and NVIDIA gateway behavior
from Razvan Dinu's PR NVIDIA-NeMo#4291 (49b8daa)
on top of durable ordered NOOA assistant history.

Stop NOOA-owned workers before standard environment verification,
preserve terminal exceptions and failed-call evidence, isolate optional
summary failures, and leave unrecovered infrastructure failures ungraded.
Retain partial-result grading at execution limits and align active NOOA
pins, including controller bootstrap, at 19caab1.

Signed-off-by: Nikhil Deshmudre <[email protected]>
(cherry picked from commit 666d2ed)
Signed-off-by: Nikhil Deshmudre <[email protected]>
Preserve readable reasoning when NOOA renders edited turns into public
message dictionaries. Unscoped turns use their public fields instead of
letting a stale live raw response override the supplied history.

Add formatter and reconstructed-response regressions that verify exact
outgoing input and preserve original response evidence.

Signed-off-by: Nikhil Deshmudre <[email protected]>

NOOA-only rebuild of PR NVIDIA-NeMo#4351 from d511c3d.

NOOA-only scope: shared infrastructure remains identical to main.

Signed-off-by: Nikhil Deshmudre <[email protected]>

(cherry picked from commit 4b7ff71)
Signed-off-by: Nikhil Deshmudre <[email protected]>
furgalep and others added 2 commits October 29, 2026 08:11
…adata too

A harness on the legacy /run path declares its terminal response id on the
rollout record (swe_agent does). A harness behind an agent-session
environment can only speak through its response, and the environment copies
nothing from response metadata to the record, so no session-based harness
could declare a terminal: with a synthetic final message or a child's later
call, its rollouts fell to the strict single-chain policy and were masked.
Delivery now also reads terminal_response_id from response.metadata; the
record field wins when both are present.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Paul Furgale <[email protected]>
…rminal

The projection sets metadata.terminal_response_id to the served id of the
root invocation's last completed model call. Token-id capture attributes the
scored chain to it, so the synthetic final message the result projection
appends for NOOA's structured return values, and a child agent making the
rollout's last call, no longer leave the rollout unattributed and masked.
The verifier-facing message stays; the declaration survives it.

Validation: 1044 passed across responses_api_agents/nooa_agent/tests,
test_terminal_attribution.py and test_token_id_capture.py.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Paul Furgale <[email protected]>
@furgalep
furgalep force-pushed the fix/nooa-terminal-response-id branch from 7f5366a to 856aa21 Compare October 29, 2026 08:21
@furgalep

Copy link
Copy Markdown
Collaborator Author

Rebased onto the current #4813 head (1822a77). Head is 856aa21. Locally: terminal-attribution, token-id-capture and NOOA observability suites pass (352 tests).

@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 29, 2026
@furgalep

Copy link
Copy Markdown
Collaborator Author

/ok to test 856aa21

@furgalep
furgalep requested a review from init-nikhil October 29, 2026 19:09
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 29, 2026 19:21
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 29, 2026
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Oct 30, 2026
@init-nikhil
init-nikhil force-pushed the codex/nooa-conformance branch from eba0827 to 5efa36d Compare November 2, 2026 20:32
@init-nikhil
init-nikhil requested a review from a team as a code owner November 2, 2026 20:32
@init-nikhil
init-nikhil force-pushed the codex/nooa-conformance branch 3 times, most recently from d8b273e to c0c50d1 Compare November 4, 2026 03:37

@init-nikhil init-nikhil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we validate that token capture picks this up correctly? Can we run an Atom rollout?

# A harness on the legacy /run path declares its terminal on the result; a harness behind an
# agent-session environment can only speak through its response, so its metadata counts too.
response_metadata = response.get("metadata") if isinstance(response.get("metadata"), dict) else {}
declared_terminal = result.get(TERMINAL_RESPONSE_ID_KEY) or response_metadata.get(TERMINAL_RESPONSE_ID_KEY)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put the root’s last model response ID in response.id, like Claude Code and Terminus do? Why do we need a new place to read it from in delivery.py?

@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Nov 4, 2026
@init-nikhil
init-nikhil force-pushed the codex/nooa-conformance branch from c0c50d1 to bca323f Compare November 5, 2026 03:17
@github-actions github-actions Bot added the sla:author-overdue Author response is over the one-business-day SLA label Nov 5, 2026
@init-nikhil
init-nikhil force-pushed the codex/nooa-conformance branch from 1975665 to 13f0f9f Compare November 5, 2026 22:06
@init-nikhil
init-nikhil deleted the branch NVIDIA-NeMo:codex/nooa-conformance November 6, 2026 00:26
@init-nikhil init-nikhil closed this Nov 6, 2026

This branch was previously deployed

1 inactive deployment
public — 856aa219 Deployed Oct 29, 2026 by copy-pr-bot[bot] via release / finalize / notify #8424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters blocked Work cannot move forward until an external dependency is cleared bug Something isn't working sla:author-overdue Author response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants