Skip to content

feat(token capture): train all paths - #4285

Closed
cmunley1 wants to merge 19 commits into
aroshanghias/cc-checkpoint-resume-20260918from
cmunley1/subagents
Closed

cmunley1 wants to merge 19 commits into
aroshanghias/cc-checkpoint-resume-20260918from
cmunley1/subagents

Conversation

@cmunley1

@cmunley1 cmunley1 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

Add token_capture.call_selection, which decides which captured calls become training rows when multi_segment_rollouts is on. Capture records every call, so the selection is the reassembler (calls in, rows out):

  • all (the default) trains every conversation, including subagents. The scored conversation comes first, the latest continuation is kept at a branch, and a failed call ends its conversation instead of masking the rollout.
  • main_chain trains only the scored conversation.
  • accepted_history is the previous behavior: match the harness output to captured calls.
  • package.module:function plugs in a custom selection.

Stacked on #4200 (and #4124). Their segment machinery already turns each captured chain into its own row with its own R3 routes and one shared reward per rollout, so this adds the selection and relaxes two planner checks: capture order across conversations is no longer required (each chain stays contiguous), and the scored terminal only has to end one of the chains.

It also renames token_capture.context_compaction to multi_segment_rollouts, because the trainer treats compaction, subagents and branches alike. It lifts the limits that came with the old name: sequence packing, advantage clipping, sequence logprob masking, seq-mask-tis, message-level advantages, reward penalties, non-unit loss_multiplier, and min_step_batch_fraction below 1 are now accepted.

Usage

token_capture:
  enabled: true
  multi_segment_rollouts: true

Results

Unit tests only so far (the renamed multi-segment suites, plus new cases for the lifted limits): selection on interleaved subagent conversations, failures and branches, the planner on an interleaved capture, ingestion with a failed call, and the config check. A Claude Code subagent training run is pending.

Before your PR is "Ready for review"

Pre checks:

  • Did you write any new necessary tests?
  • Did you run the unit tests locally? Ingestion, dispatch, exporter and setup tests.

@copy-pr-bot

copy-pr-bot Bot commented Sep 27, 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 and others added 7 commits October 1, 2026 11:23
Preserve pending call custody, mask failed logical owners, retain healthy siblings, and drop unusable groups through the existing policy. Keep CC integrity failures fatal and avoid unsafe redispatch of request-local selections.

Validation: 251 focused RL tests; seven private live vLLM/native-TQ failure, cancellation, and timeout cases. No checkpoint PR or private validation machinery included.
Signed-off-by: Ali Roshan Ghias <[email protected]>
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]>
Allow omitted HTTP headers and stop requiring the old hinted intermediate candidate. Retain exact committed ancestry, segment counts, accepted-token coverage, rejected-token exclusion, and cleanup assertions.

Validation: 113 focused local tests and two GPU smoke runs passed; 124 checkpoint compatibility tests passed with the updated Gym client.
Signed-off-by: Ali Roshan Ghias <[email protected]>
… subagents

Add token_capture.train_all_calls. The scored conversation is the first segment and each other captured conversation is one more segment, so subagent calls train with the main agent. Failed calls end their conversation instead of masking the rollout. The segment planner accepts conversations captured interleaved.

Signed-off-by: Christian Munley <[email protected]>
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Oct 15, 2026
@cmunley1 cmunley1 changed the title feat(token capture): train on subagents and branches feat(token capture): train every conversation of a rollout, including subagents Oct 15, 2026
@cmunley1
cmunley1 removed this pull request from stack #4291 October 15, 2026 00:57
@cmunley1
cmunley1 changed the base branch from main to aroshanghias/cc-checkpoint-resume-20260918 October 15, 2026 00:57
@cmunley1 cmunley1 changed the title feat(token capture): train every conversation of a rollout, including subagents feat(token capture): train all paths Oct 15, 2026
… limits that came with the compaction name

Rename token_capture.context_compaction to multi_segment_rollouts, since a rollout trained as several chains does not care whether they come from compaction or subagents. Rename the CC helpers, messages, tests and guide to match. Accept sequence packing (rows only need to split evenly across DP ranks), advantage clipping, sequence logprob masking (which masks the whole rollout), seq-mask-tis, message-level advantages and reward penalties, and let a step close short when prompts were dropped (min_step_batch_fraction below 1).

Signed-off-by: Christian Munley <[email protected]>
…ollouts

The owner batch used to require a binary sample mask and overwrote it with 0/1, so multi-segment rollouts rejected non-unit loss multipliers. Keep the owner's weight (the minimum over its rows, zero when any row is invalid) for the loss and use a binary validity for the advantage estimator.

Signed-off-by: Christian Munley <[email protected]>
@cmunley1
cmunley1 marked this pull request as ready for review October 15, 2026 05:53
…ture.call_selection

Capture records every call, so the selection is the reassembler. Built-ins are accepted_history (match the harness output, as before), all (every conversation, subagents included) and main_chain (only the scored conversation). A package.module:function selection plugs in custom ones. This replaces the train_all_calls boolean.

Signed-off-by: Christian Munley <[email protected]>
Make token_capture.call_selection default to all, since capture records the whole forest and the other frameworks surveyed do the same. accepted_history stays available for harnesses that need it, and the tests that exercise it select it explicitly.

Signed-off-by: Christian Munley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants