Skip to content

feat(eval): record run provenance and the served models before dispatch - #5134

Merged
lafrancef merged 2 commits into
mainfrom
romeyn/run-provenance
Nov 20, 2026
Merged

lafrancef merged 2 commits into
mainfrom
romeyn/run-provenance

Conversation

@marcromeyn

@marcromeyn marcromeyn commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Every run now writes <stem>_provenance.json beside its rollouts, just before the first rollout is dispatched, so a result says what produced it: which Gym, which settings, which data, and which model was actually served. Two scores can then be compared setting by setting, and a claimed model can be checked against the served one (for example a run reported as Super 3.5 that loaded a Super 3 checkpoint).

The file holds:

  • Gym version and commit;
  • model, dataset and sampling identifiers from the config, with credentials and query strings dropped from URL-like values;
  • fingerprints of the materialized inputs, prompts and templates, and the seed;
  • served_models: per model server, what each of its backends reports at GET <base_url>/models: the served id and, for vLLM, the loaded checkpoint (root);
  • efb_config_ref: a versioned Eval Factory config reference, only when the caller passes one (+efb_config_ref=...).

The masked config itself is not copied here: #4908 (merged) saves it as <stem>_resolved_config.yaml, and this record complements it.

Served models

  • One request per backend, once per run (at most 8 backends per model server, 5 s timeout); nothing per rollout.
  • A --no-serve collection does not hold the model servers' config, so it takes their entries from the running head server, as other client commands do.
  • A hosted gateway lists its whole catalog, so when several models are listed only the configured model's entry is kept. A single listed model (the usual vLLM case) is kept as is, so a name or checkpoint that differs from the claim stays visible.
  • Nothing is taken from the configured names. A backend that does not answer, reports no root (hosted APIs) or lists no matching model is recorded as unknown with the reason; if no model server can be found, served_models_unknown_reason says why. Error messages are never written, only their type, so no URL or address leaks.
  • The API key is sent when configured and never recorded.

Writing provenance never stops a run: a failure leaves status: unavailable with the error type.

Compatibility

One new file per run; no change to rollouts, scores or existing files. A run with unreachable backends spends at most the timeouts before dispatch.

Notes for review

  • About 150 lines of the diff are the served-model lookup; the rest is the provenance record and its tests.
  • The lookup uses urllib synchronously inside the thread that already writes provenance, rather than the shared aiohttp client: one call per backend, before dispatch.
  • Docs: the file is listed in the gym eval run output-files table that feat(eval): save the masked config beside rollouts from gym eval run #4908 added.
  • Import layering: the module is nemo_gym.rollouts.provenance, since collection writes the file, and reads the running Gym commit from nemo_gym.utils.gym_commit, so it needs no ignore_imports entry.
  • Per-call model and weight versions (needed for training) are out of scope; they belong to the capture-identity design's weight_version.

Validation

  • Rebased onto main's current layout (nemo_gym/rollouts/, nemo_gym/utils/path_utils.py, tests in their package folders). uv run --extra dev --extra telemetry pytest tests/unit_tests/rollouts tests/unit_tests/orchestration tests/unit_tests/test_fern_docs_links.py tests/unit_tests/test_import_linter_coverage.py tests/unit_tests/test_orchestration_boundary.py: 5,819 passed; 6 resubmit tests fail identically on main here because mlflow is not installed. pre-commit run --files (import-linter included): passed.
  • The served-model tests fail with the lookup disabled and pass with it.
  • pre-commit run --files on the changed files, including the import-layering check: passed.

Rollout evidence

After the rebase, gym env start --resources-server example_single_tool_call --model-type openai_model, then gym eval run --no-serve --agent example_single_tool_call_simple_agent --input .../example.jsonl --limit 2 +efb_config_ref=... with gpt-6-luna: 2 rollouts, no failures. rollouts_provenance.json had status: available, served_models: {"policy_model": [{"id": "gpt-6-luna", "root": null}]} (a hosted API reports no checkpoint), the EFB reference as passed, the Gym commit, and no API key. Not run: a vLLM backend, where root would be filled, and the end-to-end serving path.

Linear: FEP-1838 (part of FEP-1829).

@copy-pr-bot

copy-pr-bot Bot commented Oct 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work labels Oct 27, 2026
@marcromeyn
marcromeyn force-pushed the romeyn/run-provenance branch from f401c7e to cc7c9ff Compare November 2, 2026 14:17
@marcromeyn

Copy link
Copy Markdown
Contributor Author

/ok to test cc7c9ff

@marcromeyn

Copy link
Copy Markdown
Contributor Author

/ok to test f0299ad

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

@marcromeyn
marcromeyn marked this pull request as ready for review November 2, 2026 15:24
@marcromeyn
marcromeyn requested a review from prokotg November 2, 2026 15:24
@marcromeyn
marcromeyn requested a review from a team as a code owner November 2, 2026 15:24

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HOLD — two credential-redaction gaps need fixing before merge.

I reviewed all 11 changed files and traced metadata extraction, backend discovery, and run/submission integration. The additional RISK findings concern incomplete or misleading provenance, not changed reward calculations. The credential findings demonstrate plaintext retention in generated artifacts; I haven't established disclosure across a trust boundary.

Validation was static. I couldn't execute tests; the acceptance checks and suggested patches below still need verification.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread nemo_gym/rollouts/provenance.py Outdated
elif key == "judge_prompt_version" and isinstance(value, (str, int)):
record.judge_prompt_versions[location] = str(value)
elif isinstance(value, Mapping) and key not in {
"env",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER — Exclude Harbor's operator-secret container.

The visitor skips env and headers but descends into secrets. Harbor defines an arbitrary operator-secret map. For example, build_provenance({"harbor_environment_server":{"environment_servers":{"harbor":{"secrets":{"model":"sk-private"}}}}}) copies sk-private into models["harbor_environment_server.environment_servers.harbor.secrets"]. A valid secret whose name matches an identifier key therefore enters the supposedly credential-free artifact.

Could you add secrets to this recursion exclusion set? Replace the existing "env", line with:

Suggested change
"env",
"env",
"secrets",

This prevents the child visitor from selecting secret values while retaining ordinary model/checkpoint extraction outside secret maps.

Proposed checks: use the example above with a sibling real policy-model configuration. Assert the serialized record contains neither sk-private nor identifiers extracted from the secret map, but retains the sibling model. Preserve the existing assertions that policy/judge identifiers survive while API keys, environment values, and prompt text don't.

Comment thread nemo_gym/rollouts/provenance.py Outdated


def _identifier(value: str) -> str:
if "://" not in value:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER — Handle protocol-relative authorities before the identifier heuristic.

build_provenance({"checkpoint":"//user:secret@host/model?token=private"}) returns the whole identifier: this branch sees / before @ and exits without sanitizing it. The password and query token are serialized. Schemeless userinfo containing another @ is also partially retained: user:sec@ret@host/model becomes ret@host/model, exposing part of the password.

A small replacement for _identifier is:

def _identifier(value: str) -> str:
    if "://" in value or value.startswith("//"):
        parsed = urlsplit(value)
        return urlunsplit((parsed.scheme, parsed.netloc.rsplit("@", 1)[-1], parsed.path, "", ""))
    userinfo, separator, remainder = value.rpartition("@")
    if not (separator and "/" not in userinfo):
        return value
    parsed = urlsplit("//" + remainder)
    host = parsed.hostname or ""
    if not ("." in host or ":" in host or host == "localhost" or parsed.port is not None or ":" in userinfo):
        return value
    return urlunsplit(("", parsed.netloc, parsed.path, "", "")).removeprefix("//")

The invariant is to remove authority credentials and URL queries without stripping repository revisions or local paths. This retains the existing host/slash checks for ambiguous schemeless identifiers.

Proposed checks: expect //host/model for the first example and host/model for the second, with no credential fragments in the artifact. Retain the schemed, schemeless, and token-only regressions, and assert org/repo@v3 and /mnt/model@v3 remain unchanged. The suggested replacement hasn't been executed.

Comment thread nemo_gym/rollouts/provenance.py Outdated
def _ask_backend(base_url: str, api_key: object, configured: set[str]) -> list[ServedBackend]:
request = urllib.request.Request(base_url.rstrip("/") + "/models")
if isinstance(api_key, str) and api_key and not api_key.startswith("${"):
request.add_header("Authorization", f"Bearer {api_key}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISK — Forward the configured backend headers during discovery.

A supported OpenAI gateway can require openai_default_headers: {"X-Api-Key": "secret"} for both inference and /models. Inference forwards that map in the OpenAI adapter, but discovery sends only Bearer auth. The same mismatch affects vLLM's default_headers. Provenance consequently records an avoidable authentication failure, or queries a gateway's default routing context instead of the one used for inference.

Could you add a keyword-only default_headers: Mapping[str, str] | None = None parameter to _ask_backend, and construct its request as:

request = urllib.request.Request(
    base_url.rstrip("/") + "/models",
    headers=dict(default_headers or {}),
)

Have served_models pass the applicable openai_default_headers or default_headers map. Keep the existing Bearer addition afterward, matching the inference client's precedence, and never serialize the headers.

Proposed checks: make the local HTTP fixture reject requests missing a configured X-Api-Key; both OpenAI and vLLM configurations should then record the reported id/root without writing the secret. Preserve the existing Bearer sk-judge assertion, header-free backend behavior, and hosted-catalog filtering in the served-model tests.

if not isinstance(server, Mapping):
continue
try:
urls = _backend_urls(server)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISK — Resolve live endpoints for Gym-launched local models.

The documented local-vLLM configuration has no base_url. The server fills its typed config after launching the backend, but that config comes from a container copy in a separate server process. This lookup reads the unchanged launch/head config, so a healthy locally launched vLLM always produces unknown_reason: "no base_url". GenRM inherits that launch path, and local-vLLM proxies also resolve their backend only at runtime.

Could you retain the implementation key while iterating and resolve these runtime endpoints before _backend_urls? Local vLLM already exposes GET /get_inner_vllm_config; the proxy uses it. A bounded lookup should obtain the actual backend for local vLLM/GenRM and follow a proxy's model-server reference, keeping credentials only in memory. I haven't established a safe shared-resolver patch, so the exact implementation needs verification.

Proposed checks: emulate a Gym local-model server whose launch config has no URL but whose live route returns a fixture backend. Assert provenance records that backend's id/root for local vLLM, inherited GenRM, and a proxy reference. Preserve explicit external URLs, endpoint-file precedence, the eight-backend limit, and safe unknown entries when live resolution fails. These tests can use HTTP fixtures without GPUs.

Comment thread nemo_gym/rollouts/provenance.py Outdated
if not urls:
backends.append(ServedBackend(unknown_reason="no base_url"))
for url in urls:
backends.extend(_ask_backend(url, api_key, configured))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISK — Isolate malformed answers to their backend.

With multiple backends, let the first /models return a valid id/root and the second return {"data":123}. Decoding succeeds, but the comprehension outside _ask_backend's handler raises TypeError. The exception escapes served_models, so the assignment in the writer never completes: all earlier observations are lost and later servers aren't queried. Request-construction errors outside the helper's handler take the same path.

The smallest isolation change at this call is:

Suggested change
backends.extend(_ask_backend(url, api_key, configured))
try:
backends.extend(_ask_backend(url, api_key, configured))
except Exception as error:
backends.append(ServedBackend(unknown_reason=type(error).__name__))

Each failed backend must contribute only its own unknown entry; successful observations must survive, and exception messages must remain excluded.

Proposed checks: through write_run_provenance, query three fixture endpoints returning a valid model, {"data":123}, and another valid model. Expect both valid observations, a single TypeError unknown entry, status == "available", and the input hash. Retain the existing unreachable-backend, single-model/configured-name mismatch, and hosted-catalog assertions in the regression suite.

continue
row = orjson.loads(line)
record.input_sampling_rows += 1
params = row.get("responses_create_params") or {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISK — Read sampling from supported materialized-task envelopes.

For {"task_id":{"taskset":"s","task_id":"1"},"task_input":{"responses_create_params":{"input":[],"temperature":0.4,"metadata":{"extra_body":"{\"seed\":7}"}},"task_data":{}}}, this lookup reads {} and emits no sampling profile. The collector deliberately preserves materialized rows without adding a top-level request. Harbor also supports requests under task_input.turns, which are skipped too. The byte hash is correct, but explicit sampling comparison is missing for these supported input paths.

Could you select request containers using the materialized-row contract? Keep flat requests, inspect task_input.responses_create_params for single-turn materialized rows, and each declared turn's request for Harbor multi-turn rows. Don't recursively interpret arbitrary task-data dictionaries as requests. Keep the 100-physical-line decoding bound and full-file hash. Malformed per-turn metadata needs an explicit row-level counting rule, so I wouldn't suggest a blanket implementation yet.

Proposed checks: the example must yield [{"temperature":0.4,"seed":7}]; a two-turn row with temperatures 0.2 and 0.8 must retain both profiles. Mixed flat/materialized inputs must retain both shapes, deduplicate equal profiles, and count rows rather than turns. Preserve the malformed-metadata regression and full-hash/100-line assertions.

if not isinstance(metadata, Mapping):
record.input_sampling_rows_skipped += 1
continue
source = row.get("task_source")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISK — Extract dataset identity before sampling validation.

For {"task_source":"dataset-a","responses_create_params":{"temperature":0.7,"metadata":"invalid"}}, the preceding continue skips this valid task_source. The artifact remains available but omits dataset-a. In mixed-dataset inputs, malformed sampling metadata therefore removes unrelated dataset identity, contrary to the documented preservation of other metadata.

Could you move these existing lines immediately after input_sampling_rows += 1, before either request/metadata type guard?

source = row.get("task_source")
if isinstance(source, str):
    datasets.add(_identifier(source))

Dataset extraction must be independent of sampling validity, while malformed sampling still increments the skipped-row count and never enters the artifact.

Proposed checks: extend the malformed-metadata regression with task_source="dataset-a" on the malformed row and "dataset-b" on the valid row. Expect both names, one skipped sampling row, only the valid profile, the exact input hash, and no malformed metadata value. Retain valid-row dataset deduplication and identifier sanitization.


# Recorded before dispatch from the config resolved above.

await asyncio.to_thread(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RISK — Don't replace producer evidence on a no-op resume.

After a completed run, restart the same command with resume enabled while the backend now reports a different checkpoint under the same configured model name. Resume reuses all successful outcomes, so the pending input list is empty. This unconditional call nevertheless overwrites the provenance with the current backend and Gym identity, although neither produced a new rollout. The resulting file can attribute an unchanged score to the wrong checkpoint.

For this no-dispatch case, guard the existing call:

if store.started_fresh or input_rows:
    await asyncio.to_thread(
        write_run_provenance,
        output_fpath,
        global_config,
        prompt_config=config.prompt_config,
        input_jsonl_fpath=config.input_jsonl_fpath,
        model_server_config=lambda: identity_client.global_config_dict,
    )

The invariant is that a resume doing no work must not relabel existing producer evidence. Fresh runs, including empty fresh runs, should still create their artifact; resumes with pending work should still observe the backend before dispatch. If backfilling a missing artifact during a no-op resume, mark historical producer identity unknown rather than claiming the current backend produced the saved results.

Proposed checks: finish a fixture run reporting root A, change its /models response to root B, then resume with every rollout cached. Assert no rollout is dispatched and the existing provenance bytes remain unchanged. Also retain the before-dispatch artifact/hash assertion, and add a pending-work resume case confirming provenance is still written before dispatch.

the running Gym version and commit. Unknown values are null or absent from the corresponding
settings map. Prompt text and request metadata from the input rows are fingerprinted, not copied.

`resolved_config` holds the whole resolved Gym configuration, so two results can be compared

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE — Suggest pointing full-config comparisons to the separate YAML artifact.

This paragraph promises a resolved_config field in the provenance JSON, but the schema has no such field, and the regression test requires its absence. Readers can't perform the documented comparison through that field.

Suggested replacement for this paragraph:

The whole configuration is written separately to <output-stem>_resolved_config.yaml; it isn't embedded in this JSON. That file masks secret-shaped keys and URL passwords while retaining unresolved ${...} references. Masking is a precaution, not a guarantee: keep secrets behind environment references. Provenance keeps selected identifiers and fingerprints, removing credentials and query strings from URL-like identifiers.

This preserves the deliberate no-config-copy behavior and agrees with the CLI artifact description.

Static acceptance: the guide should direct full-setting comparisons to the YAML sidecar, stop promising a resolved_config JSON field, and retain the distinction between fingerprinted prompt content and selected plaintext identifiers.

@marcromeyn
marcromeyn force-pushed the romeyn/run-provenance branch from f0299ad to b2b6efd Compare November 3, 2026 10:22
@marcromeyn

Copy link
Copy Markdown
Contributor Author

/ok to test b2b6efd

Comment on lines +320 to +329
record = build_provenance(
config, materialized_fpath=materialized_path_for(output_fpath), prompt_config=prompt_config
)
if input_jsonl_fpath is not None:
record.datasets = sorted({*record.datasets, _identifier(input_jsonl_fpath)})
try:
servers = config
if not any(_is_model_server(node) for node in config.values()) and model_server_config is not None:
servers = model_server_config()
record.served_models = served_models(servers)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In --no-serve mode (environment_server_client is None in rollout_collection.py:4045-4049), global_config is just the collector's thin CLI config (get_global_config_dict()), while the running servers' configuration lives on identity_client.global_config_dict (as RunManifest.create at rollout_collection.py:4108-4113 uses).

Because write_run_provenance only calls model_server_config() for served_models and runs build_provenance(config, ...) on the local config alone, a --no-serve run drops all server-configured models (policy and judge), sampling_overrides, chat_template_kwargs, judge_prompt_template hashes, and judge_prompt_versions unless they happen to be repeated on the collector CLI.

Could write_run_provenance include the reachable server blocks from identity_client.global_config_dict for build_provenance as well (scoping to reachable servers like _configuration_identity in rollout_recovery.py:1986-2056 so unused server blocks with unset ${oc.env:...} interpolations don't trigger InterpolationResolutionError and degrade the record to unavailable)?

Comment thread nemo_gym/rollouts/provenance.py Outdated
Comment on lines +234 to +260
endpoint_file = server.get("endpoint_file")
if isinstance(endpoint_file, str) and endpoint_file:
return [Path(endpoint_file).read_text(encoding="utf-8").strip()]
# `base_url` (vLLM), `openai_base_url` (OpenAI-compatible), `switchyard_base_url`, ...
base_url = next((value for key, value in server.items() if str(key).endswith("base_url") and value), None)
urls = [base_url] if isinstance(base_url, str) else list(base_url or [])
return [url for url in urls if isinstance(url, str)][:SERVED_MODEL_BACKEND_LIMIT]


def _ask_backend(base_url: str, api_key: object, configured: set[str]) -> list[ServedBackend]:
request = urllib.request.Request(base_url.rstrip("/") + "/models")
if isinstance(api_key, str) and api_key and not api_key.startswith("${"):
request.add_header("Authorization", f"Bearer {api_key}")
try:
with urllib.request.urlopen(request, timeout=SERVED_MODEL_TIMEOUT_S) as response:
models = orjson.loads(response.read()).get("data") or []
except Exception as error:
# The message may carry the URL and its credentials; keep only the type.
return [ServedBackend(unknown_reason=type(error).__name__)]
served = [
ServedBackend(
id=_identifier(model["id"]) if isinstance(model.get("id"), str) else None,
root=_identifier(model["root"]) if isinstance(model.get("root"), str) else None,
)
for model in models
if isinstance(model, Mapping)
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two isolation bugs and a worst-case stall in backend probing:

  1. In _ask_backend, urllib.request.Request(...) (line 244) and the served = [...] comprehension (lines 253–260) sit outside try/except. If endpoint_file is momentarily empty during endpoint rotation (_backend_urls returns [""], whereas VLLMModel._maybe_rebind_endpoint treats an empty file as unpublished and keeps base_url), if base_url still holds an unresolved ${...} placeholder, or if one backend returns {"data": 123}, ValueError/TypeError escapes served_models() and discards observations from every healthy backend/server. Wrapping the full body of _ask_backend in try/except and falling back to base_url when endpoint_file is blank avoids both.
  2. for url in urls: (lines 299–300) probes up to SERVED_MODEL_BACKEND_LIMIT = 8 backends serially with a 5 s timeout each, so unreachable backends stall pre-dispatch for up to 40 s per model server instead of 5 s. Probing concurrently (e.g. ThreadPoolExecutor(max_workers=SERVED_MODEL_BACKEND_LIMIT)) keeps worst-case latency bounded to one timeout.

Comment thread nemo_gym/rollouts/provenance.py Outdated
Comment on lines +167 to +174
elif isinstance(value, Mapping) and key not in {
"env",
"headers",
"default_headers",
"openai_default_headers",
"metadata",
"extra_body",
}:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beyond secrets (Harbor's operator-secret map, flagged above), this manual recursion skip-list also descends into vllm_serve_env_vars (LocalVLLMModelConfig) and auth (sandbox.<provider>.images.auth), so any secret entry whose key matches _MODEL_KEYS or _SAMPLING_KEYS will be copied into provenance.json.

Rather than maintaining another parallel blocklist and URL parser (_identifier at lines 104–115, which also misses protocol-relative //user:secret@host/...?token=... and @ inside schemeless passwords), could we share credential-key detection with _is_credential_name (rollout_recovery.py:1940) / looks_like_secret_key (secret_utils.py:247) and centralize URL userinfo + query-string stripping in nemo_gym/config/secret_utils.py?

Comment on lines +287 to +293
urls = _backend_urls(server)
api_key = next((value for key, value in server.items() if str(key).endswith("api_key")), None)
configured = {
_identifier(value)
for key, value in server.items()
if key in ("model", "openai_model", "served_model_name") and isinstance(value, str)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several responses_api_models servers don't line up with served_models() / _MODEL_KEYS yet:

  • switchyard_model: _backend_urls notes switchyard_base_url (line 237), but "switchyard_model" (SwitchyardModelConfig) is missing from both _MODEL_KEYS (lines 47–58) and configured (line 292), so models omits it and multi-route /models catalogs always fail matching.
  • local_vllm_model / genrm_model / local_vllm_model_proxy: launch/head config has base_url: []; the live backend URL is populated inside the model server process and exposed via GET /get_inner_vllm_config.
  • default_headers / openai_default_headers: not forwarded on /models probes, breaking gateways that authenticate or route via custom headers.
  • azure_openai_model: uses an api-key header and /openai/models?api-version=<default_query.api-version>, so GET <openai_base_url>/models with Bearer auth always fails (should either build the Azure request or record an explicit unsupported reason).

Comment thread nemo_gym/rollouts/provenance.py Outdated
Comment on lines +203 to +215
params = row.get("responses_create_params") or {}
if not isinstance(params, Mapping):
record.input_sampling_rows_skipped += 1
continue
metadata = params.get("metadata")
if metadata is None:
metadata = {}
if not isinstance(metadata, Mapping):
record.input_sampling_rows_skipped += 1
continue
source = row.get("task_source")
if isinstance(source, str):
datasets.add(_identifier(source))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three gaps in dataset and materialized-row extraction:

  1. Agent/resources server blocks and Harbor generated configs declare datasets as datasets: [{"name": ..., "jsonl_fpath": ...}], which visit() (lines 149–150, 167) never sees because it doesn't inspect datasets lists or jsonl_fpath.
  2. Materialized rows using MaterializedTask (task_input.responses_create_params and Harbor multi-turn task_input.turns[*].responses_create_params) yield empty input_sampling_parameters because line 203 only checks top-level row.get("responses_create_params").
  3. Lines 213–215 extract row.get("task_source") after the params / metadata continue guards, dropping valid dataset identity whenever a row has non-mapping sampling metadata.

@marcromeyn

Copy link
Copy Markdown
Contributor Author

/ok to test 2afe85f

@marcromeyn

Copy link
Copy Markdown
Contributor Author

Thanks, these all check out. Pushed 2afe85f:

  • Probing: each backend's probe is isolated, so a malformed /models answer, an unresolved ${...} URL or an empty endpoint file only marks that backend unknown. An empty endpoint file falls back to base_url, as VLLMModel does. Backends are probed concurrently, so unreachable ones cost one timeout.
  • Secrets: the walk skips every mapping looks_like_secret_key or the credential-name matcher flags (moved to secret_utils.is_credential_name), plus env/*env_vars. _identifier is now secret_utils.url_without_credentials, which also handles //user:secret@host and an @ inside a password.

For the other three (the --no-serve server config, the switchyard/local vLLM/headers/Azure servers, and the datasets: lists and MaterializedTask rows), would you like them in this PR, or as a follow-up so this can merge?

@lafrancef

Copy link
Copy Markdown
Contributor

Thanks Marc, the probing and credential fixes in 2afe85f look good. A follow-up is fine for the other three (the server config under --no-serve; the switchyard, local vLLM and genrm model servers in served_models(); and datasets: lists plus MaterializedTask/multi-turn rows). Could you open an issue or follow-up PR for those so they're tracked? If you rebase onto main and get "Classify changes" and Nemo_CICD_Test green, I'll approve.

Writes <stem>_provenance.json beside the rollouts before the first rollout is
dispatched: Gym version and commit, model, dataset and sampling identifiers
(credentials dropped from URL-like values), fingerprints of the materialized
inputs, prompts and templates, the seed, and an Eval Factory config reference
when the caller passes one (efb_config_ref).

Each model server's backends are asked once what they serve (GET
<base_url>/models): the served id and, for vLLM, the loaded checkpoint (root),
so a claimed model can be checked against the served one. A hosted catalog is
narrowed to the configured model. A --no-serve collection takes the model
servers from the head server's config. A backend that does not answer, or
reports no root, is recorded as unknown with the reason; nothing is taken from
the configured names. The masked config itself is saved separately (#4908), so
it is not copied here.

Signed-off-by: Marc Romeyn <[email protected]>
@marcromeyn

Copy link
Copy Markdown
Contributor Author

/ok to test 2afb1b1

@marcromeyn
marcromeyn force-pushed the romeyn/run-provenance branch from 2afe85f to 2afb1b1 Compare November 20, 2026 16:38
…walk out of credentials

A backend's malformed /models answer, an unresolved ${...} URL or a blank endpoint
file no longer discards the other servers' answers; a blank endpoint file falls
back to base_url, as the model server does. Backends are asked concurrently, so
unreachable ones cost about one timeout per run.

The config walk skips every mapping the saved config masks or whose name is a
credential (secrets, auth, headers) and environment maps (env, vllm_serve_env_vars).
The credential-name matcher moves from rollout recovery into secret_utils, beside a
shared url_without_credentials that also strips protocol-relative URLs and
passwords holding an unencoded @.

Signed-off-by: Marc Romeyn <[email protected]>
@marcromeyn

Copy link
Copy Markdown
Contributor Author

/ok to test b61b2b4

@marcromeyn

Copy link
Copy Markdown
Contributor Author

Thanks Frederic. Rebased onto main and signed off in b61b2b4; the other three are tracked in #6562.

@lafrancef
lafrancef added this pull request to the merge queue Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44793323582

Merged via the queue into main with commit da75c43 Nov 20, 2026
143 of 148 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants