Skip to content

fix(recovery): resubmit refused reader steps, end the chain on nothing to retry, forward the uv lock timeout - #5513

Closed
AdamRajfer wants to merge 21 commits into
arajfer/sandbox-failuresfrom
arajfer/recovery-headless-followups
Closed

AdamRajfer wants to merge 21 commits into
arajfer/sandbox-failuresfrom
arajfer/recovery-headless-followups

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to the recovery stack that remove manual steps an operator needed to recover a run. Stacked on arajfer/stack-top (#5451); it lands after the stack.

What changes

  • A refused reader step is submitted again. A recovery reader whose Slurm step srun refused outright (a per-user submit or QOS limit, or no node free for an immediate start) used to read nothing, so gym eval resubmit --recover --inspect returned UNKNOWN. Such a submission was never queued, so the reader now submits it again after 15 s, doubling up to 60 s, with a progress line each time (gym-reader progress: the reader step was refused (...); retrying in N s), for as long as the reader queue wait allows. Any other srun failure, and a refusal that outlasts the wait, end as before; the reason then says how long it resubmitted.
  • A segment with nothing eligible for retry ends its own chain. A driver that exits 76 (no task is eligible for another attempt) failed the job, so Slurm started its follow-up on a full allocation only for that follow-up to write the stop and exit. The segment now writes the stop itself, cancels the sentinel and the follow-up it queued, and journals the end in chain-end-journal.jsonl, the same way a segment that completes the run does. A deliberate stop already recorded stays; the job keeps exit 76. A driver that left one of the failure kinds the next segment's guard turns into its own stop (spin-up timeout, install failed, resume refused, credentials rejected) keeps its follow-up, so that stop and its remedy are written as before; any other kind, or none, ends the chain here.
  • A remote reader's install waits for uv's lock as long as a run does. A remote Store reader runs from a cleared environment on the cluster's login host, so a cold install of the run's pinned Gym took uv's own lock timeout instead of the caller's UV_LOCK_TIMEOUT or the 1800 s a Gym run uses. The reader command now exports UV_LOCK_TIMEOUT (the caller's value if it is a positive ASCII integer, else 1800), on the login host and before srun.
  • An explicit, journaled rerun of a masked row with no gradeable artifact. A masked result that kept a saved answer is never sampled again, so one with neither a gradeable artifact nor a recorded grade could never be measured: resume keeps it and re-verification cannot grade it. gym eval resubmit --recover --inspect now names these rows. --recover --rerun-masked-without-artifact --rerun-reason "<text>" runs them again: the exact attempts the plan finds qualifying are journaled with the reason in rollouts_rerun_masked_journal.jsonl beside the rollouts when the job is queued (and taken back if it is not), and the Store retries each like an infrastructure-masked result, counting one failed attempt within its attempt cap. An approval covers only the attempt it names; nothing reopens these rows without the flag and a reason, and a pinned reader too old to apply the approval refuses the request.
  • An explicit, journaled acknowledgement of failed judge-only jobs. After the last two judge-only jobs ended without settling a saved answer, recovery queued nothing more and nothing could clear that state. --recover --acknowledge-failed-judge-jobs --acknowledge-reason "<text>" records the reason and the ids of exactly those two jobs in judge-job-acknowledgement-journal.jsonl once the next job is accepted by the scheduler, which lets exactly one more judge-only job queue; if that one fails too, the guard stops again and needs a new acknowledgement. The stop message and --inspect name the flag.
  • A judge-only job does not wait for the policy endpoint. It judges saved answers and never calls the policy model, whose served endpoint ended with the run's allocation, yet it waited for every model endpoint's readiness and exited 1 at that limit before judging anything. The rendered job command now sets model_endpoint_readiness_timeout_seconds=0.
  • The gym-eval skill reads as one path from a cell's state to the official command, with the per-benchmark notes in references/benchmark-notes.md, and describes the changes above.

Lands later in this PR

  • A judge-only job skips only the policy endpoint's readiness wait and keeps the judge endpoint's, so an unreachable external judge stops the job early again instead of showing up as per-row judge failures.

Tests

  • Reader steps: a step refused twice by a submit limit and then started (plain and watched readers), a refusal that outlasts the wait, and an srun failure that is not a refusal (submitted once).
  • Chain end: a segment whose driver exits 76 writes the stop, cancels its sentinel and follow-up, and journals the end; with each of the four guarded failure kinds it keeps its follow-up; with another kind it still ends the chain.
  • Reader environment: UV_LOCK_TIMEOUT from the caller, the default, and invalid values, for a login-host reader and a reader step.
  • Masked rerun: the qualifying predicate and each exclusion; inspect names the rows and writes nothing; the flag without a nonempty reason or without --recover is refused; with the flag the journal line is written and the planner and Store retry the row, exhausted at the cap; without it nothing changes.
  • Judge-only acknowledgement: the guard stops without one; with one, exactly one more job queues and the line is journaled; a third failure stops again; an acknowledgement naming other jobs, or a pair with a job without an id, does not unblock; a missing or empty reason is refused; inspect writes nothing.
  • Judge-only job command: the endpoint readiness wait is off, set once.
  • Each new test fails without its change.

🤖 Generated with Claude Code

AdamRajfer and others added 4 commits November 3, 2026 18:04
…nodes is submitted again

A recovery reader whose Slurm step srun refused outright (a per-user submit or
QOS limit, or no node free for an immediate start) was treated as a step that
did not start: it was cancelled and the read gave up, so an inspect or recover
read nothing on a busy CPU partition. Such a submission was never queued, so the
reader now submits it again after 15 s, doubling up to 60 s, with a progress
line each time, for as long as the reader queue wait allows. Any other srun
failure, and a refusal that outlasts the wait, end as before; the reason then
says how long it resubmitted.

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

A driver that exits 76 (no task is eligible for another attempt) failed the
job, so Slurm started its afternotok follow-up on a full allocation, often GPU
nodes, only for that follow-up's prologue to write the stop and exit. The
segment's epilogue now writes the no-eligible-retry stop itself, cancels the
sentinel and the follow-up it queued, and journals the end in
chain-end-journal.jsonl, the same way a segment that completes the run does.
A deliberate stop already in the marker stays; the job keeps exit 76.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
…as a Gym run does

A remote Store reader runs from a cleared environment on the cluster's login
host, so a cold install of the run's pinned Gym there took uv's own default
lock timeout instead of the caller's UV_LOCK_TIMEOUT or the 1800 s a Gym run
uses, and an inspect on a busy host failed in the install. The reader command
now exports UV_LOCK_TIMEOUT (the caller's value, else 1800) on the login host
and before srun, so a reader step gets it as well.

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

The gym-eval skill is rewritten around the operator path, with the
per-benchmark notes in references/benchmark-notes.md, and states what this
PR adds: a refused reader step is submitted again, a remote reader takes
UV_LOCK_TIMEOUT, and a segment with nothing eligible for retry stops its
own chain.

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

copy-pr-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

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.

@AdamRajfer AdamRajfer self-assigned this Nov 3, 2026
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 1e7eb72

A driver that stops on a typed failure (rejected provider credentials, a
refused collection resume) leaves its kind in the driver failure file and
exits 76, and the follow-up prologue turns that kind into its stop and
remedy. The chain-end epilogue wrote the generic no-eligible-retry stop for
every exit 76 and cancelled the follow-up, so that typed stop was lost. The
epilogue now ends the chain only when the driver left no failure kind;
otherwise the job keeps its follow-up as before.

The reader's UV_LOCK_TIMEOUT check accepts only ASCII digits.

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 f4584c5

…uard stops on

The previous change kept the follow-up for every exit 76 that left a driver
failure kind. The follow-up's prologue writes a stop only for four kinds
(spin-up timeout, install failed, resume refused, credentials rejected); for
any other kind, such as a server that failed to start, it would start the
run again. The segment now ends its own chain on exit 76 unless the kind it
left is one of those four.

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 5cb015e

…gradeable artifact

A masked result that kept a saved answer is retained and never sampled
again. When it also has no recorded grade and no re-verification cause
(for example a patch artifact that was never collected), nothing can ever
measure it: resume keeps it and re-verification cannot grade it.

`gym eval resubmit --recover --rerun-masked-without-artifact --rerun-reason
TEXT` is the explicit opt-in. The default is unchanged: without the flag
these rows stay MASKED, and `--inspect` now names them in their own bucket
(`masked_without_artifact`, with a per-row reason) instead of lumping them
in with the other masked rows.

With the flag, the identities the plan finds qualifying at that moment are
appended with the reason, the time and each attempt count as one line to
`rerun-masked-journal.jsonl` beside the rollouts file, just before the job
is queued (and taken back if it is not). The Store reads that journal: an
approved row counts one failed attempt, is retried within its attempt cap
and is superseded by its next attempt. An approval names the attempt it
covered, so a later attempt is never reopened by it, and the row must still
qualify. The reason is required and must be non-empty; the flag needs
`--recover`; `--inspect` never writes.

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 11f0dce

AdamRajfer and others added 5 commits November 3, 2026 19:02
…e-only jobs

When the last two judge-only jobs of a run ended without settling a saved
answer, recovery queues no third and stops. Nothing could clear that state,
because it is derived from the tail of the judge-job journal.

`gym eval resubmit --recover --acknowledge-failed-judge-jobs
--acknowledge-reason TEXT` allows exactly one more judge-only job. The
reason is required and non-empty, the flag needs `--recover`, and
`--inspect` never writes. The acknowledgement is one line (time, user,
reason, the ids of the failed jobs it covers) in a sibling journal,
`judge-job-acknowledgement-journal.jsonl`, because the judge-job journal's
readers treat every line as a job. It is written only once the scheduler
has accepted the new job. It covers only the pair of jobs it names, so if
the extra job fails too, the next pair needs an acknowledgement of its own.

The stop text and `--inspect` name the flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
The approvals were journaled under one fixed name per directory, so two
rollouts files in the same directory would have shared them. The journal
is now named after the rollouts file it sits beside, the same way the
attempt extension is (rollouts.jsonl -> rollouts_rerun_masked_journal.jsonl).

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

The exit-76 epilogue named the four kinds the follow-up's prologue turns
into its own stop as a second, separate list. Both now come from
GUARDED_DRIVER_FAILURE_KINDS, and a test checks that the prologue has a
stop for every kind in it, so a kind added to one side cannot be missed
on the other.

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

Covers the stop text for a failed pair that includes a job without an id:
it names the unknown job, says it cannot be acknowledged, and offers no
acknowledgement flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
A judge-only re-verification job judges saved answers and never calls the
policy model, whose served endpoint ended with the run's allocation. It
still waited for every model endpoint's readiness, so it timed out after
the readiness limit and exited 1 before judging anything. The rendered
job command now sets model_endpoint_readiness_timeout_seconds to 0 (a run
argument that set it is dropped), which the job's pinned Gym reads as
"skip this check".

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 8a90c3e

…etwork that failed

`gym eval submit` verifies driver.gym_install.ref with one git ls-remote
against the repo. A short network hiccup on the submitting host made that
call time out, and the submit failed with "Could not verify
driver.gym_install.ref '<ref>' in <repo>: ... timed out" and created no job,
which read like a bad ref.

The check now retries a failure to reach the repo after 10, 30 and 60 s.
A full commit hash that a remote-tracking ref of the running Gym's own
clone of that repo already contains is verified locally, with no network
call; a local commit that was never pushed is still checked over the
network. When every attempt fails, the error says the network check
failed, how many times, and that this is not evidence the ref is missing.
A missing git binary is not retried.

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 85a8263

…retries and a pruning fetch

The local check accepted a full commit hash that a remote-tracking ref of
the running Gym's own clone contained, without asking the repo. Such a ref
can be stale: after a branch is deleted or a stack is squash-merged, the
clone keeps the old remote branch until its next pruning fetch while the
repo no longer serves the commit, and the job's install would fail later.

The network check now always decides when the repo answers, and a ref it
does not have fails the submit. Only when every attempt failed to reach
the repo is the clone consulted, and only after a successful
`git fetch --prune` of that remote, so a stale ref never vouches for a
commit; the submit then logs that the local fallback was used.

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 bd2ba70

The fixture replaced the global time.sleep and asserted the exact list of
waits, so a sleep elsewhere in the same test process (a subprocess poll,
a thread left by another test) joined the list and the assertion failed
under parallel runs. The fixture now stubs only the time module the ref
check uses.

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 1dc0e89

…adless-followups

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 776e492

@AdamRajfer
AdamRajfer changed the base branch from arajfer/stack-top to yuhez/2135-judge-recovery November 3, 2026 19:44
@AdamRajfer
AdamRajfer changed the base branch from yuhez/2135-judge-recovery to arajfer/sandbox-failures November 3, 2026 19:51
The gym-eval skill keeps this branch's layout with the sandbox-failures
description of a memory-killed sandbox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
@AdamRajfer
AdamRajfer added this pull request to stack #5408 November 3, 2026 19:54
@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 4ad0ff5

…very-headless-followups

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 0862152

…very-headless-followups

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 1e2da0b

gym-eval: install the gym CLI at the pinned commit (the runner's own form),
say the page links need a full Gym checkout, name the reader-step srun
variable with an example, describe the chain end without assuming the pin,
the chain bookkeeping files and their permissions, the judge-only
acknowledgement, and a caveat that a verifier-timeout row can read as
measured in coverage while recovery marks it masked.

gym-add-model-config: point at the gym-eval steps that exist, and check
that the served chat template renders tools (and how to see in the
rollouts that it did).

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 b4afb58

… score flags

The remote reader installs the run's pinned Gym without extras, so its
query of the exported run's status on the tracking server failed with
ModuleNotFoundError: No module named 'mlflow', and MLflow delivery stayed
unverified for a run that had exported. The reader now installs the same
mlflow extra the login-host export uses. No gate rule changes.

The gate's "score unavailable: no requested metric was read" now names
the flags that read a score: --score-key, and --score-agent or
--score-environment for a Gym aggregate, which is a list of entries.

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 030da2b

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

Folded into #5343: this PR's 17 commits (a0188dd, 0b46d05, d9e0269, 1e7eb72, f4584c5, 5cb015e, 11f0dce, 7e1d84c, 2a0a360, e0af887, dbfcc08, 8a90c3e, 85a8263, bd2ba70, 1dc0e89, b4afb58, 030da2b) are cherry-picked, in order, onto #5343's branch, which now carries them as the 17 commits after 3606f43, up to 18f9cbb. This branch is kept as it is.

This branch was previously deployed

1 inactive deployment
public — 030da2ba Deployed Nov 4, 2026 by copy-pr-bot[bot] via release / finalize / notify #9767
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.

1 participant