Skip to content

feat(failures): add typed boundary details - #5505

Merged
AdamRajfer merged 3 commits into
arajfer/failure-reportingfrom
glovisotto/rfc613-failure-details
Nov 3, 2026
Merged

AdamRajfer merged 3 commits into
arajfer/failure-reportingfrom
glovisotto/rfc613-failure-details

Conversation

@giuliolovisotto

@giuliolovisotto giuliolovisotto commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Change

Adds typed boundary-specific failure details, stacked on #5072 (arajfer/failure-reporting). This is the shared contract needed for the sandbox work in #5127.

  • Add SandboxFailureDetails, ModelFailureDetails and a sandbox observation boundary. The existing FailureEvent schema validates the directly constructed NgFailureEvent, including boundary/details compatibility and unknown fields.
  • Move model upload evidence from the common event fields to details.request_upload_complete. Update its producer, both policy readers and fixtures together. HTTP-status precedence and retry/verification/scoring decisions are unchanged.
  • Have the existing sandbox-credentials helper report boundary="sandbox"; Harbor's enclosing environment failure retains its own identity and cause link.
  • Preserve typed details and event IDs through recursive exception serialization, HTTP reconstruction, pickling, recovered-event forwarding and Collection persistence. Sandbox details contain only sandbox_id, execution_id, provider, provider_status_reason and exit_code. Provider reason codes and command exit codes are retained as reported. No extra attribution or policy fields.

The old upload-field layout is an unmerged #5072 draft, so there is no compatibility alias. Existing operation names (including Harbor’s sandbox.setup) are preserved; this PR introduces no operation-name vocabulary or new phase field. Standardized naming, provider-specific OOM/lifecycle migration, and new sandbox policies/defaults/overrides are follow-up work, not prerequisites for this reporting contract. No benchmark-result behavior is intentionally changed.

Validation

  • Public exports follow-up: 4 focused public-API tests passed, including external import conventions; pre-commit passed for the changed files.

  • After trimming sandbox details: 57 passed across test_failure_details, test_failure_reports and test_outcome_policy; pre-commit passed for both changed files. Earlier broader validation below applies to the preceding revision.

  • pre-commit run --all-files and git diff --cached --check pass.

  • Combined affected tests: 561 passed, 3 failed. Files: test_failure_details, test_outcome_policy, test_model_failure_observations, test_failure_reports, test_saved_generation_admission, test_agent_seed_failure_boundary; single-agent-turn test_failure_report_policy; simple-agent test_app, test_legacy_timeout_cause, test_outcome_policy_collection; Harbor test_app.

  • All three failures reproduce on unchanged base d7bb48600104def25a5d42195469ca7f7956e5b1: two macOS connection-backlog timeout cases and Harbor's /var versus /private/var snapshot-path assertion. Final focused recheck after the last edits: 31 passed.

  • Tests used Python 3.13 and pytest with -q -o addopts='' --tb=short; the shared virtualenv's namespace package paths were explicitly pinned to this checkout. New tests exercise real local HTTP transport and disk save/reload, including recovered failures with unchanged reward and no new attempt fields.

  • Real-model rollout: N/A for this representation/metadata change. No agent execution, verifier, retry budget or policy default was changed. Full core/server suites and Linux validation were not run locally; no CI monitoring was started.

  • @codex

Select sandbox/model details using the shared event schema. Move upload evidence and its policy readers together; keep event IDs and causes through transport and persistence. Unmerged draft fields have no compatibility alias.

Signed-off-by: Giulio Lovisotto <[email protected]>
@giuliolovisotto giuliolovisotto added feature New capabilities, enhancements, or enablement work area:core Shared APIs, servers, telemetry, health, and registries labels 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 AdamRajfer 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.

Thanks, this is the schema I'd like #5504 to build on. I'll drop my own SandboxFailureDetails there and consume these types. While mapping the fields across, I ran into a few things I'd like your view on before I rebase:

  1. Header budget. FailureHeader.encode sends the whole report in one header capped at 4096 bytes of compact JSON. Above that, the report is replaced by {"omitted": true}, so every event in it is lost, not just the large one. Here is what one sandbox event can carry at the current maxima:

    • provider_status_reason up to 2000;
    • four ids at 256 each;
    • failure_reason up to 2000;
    • a foreign_error message up to 2000.

    One event can therefore exceed the cap, and the memory-kill evidence would then disappear on the wire. I'd suggest:

    • bound provider_status_reason to something like 128, since it's a status reason (OOMKilled, Evicted, Error), not a message;
    • bring the ids to 128;
    • add a test that an event with every details field at its maximum, plus an SDK cause, still round-trips through FailureHeader.

    In #5504 I ended up with 64 for the provider, 128 for the ids and the reason, and 500 for any provider text. That leaves room for a typical failure reason and the SDK message.

  2. Phase. I'd read the phase from the event's stage (seed, agent, verification), following "common facts stay on this event". Is that the intent? A sandbox lost while being torn down has no stage today. Does that go in operation, or should there be a stage for it?

  3. Which container ended. For a provider-reported kill, a policy needs to tell the container that runs the agent's commands apart from a sidecar or an init container. The provider's report names it (container <name> exited with code 137 (OOMKilled)). Could memory_resource_id be documented as that container's name when the provider reports a memory kill? Otherwise a separate field would be needed.

  4. Cause. I agree with keeping inferred causes out of the schema. My plan is to have the policy read the provider's own provider_status_reason (e.g. OOMKilled), with evidence_source naming where it was read (the provider's ended-sandbox status). A 137 exit status alone would never count as a cause. Does that match how you see these two fields being used?

  5. Signal. Agreed that this is an int and that it's set only when the provider reports one. I won't derive it from a 128+n exit status.

  6. Teardown. teardown_confirmed already lives on SandboxObservation, so I don't think details needs it. Just flagging that I'm dropping it on my side.

  7. Compatibility. With extra="forbid", strict=True and a new boundary value, a checkout older than this change can't validate a record that has a sandbox event or details. Readers normally run the writer's pinned version, so this only affects a reader on an older checkout. It might be worth a line in the description.

None of this blocks the shape; points 1 and 3 are the ones I'd need settled before rebasing the producers onto it.

giuliolovisotto added a commit that referenced this pull request Nov 3, 2026
Build OpenSandbox events with the typed details contract from #5505. Preserve provider reason codes and observed exit codes; keep diagnostic origins in the failure reason. Update provider, PTY and serialization coverage together.

Signed-off-by: Giulio Lovisotto <[email protected]>
@giuliolovisotto
giuliolovisotto marked this pull request as ready for review November 3, 2026 15:53
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 3, 2026 15:54

@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 material concerns found. I inspected all 19 changed files and traced the affected schema, exception transport, persistence, model-outcome policy, and sandbox credential paths.

Static review only; I couldn't execute tests. Two delegated reports weren't returned, so I completed their assigned inspections directly.

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.

@AdamRajfer
AdamRajfer merged commit c742ce7 into arajfer/failure-reporting Nov 3, 2026
63 of 66 checks passed
@AdamRajfer
AdamRajfer deleted the glovisotto/rfc613-failure-details branch November 3, 2026 16:21
AdamRajfer added a commit that referenced this pull request Nov 3, 2026
…fer/eval-recovery-from-saved-evidence

Brings the failure-reporting branch, now merged with main (c28904a) and with the
typed boundary details of #5505, into the recovery branch at fe39633.

Main moved code the recovery branch changes: the rollout collector, store, records,
recovery and health modules into nemo_gym/rollouts, with the performance and
trajectory builders split out of the collector. This merge carries each change of the
recovery branch to the new place.

Resolutions that are not mechanical:
- The new model-call request-budget fields and the grading record carried through the
  verifier-invocation merge land in nemo_gym/rollouts/trajectory_builder.py, where main
  moved the trajectory builder.
- The reader and collector sources are unaffected: the collect script is stdlib only
  and the two imports of the remote reader resolve.
- Import lists merge main with the names the recovery branch adds, imported from the
  modules that define them now; old test-module paths are rewritten.

Signed-off-by: Adam Rajfer <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
AdamRajfer added a commit that referenced this pull request Nov 3, 2026
Brings #5072 up to its pushed head: the resume-gate and failure-kind fixes, the
docs alignment and the facade-import fix, on top of the merge of main and #5505.
Conflicts resolved by keeping both sides (imports, and two new RolloutRecords methods).

Signed-off-by: Adam Rajfer <[email protected]>
tayunvidia pushed a commit to tayunvidia/Gym that referenced this pull request Nov 5, 2026
…VIDIA-NeMo#5127)

* fix(sandbox): distinguish confirmed OOMs from unknown outcomes

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): use shared failure contracts

Preserve sandbox failure facts and causes in NgFailureEvent reports.
Keep retry choices configurable, retain recovered read failures, and
never replay ambiguous command submissions.

Consumers of the unmerged SandboxLostError hierarchy must migrate to
NgFailureEvent and registered failure kinds. Inspect diagnostics are
opt-in; elapsed time alone no longer labels a signal death as timeout.

Refs NVIDIA-NeMo#5127, NVIDIA-NeMo#5072

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): unify OpenSandbox failures

Report creation, readiness, lifecycle and PTY failures through NgFailureEvent and registered factual labels. Select creation recovery through the shared OutcomePolicy instead of exception subclasses or text markers.

Recognize SDK-wrapped transport failures without chasing arbitrary causes, preserve SDK diagnostics, and record recovered attempts. Keep command submission replay constraints and bounded PTY polling semantics.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): retain bounded delete recovery

Integrate the rebased idempotent DELETE recovery with shared failure events and OutcomePolicy. Preserve terminal-error guards, the total retry deadline and caller cancellation; retain recovered timeout observations.

Update the upstream recovery regressions for the shared event contract and cover configured FAIL overrides.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): clarify failure contracts

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): finish event migration

Raise shared events directly for unknown command outcomes and migrate the remaining backend-loss consumer. Keep OOM attribution evidence-based. Preserve structured endpoint-availability retries and Retry-After when the provider owns recovery.

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): isolate SDK failure mapping

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): adopt shared failure details

Build OpenSandbox events with the typed details contract from NVIDIA-NeMo#5505. Preserve provider reason codes and observed exit codes; keep diagnostic origins in the failure reason. Update provider, PTY and serialization coverage together.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve failures and retry downloads

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(harness): use public failure imports

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve caller failure policies

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): bound cleanup retries and waits

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix: use public failure log imports

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): clarify required failure migrations

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): retain bounded failure recovery

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): treat user fallback as control flow

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve PTY busy failures

Keep the original attachment refusal when lifecycle diagnostics cannot establish sandbox death. Preserve evidence-based OOM and unavailable failures with the refusal as their cause.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve late diagnostic budget

Charge background status diagnosis only for active lookup time so later lifecycle or inspect evidence can use the remaining budget. Keep every lookup within the original recovery deadline and preserve failed request observations.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): control deadline cancellation

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): distinguish client wait expiry

Preserve successful Running evidence when the overall wait expires. Keep failed status recovery separate and document current-event policy selection, single-attempt commands, and signal-exit grading.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): require attributed OOM evidence

Lifecycle reasons have no container identity. Preserve terminal reasons
as unavailability until current user-container inspect confirms OOM,
so sidecar failures cannot select an OOM policy.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): assert exhausted PTY busy kind

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve ended-report evidence

Keep bounded command-status 410 bodies through the SDK error converter.
Require explicit report-contract opt-in and the server-proxy route
before interpreting the observed ended-sandbox format as OOM evidence.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): align lifecycle OOM expectation

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): distinguish client wait expiry

Classify the deadline that actually ends status polling. Preserve a clipped read as the cause without calling client expiry exhausted status recovery or losing the last Running observation.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): bound OOM report guarantees

Signed-off-by: Giulio Lovisotto <[email protected]>

* feat(core): select shared failure policy by stage

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): bound verification policy defaults

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(tests): bring the docs wording and swebench sanity test in line with the sandbox failure contract

The rollout failures page said "a kill-shaped exit", which the docs test
keeps out of the latest pages; it now says a process killed by a signal.
The swebench verifier sandbox observation now carries the contract's
stage field, which is None there, so the sanity test expects it.

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

* refactor(core): unify failure classification

Share stage-aware responsibility and HTTP evidence rules across policies and reporting. Keep observed kinds intact and select actions independently by status, kind, class, then default.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs: explain shared failure classification

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix: report known verifier stage

Keep the shared classification guide scoped to each configured boundary
and distinguish worker interruptions from verifier-container OOMs.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): enforce shared policy configuration

Validate every action rule against boundary capabilities. Distinguish missing classification from explicit unknown, and pass configured classification through agent and sandbox adapters.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): classify namespaced failure kinds

Allow valid producer namespaces in classification overrides without widening action-rule kind validation. Reuse the private default configuration for repeated reporting calls.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): recheck inspect on termination

An initial inspect can run before a sandbox terminates. Allow one final inspect when lifecycle status becomes terminal, bounded by the unchanged diagnostic deadline.

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit 78abab71650b47c38c21a2cf5576f52256320709)

---------

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
Co-authored-by: Giulio Lovisotto <[email protected]>
Co-authored-by: Adam Rajfer <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
jin-nvidia pushed a commit to cparisien/Gym that referenced this pull request Nov 5, 2026
…lures (NVIDIA-NeMo#5128)

* fix(sandbox): distinguish confirmed OOMs from unknown outcomes

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): use shared failure contracts

Preserve sandbox failure facts and causes in NgFailureEvent reports.
Keep retry choices configurable, retain recovered read failures, and
never replay ambiguous command submissions.

Consumers of the unmerged SandboxLostError hierarchy must migrate to
NgFailureEvent and registered failure kinds. Inspect diagnostics are
opt-in; elapsed time alone no longer labels a signal death as timeout.

Refs NVIDIA-NeMo#5127, NVIDIA-NeMo#5072

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): unify OpenSandbox failures

Report creation, readiness, lifecycle and PTY failures through NgFailureEvent and registered factual labels. Select creation recovery through the shared OutcomePolicy instead of exception subclasses or text markers.

Recognize SDK-wrapped transport failures without chasing arbitrary causes, preserve SDK diagnostics, and record recovered attempts. Keep command submission replay constraints and bounded PTY polling semantics.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): retain bounded delete recovery

Integrate the rebased idempotent DELETE recovery with shared failure events and OutcomePolicy. Preserve terminal-error guards, the total retry deadline and caller cancellation; retain recovered timeout observations.

Update the upstream recovery regressions for the shared event contract and cover configured FAIL overrides.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): clarify failure contracts

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): finish event migration

Raise shared events directly for unknown command outcomes and migrate the remaining backend-loss consumer. Keep OOM attribution evidence-based. Preserve structured endpoint-availability retries and Retry-After when the provider owns recovery.

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): isolate SDK failure mapping

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): adopt shared failure details

Build OpenSandbox events with the typed details contract from NVIDIA-NeMo#5505. Preserve provider reason codes and observed exit codes; keep diagnostic origins in the failure reason. Update provider, PTY and serialization coverage together.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve failures and retry downloads

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(harness): use public failure imports

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve caller failure policies

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): bound cleanup retries and waits

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix: use public failure log imports

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): clarify required failure migrations

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): retain bounded failure recovery

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): treat user fallback as control flow

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve PTY busy failures

Keep the original attachment refusal when lifecycle diagnostics cannot establish sandbox death. Preserve evidence-based OOM and unavailable failures with the refusal as their cause.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve late diagnostic budget

Charge background status diagnosis only for active lookup time so later lifecycle or inspect evidence can use the remaining budget. Keep every lookup within the original recovery deadline and preserve failed request observations.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): control deadline cancellation

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): distinguish client wait expiry

Preserve successful Running evidence when the overall wait expires. Keep failed status recovery separate and document current-event policy selection, single-attempt commands, and signal-exit grading.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): require attributed OOM evidence

Lifecycle reasons have no container identity. Preserve terminal reasons
as unavailability until current user-container inspect confirms OOM,
so sidecar failures cannot select an OOM policy.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): assert exhausted PTY busy kind

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve ended-report evidence

Keep bounded command-status 410 bodies through the SDK error converter.
Require explicit report-contract opt-in and the server-proxy route
before interpreting the observed ended-sandbox format as OOM evidence.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): align lifecycle OOM expectation

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): distinguish client wait expiry

Classify the deadline that actually ends status polling. Preserve a clipped read as the cause without calling client expiry exhausted status recovery or losing the last Running observation.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): bound OOM report guarantees

Signed-off-by: Giulio Lovisotto <[email protected]>

* feat(core): select shared failure policy by stage

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): bound verification policy defaults

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(tests): bring the docs wording and swebench sanity test in line with the sandbox failure contract

The rollout failures page said "a kill-shaped exit", which the docs test
keeps out of the latest pages; it now says a process killed by a signal.
The swebench verifier sandbox observation now carries the contract's
stage field, which is None there, so the sanity test expects it.

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

* refactor(core): unify failure classification

Share stage-aware responsibility and HTTP evidence rules across policies and reporting. Keep observed kinds intact and select actions independently by status, kind, class, then default.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs: explain shared failure classification

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix: report known verifier stage

Keep the shared classification guide scoped to each configured boundary
and distinguish worker interruptions from verifier-container OOMs.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): enforce shared policy configuration

Validate every action rule against boundary capabilities. Distinguish missing classification from explicit unknown, and pass configured classification through agent and sandbox adapters.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): classify namespaced failure kinds

Allow valid producer namespaces in classification overrides without widening action-rule kind validation. Reuse the private default configuration for repeated reporting calls.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): recheck inspect on termination

An initial inspect can run before a sandbox terminates. Allow one final inspect when lifecycle status becomes terminal, bounded by the unchanged diagnostic deadline.

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit 78abab71650b47c38c21a2cf5576f52256320709)

* fix(opencode): report confirmed sandbox OOMs and preserve capture failures

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): preserve canonical failure handoff

Keep failure IDs and bounded observations across cached agent replies and checkpoint restoration so verifiers receive the original provider evidence. Forward diagnostic reports without selecting a terminal failure; missing evidence remains ungradable.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): preserve harness failure policy

Keep ungraded setup and capture failures typed and evaluation-side. Preserve canonical provider events and strict artifact checks. Report confirmed OOM outcomes through the existing environment policy so configured fail or retry actions apply, while the default still verifies and the verifier owns scoring.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): retain command failure diagnostics

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(agent): bound OpenCode staging wait

Bound staging queue, upload attempts and backoff by the configured timeout. Preserve harness attribution and command exit facts when execution cannot be classified, and document separate setup and task budgets.

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(opencode): use shared failure stages

Replace the sandbox observation phase field with canonical stage. Keep
origin stages and event identities when forwarding execution failures.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): retain exports on snapshot timeout

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit 199db43397e63c1b057b2b6ec24fde699d0164b8)

* test(swebench): assert full sandbox observation

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit db417b07adabf6bd375a1707cbd6e387a9eff970)

---------

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
Co-authored-by: Giulio Lovisotto <[email protected]>
Co-authored-by: Adam Rajfer <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
JeffPengCoder pushed a commit to JeffPengCoder/Gym that referenced this pull request Nov 6, 2026
…NVIDIA-NeMo#5129)

* fix(sandbox): distinguish confirmed OOMs from unknown outcomes

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): use shared failure contracts

Preserve sandbox failure facts and causes in NgFailureEvent reports.
Keep retry choices configurable, retain recovered read failures, and
never replay ambiguous command submissions.

Consumers of the unmerged SandboxLostError hierarchy must migrate to
NgFailureEvent and registered failure kinds. Inspect diagnostics are
opt-in; elapsed time alone no longer labels a signal death as timeout.

Refs NVIDIA-NeMo#5127, NVIDIA-NeMo#5072

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): unify OpenSandbox failures

Report creation, readiness, lifecycle and PTY failures through NgFailureEvent and registered factual labels. Select creation recovery through the shared OutcomePolicy instead of exception subclasses or text markers.

Recognize SDK-wrapped transport failures without chasing arbitrary causes, preserve SDK diagnostics, and record recovered attempts. Keep command submission replay constraints and bounded PTY polling semantics.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): retain bounded delete recovery

Integrate the rebased idempotent DELETE recovery with shared failure events and OutcomePolicy. Preserve terminal-error guards, the total retry deadline and caller cancellation; retain recovered timeout observations.

Update the upstream recovery regressions for the shared event contract and cover configured FAIL overrides.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): clarify failure contracts

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): finish event migration

Raise shared events directly for unknown command outcomes and migrate the remaining backend-loss consumer. Keep OOM attribution evidence-based. Preserve structured endpoint-availability retries and Retry-After when the provider owns recovery.

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): isolate SDK failure mapping

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(sandbox): adopt shared failure details

Build OpenSandbox events with the typed details contract from NVIDIA-NeMo#5505. Preserve provider reason codes and observed exit codes; keep diagnostic origins in the failure reason. Update provider, PTY and serialization coverage together.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve failures and retry downloads

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(harness): use public failure imports

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve caller failure policies

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): bound cleanup retries and waits

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix: use public failure log imports

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): clarify required failure migrations

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): retain bounded failure recovery

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): treat user fallback as control flow

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve PTY busy failures

Keep the original attachment refusal when lifecycle diagnostics cannot establish sandbox death. Preserve evidence-based OOM and unavailable failures with the refusal as their cause.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve late diagnostic budget

Charge background status diagnosis only for active lookup time so later lifecycle or inspect evidence can use the remaining budget. Keep every lookup within the original recovery deadline and preserve failed request observations.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): control deadline cancellation

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): distinguish client wait expiry

Preserve successful Running evidence when the overall wait expires. Keep failed status recovery separate and document current-event policy selection, single-attempt commands, and signal-exit grading.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): require attributed OOM evidence

Lifecycle reasons have no container identity. Preserve terminal reasons
as unavailability until current user-container inspect confirms OOM,
so sidecar failures cannot select an OOM policy.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): assert exhausted PTY busy kind

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): preserve ended-report evidence

Keep bounded command-status 410 bodies through the SDK error converter.
Require explicit report-contract opt-in and the server-proxy route
before interpreting the observed ended-sandbox format as OOM evidence.

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(sandbox): align lifecycle OOM expectation

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): distinguish client wait expiry

Classify the deadline that actually ends status polling. Preserve a clipped read as the cause without calling client expiry exhausted status recovery or losing the last Running observation.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(sandbox): bound OOM report guarantees

Signed-off-by: Giulio Lovisotto <[email protected]>

* feat(core): select shared failure policy by stage

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): bound verification policy defaults

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(tests): bring the docs wording and swebench sanity test in line with the sandbox failure contract

The rollout failures page said "a kill-shaped exit", which the docs test
keeps out of the latest pages; it now says a process killed by a signal.
The swebench verifier sandbox observation now carries the contract's
stage field, which is None there, so the sanity test expects it.

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

* refactor(core): unify failure classification

Share stage-aware responsibility and HTTP evidence rules across policies and reporting. Keep observed kinds intact and select actions independently by status, kind, class, then default.

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs: explain shared failure classification

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix: report known verifier stage

Keep the shared classification guide scoped to each configured boundary
and distinguish worker interruptions from verifier-container OOMs.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): enforce shared policy configuration

Validate every action rule against boundary capabilities. Distinguish missing classification from explicit unknown, and pass configured classification through agent and sandbox adapters.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(core): classify namespaced failure kinds

Allow valid producer namespaces in classification overrides without widening action-rule kind validation. Reuse the private default configuration for repeated reporting calls.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(sandbox): recheck inspect on termination

An initial inspect can run before a sandbox terminates. Allow one final inspect when lifecycle status becomes terminal, bounded by the unchanged diagnostic deadline.

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit 78abab71650b47c38c21a2cf5576f52256320709)

* fix(opencode): report confirmed sandbox OOMs and preserve capture failures

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): preserve canonical failure handoff

Keep failure IDs and bounded observations across cached agent replies and checkpoint restoration so verifiers receive the original provider evidence. Forward diagnostic reports without selecting a terminal failure; missing evidence remains ungradable.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): preserve harness failure policy

Keep ungraded setup and capture failures typed and evaluation-side. Preserve canonical provider events and strict artifact checks. Report confirmed OOM outcomes through the existing environment policy so configured fail or retry actions apply, while the default still verifies and the verifier owns scoring.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): retain command failure diagnostics

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(agent): bound OpenCode staging wait

Bound staging queue, upload attempts and backoff by the configured timeout. Preserve harness attribution and command exit facts when execution cannot be classified, and document separate setup and task budgets.

Signed-off-by: Giulio Lovisotto <[email protected]>

* refactor(opencode): use shared failure stages

Replace the sandbox observation phase field with canonical stage. Keep
origin stages and event identities when forwarding execution failures.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(opencode): retain exports on snapshot timeout

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit 199db43397e63c1b057b2b6ec24fde699d0164b8)

* test(swebench): assert full sandbox observation

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit db417b07adabf6bd375a1707cbd6e387a9eff970)

* fix(deepswe): score confirmed OOMs and reject incomplete verification

Signed-off-by: Martyna Patelka <[email protected]>
Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(deepswe): apply shared agent failure policy

Replace the dedicated scoring toggle with agent_failure_outcome_policy.
Default to terminal ungraded failure; the benchmark recipe explicitly
counts confirmed agent OOM as zero. Reject unsupported verify/retry
actions at configuration load and retain canonical evidence admission.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(deepswe): retain policy OOM attribution

Persist the applied agent failure action so recovery preserves explicit
policy zeros as settled scores. Derive model attribution only from linked
agent OOM evidence; verifier failures keep their provider classification.
Export bounded attribution facts for remote recovery without diagnostics.

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(policy): consume saved outcome decisions

Keep explicit policy zeros measured when verification is incomplete.
Admission stays with the policy owner; downstream readers consume the
persisted action without rechecking sandbox evidence or inferring model
fault. Preserve canonical failure facts and evaluation-health defaults.

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit 5b20df6055f9179952e902898ffe0eee595ed6c2)

* test(deepswe): use public failure report import

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(eval): apply recorded stage policy decisions

Configure DeepSWE overrides through outcome_policy.by_stage instead of agent_failure_outcome_policy. Shared defaults decide agent OOM scoring and verifier retries. Persist attribution alongside the action so recovery and health reporting consume the same decision; a saved fail cannot receive another retry budget.

Signed-off-by: Giulio Lovisotto <[email protected]>

* style(core): sort combined policy exports

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(rollouts): use canonical sandbox stage

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(eval): consume shared failure classification

Signed-off-by: Giulio Lovisotto <[email protected]>

* test(eval): prove class-based retry selection

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(health): use shared failure classification

Signed-off-by: Giulio Lovisotto <[email protected]>

* docs(recovery): explain shared classification

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(health): share saved classification across readers

Signed-off-by: Giulio Lovisotto <[email protected]>

* fix(health): preserve saved zero failure kinds

Signed-off-by: Giulio Lovisotto <[email protected]>
(cherry picked from commit d2a66875b33705c37f455619b6f6cc9891331720)

* fix(health): preserve refined refusal kinds

Use the selected length-refusal kind without bypassing stage rules for ordinary HTTP failures. Keep the saved event unchanged.

Signed-off-by: Giulio Lovisotto <[email protected]>

---------

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

This branch was previously deployed

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

Labels

area:core Shared APIs, servers, telemetry, health, and registries feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants