Skip to content

Carry terminal truncation metadata through Gym token-capture receipts #4737

Open

Description

@linj-glitch

PR #4491 fixes multi-turn context exhaustion for ordinary Gym results, but the token-capture receipt path still marks truncation only when the assembled sequence length equals the maximum length. A terminal response that ends with incomplete_details.reason=max_output_tokens before that equality can therefore escape overlong_filtering and undercount truncation metrics.

Carry the terminal response's truncation evidence through receipt assembly and use the same context-exhaustion semantics when finalizing captured rows. Preserve compatibility with older receipts that lack the metadata, and keep content-filter or ordinary completed responses distinct from length truncation.

Add tests that drive receipt assembly through RolloutReassembler for a zero-token context-exhausted final turn, terminal length exhaustion below the total limit, an ordinary completed response, a content-filtered response, and a legacy receipt. Check both the emitted TRUNCATED column and the downstream overlong filter.

Current source: receipt finalization. This is the receipt-mode follow-up requested in the review of #4491; it is distinct from #2163's older missing-column error.

Activity

  1. added
    bug
    on Oct 15, 2026
  2. GBX-Max1220 commented on Oct 21, 2026

    @GBX-Max1220

    Hi, I looked into this follow-up to #4491.

    The receipt finalization path still sets TRUNCATED based on reconstructed sequence length alone, so terminal length-exhaustion evidence may be lost before the training batch is assembled.

    I'd be interested in contributing a focused regression and fix covering terminal max_output_tokens below the sequence limit, zero-token terminal exhaustion, normal completion, content-filtered responses, and legacy receipts without the new metadata.

    I also noticed #4711 and #4776 touch nearby rollout/capture paths, so I'd want to avoid overlapping with ongoing work.

    @linj-glitch, are you already implementing this follow-up? If not, would a test-first contribution focused on receipt propagation and downstream filtering be useful?

  3. four1er commented on Nov 23, 2026

    @four1er

    Hi, I am picking this up. I will reproduce the receipt-path truncation gap first (terminal max_output_tokens below the sequence limit / zero-token final turn escaping TRUNCATED and overlong_filtering), then open a focused PR with the fix plus regression tests through RolloutReassembler covering terminal length exhaustion, zero-token exhaustion, normal completion, content-filtered responses, and legacy receipts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions