Skip to content

token-capture: an engine refusal under worker custody reports no truncation verdict #4647

Open

Description

@alexandery-nvidia

Summary

Under worker custody (token_id_capture.external_staging: true), a model call the engine refuses for the context window is recorded on the capture ledger as a failure row that carries only the call id and the reason (ENGINE_REFUSED_CALL_REASON, #3980). The row carries neither the error code the client received nor the request-time lineage decision (the recorded call the refused request continued). The local capture path records both on its EngineRefusalRecord, and the trajectory builder uses them to mark the rebuilt response incomplete with incomplete_details.reason: max_output_tokens when the refused request continued the delivered terminal call (#3980).

So the two capture placements disagree on the same rollout: local capture reports the truncation, while a rollout rebuilt from staged records (staging/rebuild.py, and NeMo RL's receipt consumer) reports a complete ending, and the ledger cannot tell a context-window refusal from an output-parameter refusal.

What a fix needs

  • A schema decision for the ledger failure row: the wire models in nemo_gym/token_id_capture/staging/records.py forbid extra fields, so the code and the lineage decision need declared columns, with the same version coupling feat(token-capture): carry the finish reason through worker-custody staging #4366 documents for finish_reason (model server and framework must run the same Gym version).
  • LinearizedRow (staging/rebuild.py) reporting a refusal that ended the delivered chain through incomplete_reason, with the same two conditions the local builder applies (_engine_refusal_ended_the_chain in builder.py): the context-window code, and a request that continued the terminal call or a token-identical retry of it served before the refusal.
  • The framework consumer applying that verdict with the shared precedence helper from feat(token-capture): carry the finish reason through worker-custody staging #4366, so a harness's own incomplete or failed verdict is kept.

Until then, a worker-custody rollout that ended at the context window trains as a completed one; the ledger row still keeps the rollout from being poisoned once NeMo RL reads UNSERVED_CALL_FAILURE_REASONS (#3980).

Related: #3980 (engine refusal on the local path), #4366 (finish reason through staging).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions