Skip to content

fix(recovery): key the operator continuation on the accounting cause; keep artifact file modes - #5594

Merged
AdamRajfer merged 2 commits into
mainfrom
arajfer/recovery-stop-cause-and-file-mode
Nov 4, 2026
Merged

AdamRajfer merged 2 commits into
mainfrom
arajfer/recovery-stop-cause-and-file-mode

Conversation

@AdamRajfer

Copy link
Copy Markdown
Contributor

Two follow-ups from the review of #5343.

Operator continuation keyed on display text

_decide_from_collected decided whether an explicit operator budget may continue a run with unknown chain accounting by comparing decision.reason with the unknown-budget and unknown-walltime reason strings. decide_recovery appends a note to the reason when the run holds masked results without a gradeable artifact, and --rerun-masked-without-artifact and --extend-attempts append their own notes. With any of them the comparison failed, so a run that should continue under the explicit budget stopped instead.

RecoveryDecision now records which accounting is unknown (accounting_unknown: "budget" or "walltime"), set where those two stops are decided and excluded from the serialized decision, so --inspect output does not change. The continuation keys on that field. The reason text is unchanged.

Regression test: a scored row, a masked row without a gradeable artifact and a missing row, with unreadable retry accounting and an explicit budget. Before: STOP ("the budget is unknown; 1 masked result(s) without a gradeable artifact…"). After: RESUBMIT under the operator continuation; the masked row stays masked and retained, the missing row resumes, and the saved rows are untouched.

Artifact file modes after the run-health rewrite

_prepare_run_health_metrics rewrites rollouts_aggregate_metrics.json and quality_summary.json through a NamedTemporaryFile, which is created 0600, so files that were group-readable became owner-only. The replacement now gets the existing file's mode, or 0666 under the process umask for a new file. Test: both files keep 0664 and 0640 after the rewrite.

Validation

  • Each new test fails without its fix and passes with it.
  • Full unit suite: the same failure set as main.
  • ruff check and format, import-linter, detect-secrets: clean.

🤖 Generated with Claude Code

… keep artifact file modes

Two follow-ups from the review of #5343.

An operator continuation of a run whose chain accounting is unknown keyed on
the decision's display reason being exactly the unknown-budget or
unknown-walltime text. A run that also holds a masked result without a
gradeable artifact gets a note appended to that reason, so the comparison
failed and the explicit budget stopped instead of continuing. The decision
now records which accounting is unknown in its own field, excluded from the
serialized output, and the continuation keys on that field. A regression test
covers a scored, a masked-without-artifact and a missing row with unreadable
retry accounting and an explicit budget: the run continues, the masked row
stays retained and the missing one resumes.

The run-health rewrite of the aggregate metrics and quality summary replaced
each file with a NamedTemporaryFile, which is created 0600, so readable
artifacts became owner-only. The replacement now carries the existing file's
mode, or the default mode under the process umask for a new file. A test
checks both files keep 0664 and 0640.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer AdamRajfer self-assigned this Nov 4, 2026
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test b3da737

@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.

SHIP

LGTM — no concerns found.

I reviewed all four changed files and traced the recovery safety guards, decision serialization, and health-export callers. The regression tests cover the decorated accounting-stop reason, retained saved rows, and artifact mode preservation.

Static review only; I didn't execute tests.

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.

The mode fix toggled the process umask to compute the default mode of a new
file. Write through rollout_recovery.atomic_output_file instead: it creates
the temporary file exclusively under the caller's umask and keeps an existing
file's mode, with no process-wide change, so there is one way to do this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test fcc877f

@giuliolovisotto giuliolovisotto 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.

Both findings from the #5343 review are addressed. Replayed the original reproductions: the masked-row case now honors the explicit operator budget, and rewriting the aggregate and quality summary preserves their existing file modes.

Validation: 150 tests passed across the recovery and export suites. test_a_job_the_scheduler_refuses_leaves_no_approval fails identically on the unchanged base, so it is not introduced here. Independent review found no blocker. LGTM.

@AdamRajfer
AdamRajfer added this pull request to the merge queue Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit d27f291 Nov 4, 2026
62 of 65 checks passed
@AdamRajfer
AdamRajfer deleted the arajfer/recovery-stop-cause-and-file-mode branch November 4, 2026 16:16
AdamRajfer added a commit that referenced this pull request Nov 4, 2026
Brings in the recovery accounting fix (#5594) and the managed-environment locks (#4837).

Resolutions:
- The planner split is regenerated from the merged planner with the same mechanical split. The only change to
  the split modules is #5594's: RecoveryDecision.accounting_unknown, set on the two unknown-accounting stops,
  and the operator continuation keying on it instead of on the reason text.
- import-linter layers: main's new orchestration layer entry (the two locked-environment CLI modules) keeps
  its place, and the recovery layer stays below it.
- The test #5594 added imports OperatorBudget from its new module.
- The old module path keeps serving the two unknown-accounting reasons, which the planner no longer imports.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AdamRajfer added a commit that referenced this pull request Nov 4, 2026
…ealth

No conflicts; git merged every file on its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
AdamRajfer added a commit that referenced this pull request Nov 4, 2026
…ez/2135-judge-recovery

No conflicts; git merged every file on its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
AdamRajfer added a commit that referenced this pull request Nov 4, 2026
…fer/deadline-evidence-on-3879

No conflicts; git merged every file on its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>

This branch was previously deployed

1 inactive deployment
public — fcc877f6 Deployed Nov 4, 2026 by copy-pr-bot[bot] via release / finalize / notify #9992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants