Skip to content

Alexandery/cc fixes for 4124 - #4431

Closed
alexandery-nvidia wants to merge 4 commits into
aroshanghias/cc-capture-redesign-20260914from
alexandery/cc-fixes-for-4124
Closed

alexandery-nvidia wants to merge 4 commits into
aroshanghias/cc-capture-redesign-20260914from
alexandery/cc-fixes-for-4124

Conversation

@alexandery-nvidia

Copy link
Copy Markdown
Contributor

We validated this PR end to end with a blackbox harness the framework does not control: the OpenAI Codex CLI solving CUDA-kernel RL tasks over streamed /v1/responses (SingleController GRPO on Qwen3.5-9B, 16 concurrent sessions per wave, two GB300 nodes, paired with Gym #3368). With the fixes below, a 3-step GRPO run completes with the harness's own auto-compaction enabled: segments reassemble as exactly 2×compactions+1 (one measured session: 52 compactions → 105 segments over 481 calls), and token_mult_prob_error stays ≈ 1.011 at every step across refits. Each fix converts a whole-run abort into the intended per-call or per-attempt degradation.

Commits

  1. fix(capture): an unexplained request suffix roots a new segment instead of failing the call — decide_capture_input raised when a request shared the candidate's source prefix but appended something other than user/tool observations, or when the converted messages could not prove the response boundary. Real harnesses produce such shapes (an echoed or injected assistant item around a compaction, roughly 1 call in 10k for codex), and one raise cascaded into a dead run. Both proofs now fall back to the root decision with a warning naming the suffix roles; missing source/render evidence still raises. Token fidelity is unaffected: a root serves a fresh render.
  2. fix(capture): a failed call's pending intent resolves in the terminal receipt — ending a session at its budget kills the harness mid-call; the ledger records request_finished_without_staged_coordinates and keeps the call pending, and _receipt_staging_keys refuses any pending receipt, so one budget-killed call aborted the run. _assemble_receipt already declares exactly this row structurally off-chain; it now also drops pending ids that carry a failure row. This resolves custody at the terminal seam, where it is provable: after a failure the attempt admits no further calls, so no commit can ever arrive, and the seal already derives a cleanup staging key for every attempted call, which covers a staged-but-unacknowledged row. The Gym-side pinned semantics (pending intents preserved on failed or cancelled calls, per the branch's newest test) are untouched — nothing changes in the manifest.
  3. fix(capture): drain the in-flight call before assembling a terminal receipt — often the killed call never resolves on its own: the server observes the client's disconnect only when writing the response, so under the streaming dispatch the engine call keeps executing minutes past the harness's terminal declaration, and its intent is raw-pending (no commit, no failure row) at manifest-read time. Both receipt-assembly sites now poll the terminal manifest until every intent resolves, bounded by a five-minute drain budget sized to one full generation; past the budget the receipt is cleared of pending ids and poisoned as capture_drain_timeout, so the rollout seals and finalizes as a masked placeholder instead of aborting the run. A pending id with no failure row inside the budget still keeps the receipt unsealable.
  4. test(cc): construct direct environment stand-ins with the redesign's attributes — test doubles that build the environment object directly lack _context_compaction, which the receipt-mode postprocess reads; the stand-ins in the rollout-generation-failure tests gain the attribute.

Validation

  • On this branch, paired with the Gym fix branch (NVIDIA-NeMo/Gym alexandery/cc-fixes-for-3368): the capture/CC selection (capture-context, CC experience pipeline, logical advantage, rollout-generation failures) 142 passed; the token-capture environment tests (--nemo-gym-only) 31 passed, including new paired receipt-and-seal tests for all three fixes.
  • The same diffs ran live on our fork: a three-wave run whose 48 sessions all ended at a 900-second budget completed 3/3 steps; the drain resolved most killed in-flight calls and the eight that outlived the budget were masked rather than fatal.

Notes

  • A broader design question we'd raise: should an unreconcilable terminal receipt ever abort the run, rather than failing the attempt into the existing re-dispatch machinery? Every fatal cascade we hit reached the run level through that single raise.
  • The companion Gym fixes (streaming dispatch, canonicalizer, engine-refusal resolution) are on NVIDIA-NeMo/Gym branch alexandery/cc-fixes-for-3368 against fix(nemo-gym): define actor failure and teardown ownership #3368. Each PR stands alone.

🤖 Generated with Claude Code

alexandery-nvidia and others added 4 commits October 2, 2026 17:39
…ad of failing the call

decide_capture_input raised when a request shared the candidate's source
prefix but appended something other than user/tool observations, or when
the converted messages could not prove the response boundary. Harnesses
produce such shapes (codex re-sends a kept prefix around its compaction),
and one such call failed the request, which cascaded through the row's
attempts and aborted the run under min_step_batch_fraction=1.

Both proofs now fall back to the root decision with a warning: the call
renders fresh as a new, parentless segment, exactly like a recognized
history rewrite. Missing source or render evidence remains an error.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: alexandery <[email protected]>
… receipt

Ending a codex session at its budget kills the harness mid-call; the
disconnect cancels the gateway handler between intent and commit, the
ledger records request_finished_without_staged_coordinates, and the
manifest keeps the call pending (ambiguous custody, by upstream design).
_assemble_receipt already treats such rows as structurally off-chain, but
it forwarded the pending id untouched and _receipt_staging_keys refuses
any pending receipt, so one budget-killed in-flight call aborted the whole
run at step 0 (job 750875).

At rollout end the ambiguity is resolvable: the attempt admits no further
calls after a failure, so no commit can ever arrive, and the seal already
derives a cleanup staging key for every attempted call, which covers a
staged but unacknowledged row. The receipt now drops pending ids that
carry a failure row. A pending id without one may still be executing and
keeps the receipt unsealable.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: alexandery <[email protected]>
…eceipt

Run 751509 showed the budget-killed call often never resolves by itself:
the streaming dispatch makes one non-streaming engine call, so the
client's disconnect is not observed until the synthesized stream is
written, and the engine call keeps executing after the harness declared
the rollout terminal. Its intent has no commit and no failure row, the
previous commit's receipt filter correctly keeps it pending, and the seal
aborts the run.

The terminal manifest read now polls until every intent resolves (the
engine finishes the disconnected call and commits, or the cancelled
handler records its failure), bounded by a five-minute drain budget that
covers one full generation. A call still unresolved past the budget masks
the rollout (capture_drain_timeout) instead of leaving the receipt
unsealable; the seal's cleanup keys already cover its possible staging
row.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: alexandery <[email protected]>
…attributes

Test doubles that build the Gym environment object directly (bypassing
__init__) lack _context_compaction, which the receipt-mode postprocess
reads; the stand-ins in the rollout-generation-failure tests gain the
attribute. On the unmodified revision these tests fail with
AttributeError.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: alexandery <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 3, 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.

aroshanghias-nvd added a commit that referenced this pull request Oct 5, 2026
Adapt the continuation fallback and bounded manifest drain proposed in
#4431. Preserve pending IDs when capture fails or times out:
a failure record is not proof that a worker has stopped writing. Ordinary
receipt mode masks unresolved capture; CC keeps its existing masking.

Add regression coverage for public postprocessing, cancellation, pending
write custody, and the real RL root decision through Gym HTTP admission.
Document the paired buffered Responses SSE behavior.

Co-authored-by: alexandery <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
@aroshanghias-nvd

Copy link
Copy Markdown
Contributor

Thanks @alexandery-nvidia for the fixes and the Codex/CUDA workload findings. The adapted changes are now incorporated into #4124 in commit 83783cb, with co-author credit, so I am closing this PR as superseded rather than merging it separately.

We retained the fresh-root fallback for unsupported continuation shapes, the bounded terminal-manifest drain, and the test-double corrections. We adjusted failure handling to preserve pending call IDs: a failure record or expired drain budget does not prove that a worker has stopped staging data. Unresolved attempts are masked, and their pending writes remain excluded from cleanup ownership. The CC path reuses its existing masking behavior.

Validation of the paired RL/Gym integration: 467 distinct local CPU/ASGI tests, 165 allocated-node native capture/media tests, and eight real-vLLM/native-TQ cases passed. Four independent 20-step runs (manufactured identity/image compaction and custom OpenCode identity/compaction) completed; all saved-data audits passed, with peak TMPE 1.005773 across the four runs. This does not claim reproduction of the exact Codex/CUDA workflow. The only production change after training was removal of redundant CC masking, followed by 126 focused regression tests.

aroshanghias-nvd added a commit that referenced this pull request Oct 7, 2026
Adapt the continuation fallback and bounded manifest drain proposed in
#4431. Preserve pending IDs when capture fails or times out:
a failure record is not proof that a worker has stopped writing. Ordinary
receipt mode masks unresolved capture; CC keeps its existing masking.

Add regression coverage for public postprocessing, cancellation, pending
write custody, and the real RL root decision through Gym HTTP admission.
Document the paired buffered Responses SSE behavior.

Co-authored-by: alexandery <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
jinglinglingling pushed a commit to jinglinglingling/RL that referenced this pull request Oct 14, 2026
Adapt the continuation fallback and bounded manifest drain proposed in
NVIDIA-NeMo#4431. Preserve pending IDs when capture fails or times out:
a failure record is not proof that a worker has stopped writing. Ordinary
receipt mode masks unresolved capture; CC keeps its existing masking.

Add regression coverage for public postprocessing, cancellation, pending
write custody, and the real RL root decision through Gym HTTP admission.
Document the paired buffered Responses SSE behavior.

Co-authored-by: alexandery <[email protected]>
Signed-off-by: Ali Roshan Ghias <[email protected]>
Signed-off-by: Linglin Jing <[email protected]>
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