nemo_gym.models.token_capture.conformance
nemo_gym.models.token_capture.conformance
Verify that an external token-capture transport follows Gym’s protocols.
A framework transport can replace Gym’s file store.
For example, NeMo-RL can carry records through a transfer queue.
An incorrect implementation can lose records or make a committed parent invisible to another client.
run_conformance checks these behaviors directly.
Factories must return fresh client instances over the same shared backend.
The checks use fresh instances to verify cross-client visibility.
Each check uses its own rollout id, so failed checks cannot poison later ones.
This module avoids FastAPI, Ray, Torch, and aiohttp imports.
Module Contents
Classes
Functions
Data
API
Bases: AssertionError
One named contract check failed.
Bases: UserWarning
One named contract check was skipped, and the gap has a consequence at run time.
run_conformance issues it through warnings.warn after every check that ran passed, so
the transport conforms and the caller still sees what the missing extension costs.
Simulate a retry that resends the same serialized entry.
Build a committed entry with the metadata that capture_tokens records.
A write to a retired rollout must fail with TokenCaptureRetiredError, as TokenSource.retire requires.
The capture sink treats that error as a late write; any other error would be reported as a capture failure.
Entries a consumer could build from; a retired rollout may refuse to freeze instead.
Run the ordered contract checks and return the names that passed.
Raise ConformanceError on the first failure.
Lineage checks are skipped without a lineage_factory.
The begin_call and record_engine_refusal checks are skipped when the sink lacks the extension.
A sink that implements begin_call without record_engine_refusal passes with a
ConformanceWarning for the skipped check: a call the engine refuses then leaves its
pre-dispatch intent dangling, and the rollout is masked.