nemo_gym.models.token_capture.staging.rebuild
nemo_gym.models.token_capture.staging.rebuild
Verify a rollout receipt and rebuild its selected token sequence.
The verifier reads token columns from StagedCallBaseSnapshot.
It does not fetch or decode optional extras.
For each selected call, it returns an ExtrasCommitment.
Consumers fetch the extras and compare their digest before use.
Module Contents
Classes
Functions
API
The receipt-bound extras digest for one selected call.
A commitment proves what the extras payload must hash to — not that the
payload was fetched or valid. Consumers verify deferred extras bytes
against it with compute_extras_digest at their own point of use.
One verified terminal chain ready for framework publication.
This is a proof that the base training row was verified. It carries no
extras payloads; extras_commitments lists the selected calls’
receipt-bound digests root-to-terminal for point-of-use verification.
Compatibility spelling for existing framework consumers.
The incomplete_details.reason the rebuilt response reports, or None for a complete ending.
Only the terminal call decides: an earlier length stop did not end the chain, because a
later call extended it. The mapping is the one the local capture path applies, and so is
the abstention: an unresolved finish reason (finish_reason_resolved is False) gives
no verdict rather than one that follows the call-id order of identical retries.
A framework consumer puts this verdict on the harness response with
nemo_gym.models.token_capture.apply_capture_incomplete_verdict, the precedence rule the
local delivery applies as well: a harness that reported incomplete or failed
itself keeps its own verdict, and only a response that reported completed or no
status takes this one.
Bases: ReceiptVerificationError
A verified manifest cannot form the declared terminal ancestry.
Bases: ValueError
A receipt or staged snapshot failed a custody invariant.
Policy version covering one call’s newly contributed token span.
Return the reason tokens of the receipt’s attribution trail.
resolve_terminal joins its abstention, corroboration, and disagreement tokens with commas,
and the framework copies the string onto terminal_attribution_reason; a receipt from a
framework that records no trail has none.
Return the capture key record was staged under.
A restored episode keeps the calls made before its checkpoint, staged under an earlier attempt of the same rollout. Any other owner would splice a foreign rollout’s tokens into this receipt.
Compatibility wrapper that still executes the production verifier.
Verify an untrusted staged base set and linearize the declared terminal chain.
Metadata-only: extras payloads are never read. The returned row’s
extras_commitments carry the selected calls’ receipt-bound digests for
consumers to verify fetched extras against at their own point of use.