Skip to content

feat(timeouts): typed deadline evidence at RemoteAgent limits and the collector /run deadline - #5512

Closed
AdamRajfer wants to merge 35 commits into
arajfer/sandbox-failuresfrom
arajfer/deadline-evidence
Closed

AdamRajfer wants to merge 35 commits into
arajfer/sandbox-failuresfrom
arajfer/deadline-evidence

Conversation

@AdamRajfer

@AdamRajfer AdamRajfer commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Draft. Builds on #5072 (base: its branch). It answers the two timeout-reporting items from this #5072 review, accepted in this reply: typed timeout evidence for the deadlines that today end a rollout with text only.

Problem

Three deadlines end a rollout without evidence the timeout reader (classify_timeout) recognises:

  • RemoteAgent's per-request limit (remote_responses_timeout_secs) and whole-run limit (run_timeout_secs) produce a remote_agent_error row whose only trace is the error text. The whole-run message does not say what the run was doing when it was cut.
  • An expired collector HTTP deadline for /run keeps its named collection failure, but nothing marks it as a timeout.

Change

Each deadline now writes a TimeoutEvent on the row (limit, enforcer, configured and elapsed time), tied by event id to a failure event.

  • RemoteAgent observes a remote_agent:request_deadline or remote_agent:run_deadline failure. It names the active operation (seed_session, agent or verify) as its operation and stage, and keeps the error that ended the step as its cause. The error messages are unchanged. The per-request deadline crosses the agent's self-post as RemoteAgentDeadlineError, the way the terminal error class already does. Both names are now recovered exactly from the serialized error, not by a substring search, so a message that merely mentions one of them is not misread.
  • Collection's own transport deadline (a TimeoutError with no status) records its deadline under the collection.run limit, tied to the collection's dispatch failure, which is kept as before.

A healthy run, an HTTP error status and a refused connection carry no deadline evidence.

Compatibility

  • The failures are observed, not selected, and their kinds are namespaced, so routing, retries and scores are unchanged.
  • timeouts is now a reserved result key in RemoteAgent.

Tests

  • RemoteAgent: per-request and whole-run deadlines in each operation, the event-id tie, the reserved key, the no-evidence cases, and a message that only mentions an error name.
  • Collection: a transport deadline carries collection.run evidence; an HTTP status and a refused connection do not.
  • The remote agent and rollout collection suites pass on this base.

🤖 Generated with Claude Code

…he collector's /run deadline

Three deadlines ended a rollout without evidence the timeout reader
(classify_timeout) recognises:

- RemoteAgent's per-request limit (remote_responses_timeout_secs) and
  whole-run limit (run_timeout_secs) produced a remote_agent_error row
  whose only trace was text; the whole-run message did not say what the
  run was doing when it was cut;
- an expired collector HTTP deadline for /run kept its named collection
  failure, but nothing marked it as a timeout.

Each now writes a TimeoutEvent on the row (limit, enforcer, configured
and elapsed time) tied by event id to a failure event:

- RemoteAgent observes a remote_agent:request_deadline or
  remote_agent:run_deadline failure that names the active operation
  (seed_session, agent or verify) as its operation and stage and keeps
  the error that ended the step as its cause; the whole-run message
  names the operation too. The per-request deadline crosses the agent's
  self-post as RemoteAgentDeadlineError, the way the terminal class
  already does. The failures are observed, not selected, and their kinds
  are namespaced, so routing, retries and scores are unchanged.
- Collection's own transport deadline (a TimeoutError with no status)
  records its deadline under the collection.run limit, tied to
  Collection's dispatch failure, which is preserved as before.

A healthy run, an HTTP error status and a refused connection carry no
deadline evidence.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AdamRajfer AdamRajfer self-assigned this Nov 3, 2026
@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 and others added 16 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]>
…e dispatch failure report

_collection_failure_report never read it; the routing class stays on the outcome row.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The message consumers may match is unchanged. The step the run was in when the deadline cut it stays on the typed failure event and its timeout event, where the operation belongs.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[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]>
The self-post 500 body is the JSON string repr of the raised error, so the class is its leading name. Terminal and deadline classification now compare that name instead of searching the body, so an error whose message merely mentions either class is no longer classified by it.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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]>
…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]>
…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]>
…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]>
Main moved the registries into nemo_gym/environment (#5298) and replaced
the cli_setup_command shim with a moved-path entry (#5300); both merge
cleanly with this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
Base automatically changed from arajfer/failure-reporting to main November 3, 2026 19:04
AdamRajfer and others added 6 commits November 3, 2026 20:08
…dline-evidence

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
Main squash-merged #5072 as one commit whose tree is identical to the
failure-reporting head this branch just merged (8a50c94). Taken as it
stands on this branch, which already contains all of main's content.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
…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]>
…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]>
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]>
…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 a7bc096

@AdamRajfer
AdamRajfer changed the base branch from main to arajfer/recovery-headless-followups 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
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Brings in the base branch's latest head, which merges main through #5564 (the episode modules split into types, context and failure records) and later main changes. This layer's imports of moved names follow the new modules. Import paths only.

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 60c7a33

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 60c7a33

@AdamRajfer

Copy link
Copy Markdown
Contributor Author

/ok to test 2ed5b7f

Brings in the base branch's merge of main, which now carries #5343 as one squashed commit. The tree is unchanged.

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 4854d78

@AdamRajfer
AdamRajfer removed this pull request from stack #5408 November 4, 2026 13:57
@AdamRajfer
AdamRajfer changed the base branch from arajfer/recovery-headless-followups to arajfer/sandbox-failures November 4, 2026 13:59
@AdamRajfer AdamRajfer closed this Nov 4, 2026
AdamRajfer added a commit that referenced this pull request Nov 5, 2026
…he collector's /run deadline

The deadline evidence of #5512, rebuilt on the judge-recovery branch
without the sandbox-failure work it used to sit on:

- RemoteAgent records a typed deadline event when one of its own limits
  ends a run, and recovers a serialized error class by its exact name.
- When Collection's own HTTP deadline for a /run expires, the dispatch
  failure row carries a typed `collection.run` timeout tied to Collection's
  failure report, so the timeout reader counts it.
- The dispatch failure report no longer takes the unused failure class.

The only adaptation is in rollout collection: the failure report is built
before the row is finalized, so the timeout event can name it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
gwarmstrong pushed a commit to gwarmstrong/Gym that referenced this pull request Nov 5, 2026
… collector /run deadline (NVIDIA-NeMo#5603)

* feat(timeouts): typed deadline evidence at RemoteAgent's limits and the collector's /run deadline

The deadline evidence of NVIDIA-NeMo#5512, rebuilt on the judge-recovery branch
without the sandbox-failure work it used to sit on:

- RemoteAgent records a typed deadline event when one of its own limits
  ends a run, and recovers a serialized error class by its exact name.
- When Collection's own HTTP deadline for a /run expires, the dispatch
  failure row carries a typed `collection.run` timeout tied to Collection's
  failure report, so the timeout reader counts it.
- The dispatch failure report no longer takes the unused failure class.

The only adaptation is in rollout collection: the failure report is built
before the row is finalized, so the timeout event can name it.

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

* fix(remote_agent): a body-read timeout is the request deadline too

A timeout while waiting for the response headers already raised the
deadline error and left typed deadline evidence. A timeout while reading
the body of the same request raised a plain error, so the timeout reader
missed the rollout. The body read now raises the deadline error for a
timeout and keeps the generic error for every other read failure, with
the same message and cause.

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

* fix(timeouts): record only deadlines whose expiry is known

Collection sets no deadline of its own on /run: the shared client is
unbounded, so a TimeoutError there comes from a connect sub-limit or a
timeout elsewhere on the dispatch path. Drop the collection.run deadline
evidence, which attributed those to a limit that does not exist, and pin
that no transport failure carries it.

The per-request deadline's elapsed time was measured from the start of the
whole agent loop, so a timeout on a later request also counted the earlier
turns. That request's own duration does not cross the self-post, so leave
elapsed_s out of it; the whole-run deadline keeps its measured elapsed_s.

Document that `timeouts` is stripped from reused input rows.

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

---------

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

This branch was previously deployed

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