Repository navigation
feat(eval): save the masked config beside rollouts from gym eval run - #4908
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — one BLOCKER in credential masking and one RISK in CLI coverage.
Completed static review of all five changed files and directly affected configuration, CLI dispatch, and collection paths. Tests were inspected but could not be executed in this read-only review.
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.
| masked = {} | ||
| for key, value in data.items(): | ||
| if isinstance(value, dict): | ||
| masked[key] = hide_secrets_in_container(value) |
There was a problem hiding this comment.
BLOCKER — Custom authentication headers remain readable in the saved config
Failure / blast radius: hide_secrets_in_container({"openai_default_headers": {"X-Auth": "credential-canary"}}) returns the credential unchanged: the dictionary branch ignores the secret-shaped parent, and X-Auth does not match the key predicate. This is a supported credential path: the model config accepts arbitrary string headers, and passes them to its upstream client. The new sidecar writer therefore persists that live credential in an artifact described as safe to share. Expected: custom header values are masked too.
Correction: Handle the supported header credential map before ordinary structural recursion. A narrow replacement for this dictionary branch is:
if isinstance(value, dict):
if key == "openai_default_headers":
masked[key] = {name: MASKED_VALUE for name in value}
else:
masked[key] = hide_secrets_in_container(value)This suggestion is source-traced, not executed; verify before adopting. Do not instead blanket-mask every dictionary with a secret-shaped name: structural namespaces such as token_id_capture contain nonsecret run settings that must remain inspectable.
Preservation / acceptance: Add proposed helper and writer regressions using openai_default_headers={"X-Auth": "credential-canary", "Authorization": "Bearer another-canary"}; both saved values must be ****, header names must survive, neither canary may occur in the file, and the input must remain unchanged. Also assert token_id_capture={"enabled": true, "sink": "pkg:Sink"} remains intact. Retain the existing tests asserting scalar/list secret masking and preservation of unresolved ${...} strings.
There was a problem hiding this comment.
Fixed in fae9b7c. hide_secrets_in_container now masks every value under any header-named map (header names are kept), which also covers vllm_model and switchyard_model. Added regressions with your canaries; token_id_capture stays intact.
| OmegaConf.to_container(rollout_collection_config_dict) | ||
| ) | ||
|
|
||
| write_resolved_config(global_config_dict, output_fpath) |
There was a problem hiding this comment.
RISK — The sidecar is missing for gym eval run --no-serve
Failure / blast radius: This call covers only end-to-end collection. CLI dispatch routes gym eval run --no-serve --agent a --input tasks.jsonl --output run.jsonl to collect_rollouts, which never invokes the writer. That supported mode produces rollouts without the promised sibling config, leaving subsequent artifact consumers unable to recover its run configuration.
Correction: Keep this end-to-end call, and add the same write to collect_rollouts immediately after validating RolloutCollectionConfig, before collection starts:
from nemo_gym.resolved_config import write_resolved_config
# ... existing config loading and validation ...
write_resolved_config(global_config_dict, Path(config.output_jsonl_fpath))Use the original global config, not a Pydantic dump, so interpolation strings remain unresolved. This is a source-traced suggestion, not an executed patch; verify before adopting. The invariant is that both eval run dispatch branches save the masked sidecar before collection, without making no-serve start servers.
Preservation / acceptance: Proposed regression: provide a minimal valid no-serve config and mock the async collector; inside its invocation assert the sibling YAML already exists, secrets are masked, and a nonsecret interpolation remains literal. Invoke twice with different attempt values and expect the second value, with no temporary files left. Retain the router assertions that default runs dispatch end-to-end and no-serve runs dispatch to standalone collection. Verify the existing end-to-end write still occurs before RunHelper.start, including custom-driver runs.
There was a problem hiding this comment.
Fixed in fae9b7c. collect_rollouts now writes the sidecar right after validating RolloutCollectionConfig, before collection starts; the end-to-end write is unchanged. Added a test that mocks the collector and checks the file exists inside the call, secrets are masked, interpolations stay literal, and a second attempt overwrites the first.
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — both prior findings are fixed; no eligible BLOCKER or RISK remains.
- Header masking now masks custom authentication-header values while retaining header names and nonsecret structural settings. The regressions cover both prior credential canaries, input preservation, and
token_id_capturepreservation. - Standalone collection now writes the sidecar before collecting. The new regression checks masking, literal interpolations, and overwrite behavior. The end-to-end write remains before server startup.
Completed the follow-up comparison against the prior-reviewed head across all five changed files and directly affected configuration and CLI paths. No new escalation-eligible regression found. Static review only; tests were inspected, not executed.
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 findings-only review. Request a full review with /review reset=true.
|
@marcromeyn thanks for checking this against the head. I reproduced the URL case. I'd like to push back a bit on how to handle it, because I think some of it is the wrong layer. The file keeps I'll mask the password in I'd stop there for URLs. Query parameters would be guesses by name, and several real shapes can't be reached by masking at all: webhook URLs with the secret in the path (Slack, Discord), JDBC and ODBC-style strings ( On the other note, the On the EvalRDL reader not reading |
A credential pasted into a URL under an ordinary key (base_url, a DSN, a
tracking URI) was written to the saved config and to the exporters in plain
text. The password in scheme://user:password@host is now masked and the rest
of the URL stays. This is only a precaution; the docs say secrets belong
behind ${oc.env:NAME} or env.yaml.
Signed-off-by: Tomasz Grzegorzek <[email protected]>
|
/review |
The detector reads scheme://user:password@host in the tests, the docstring and the docs row as credentials. Reword the prose so it no longer carries the pattern, and allowlist the example URLs in the tests. Signed-off-by: Tomasz Grzegorzek <[email protected]>
|
/ok to test 7c4ebf5 |
iguehring-nvidia
left a comment
There was a problem hiding this comment.
Approving on Marta's stead.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40681006650 |
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]>
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]>
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]>
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]>
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]>
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]>
…ch (NVIDIA-NeMo#5134) * feat(eval): record run provenance and the served models before dispatch 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 (NVIDIA-NeMo#4908), so it is not copied here. Signed-off-by: Marc Romeyn <[email protected]> * fix(eval): keep provenance's model probes independent and its config 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]> --------- Signed-off-by: Marc Romeyn <[email protected]>
Summary
gym eval run(end-to-end and--no-serve) writes<stem>_resolved_config.yamlbeside the rollouts before collection: secrets masked (secret-shaped keys and every value under a header map),${...}left unresolved, written atomically, overwritten per attempt.New
hide_secrets_in_containermasks plain dict/list trees without resolving interpolations (recursively_hide_secretsraises on an unset${oc.env:...}), plusresolved_config_path_forandwrite_resolved_config.Both maskers (this one, and
recursively_hide_secrets, which the exporters and config logging use) also mask the password in ascheme://user:password@hostURL and keep the rest of the URL. That is only a precaution: secrets belong behind${oc.env:NAME}orenv.yaml, never literal in a config, and the docs say so. Query parameters, webhook URLs with the secret in the path and JDBC-style strings are not masked.CLI reference: an "Output files" table for
gym eval run, including the saved config.No behavior change beyond the extra file. Part of #2977 (export-aware evaluation runs).
Overall goal
gym eval exportis ATIF-only today. The goal is pluggable exporters that receive a finished run (the rollouts file and its sibling files) and decide what to read or upload, so runs reach MLflow, W&B or EvalRDL without live exporters andgym eval submitcan export after each benchmark.gym eval export <exporter> +rollouts_jsonl_fpath=... +key=value, withatifas the default.RunArtifactsderives a run's files; the saved config records what the run was configured to do, which is why this PR comes first.<stem>_<exporter>_export_doneprevents exporting a run twice. Settings and credentials come from the export command, never from the masked saved config.PR plan
Separate PRs; steps 1-8 are stacked (stack #4910). Goal: make
gym eval exportpluggable so a finished run can go to tracking systems without live exporters, andgym eval submitcan export after each benchmark.gym eval runRunArtifactsand path derivation helpers (feat(eval): add RunArtifacts to derive a run's files from its rollouts path #4909)Exporterbase class and registry, starting withatif, plus the positional exporter CLI argument (--formatdeprecated) (feat(eval): add the Exporter base class and registry, with atif as the first exporter #4911)mlflowandwandbexport: shared metrics flattening,BaseExporter.export()and the already-exported guard (feat(eval): export a finished run to MLflow or W&B with gym eval export #4914)gym eval submitintegration: anexportmap with job-level defaults and per-benchmark overrides, validation, install extras, and a job-script tail (Slurm only at first) (feat(orchestration): run exports after each benchmark of gym eval submit #4974)Validation
test_resolved_config.pyandtest_secret_utils.py: 30 passed (masking, header maps, URL passwords, unresolved interpolations, overwrite,--no-servewrites before collecting).pre-commit: passed.test_cli_eval.pydoes not collect locally (devtoolsmissing); same onmain.Rollout evidence
N/A: no agent, verifier or model behavior is touched. The
--no-servecall site has a unit test; the end-to-end one is# pragma: no coverand no smokegym eval runwas run.