Skip to content

fix(always_on): an infra-failed turn is redone from its env deploy instead of scoring 0 - #933

Merged
sarah-chitty-1 merged 13 commits into
mainfrom
sarahchitty/always-on-infra-failures
Dec 2, 2026
Merged

sarah-chitty-1 merged 13 commits into
mainfrom
sarahchitty/always-on-infra-failures

Conversation

@sarah-chitty-1

@sarah-chitty-1 sarah-chitty-1 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

In an always_on run, a wake can fail for a reason that isn't the model's: a gateway 5xx, throttling, a dead agent sandbox. Today the run ends normally and the rubrics judges score it 0, so the failure counts against the model. The A2A protocol already tells the two apart. error_type: agent_error means the agent failed. infra_error means it didn't, and agent-env may retry. Nothing acted on that.

With this change:

  • always_on: the run ends as agent_turn_infra_error when a turn's error_type is infra_error, or when the agent stops answering (AgentUnreachableError, agent_env.agent_unreachable).
    • The timeline, record, conversation and prompt response are still written. The record now also keeps error_code.
    • Then the step raises AgentTurnInfraError, so no verifier grades it and a retry_config can redo it.
    • agent_error turns are graded as before. agent-env's own turn timeout is still graded.
  • Default retry for always_on: an always_on step the task gives no retry_config is redone once from the first deploy_env it depends on, whatever failed it (TaskStep.default_retry_config, applied when a Task is built, so Task.get on the hub worker sees it too). It applies only when that rollback redoes everything the step depends on (no ancestor runs beside the deploy); otherwise the task needs its own retry_config. A task's own retry_config replaces it. It isn't written into the stored task (RetryConfig.implied), so stored tasks and bundle hashes don't change, and it's kept in seeded runs. Each Task keeps its defaults in its own dict (retry_config_of) and never changes a step it's given, so tasks built from the same step objects don't change each other's retries; Task.from_dict, whose steps are its own, also puts the default on them for the hub worker, which reads step.retry_config off Task.get. An episode's copy takes none (Task(implied_retries=False), read through Task.retry_config_of), so episodes still accept always_on tasks; a retry the author wrote is still refused there. Every always_on task on the hub (53) has no retry_config today and gets the default.
  • outcome.py: AgentTurnInfraError is TRANSIENT, the same cause as other retryable failures. Key, budget and auth text still decides first.
  • turn_events (native OpenInference):
    • A harness.error span becomes a failure note for the judge (kind, message, HTTP status, retries). Until now it was dropped as the harness's own span.
    • A failed_wake message names its kind.
    • The gateway, throttled, timeout_call and harness kinds are described to the judge as not the assistant's doing.
  • staging:
    • harness_note lines carry the failure, the index gets an error line for it, and the record lists harness_failures. The failure's message stays in the note's text, which moves to a side file when long, so the line keeps to LINE_CHARS.
    • The judge's files note explains failure lines only in runs that have one, so other runs' prompts are unchanged.
  • agents/AGENTS.md: says what always_on does with each error_type.

Effect on other harnesses

Under always_on, any harness that already sends infra_error now fails the step where it used to score 0. That covers Pi's pi.model_error, OpenHands, Pydantic AI HTTP errors and framework exceptions. Their time-limit codes are agent_error, so time limits don't change.

Overlap with open PRs

Not in this PR

  • Shared verifiers are unchanged. rubrics_verifier still scores an infra_error prompt response 0, and a verifier_ids aggregate whose sources all skipped still scores 0, as does agent_prompt_response_verifier. Under always_on no verifier sees such a run (the step fails first, and the default retry redoes it), so changing them would only move other tasks' scores; that belongs in its own PR.
  • user_sim_error doesn't raise the same way.
  • No in-run retry.
  • ATIF profile 1.3.
  • A worker that dies mid-step (an out-of-memory kill) raises nothing, so the always_on step never sees that loss. The default retry below still covers it: with a retry that starts from an earlier step, the hub worker refuses the redelivered attempt (PriorAttemptIncomplete) and the run replays from the deploy step, rather than running the agent again in the world it already changed.

How it was tested

  • After keeping each task's defaults on the task: 2 new tests (a second task built from the same steps leaves the first task's default alone; a task loaded with from_dict still runs as an episode). The same tiers: 6,777 passed. Each of five fixes was undone in turn, and a test failed each time. ruff check . is clean, and the plugin API check finds no break.
  • After the episode and stale-default fixes, with end-to-end retry tests: 13 tests in test_always_on_default_retry and 2 new in episode/spec_test. tst/unit/task_step, tst/unit/task, tst/unit/bundle, tst/unit/runner and tst/unit/openenv: 6,775 passed, leaving out the 2 files that fail only on macOS (below). Each of the four fixes was undone in turn, and a test failed each time. ruff check . is clean; check_plugin_api.py --base origin/main finds no break to the plugin surface.
  • After taking the shared verifier changes out, with the seeded-run fix: 6 tests in test_always_on_default_retry. tst/unit/task_step, tst/unit/task and tst/unit/bundle: 6,729 passed and the same 6 local failures as below (the test of the reverted tolerated-run skip is removed). ruff check is clean.
  • After the default retry: 5 new tests (test_always_on_default_retry). tst/unit/task_step, tst/unit/task and tst/unit/bundle: 6,420 passed and 6 failed, the same 6 local failures as below. ruff check is clean.
  • After the review fixes (long failure message): 1 new test. tst/unit/task_step and tst/unit/task: 5,098 passed and 6 failed. 4 are the computer_exec_test.py macOS failures below. 2 are test_mcp_cli_builder.py codegen tests whose generated script runs under the system Python, which has no click here. ruff check is clean on the verifiers.
  • After rebasing onto main (3f02298): the changed and new tests, 204 passed (outcome_test, test_always_on_agent_verifier, test_always_on_graded, test_always_on_wake_limit, test_turn_events, test_always_on_staging, test_rubrics_verifier_infra_error). ruff check is clean on the changed files.
  • Before the rebase:
    • The always_on, rubrics_verifier, turn_events, staging, aggregate, satisfaction and outcome suites: 930 passed.
    • tst/unit/task_step, tst/unit/task and tst/unit/bundle: 6,411 passed and 4 failed. The 4 are in computer_exec_test.py, which this PR doesn't touch; its shell command exits 127 on macOS.
  • Each of the 14 changes was reverted in turn, and its tests failed each time.
  • The whole-repo unit run hung locally, so there's no full-suite result here. CI is the check for that.

🤖 Generated with Claude Code

Confidence Score: 5/5RetriggerView in Greptile

The PR appears safe to merge; no new blocking issue was found.

Summary

Infrastructure-failed always_on runs are recorded, then fail before grading. Eligible tasks retry once from their environment deployment.

  • Infrastructure-failed always_on turns fail before they are graded.
  • Always_on tasks retry once from a dependent environment deployment by default.
  • Always_on judges see the harness's account of failed wakes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Resolve seeded steps] --> B[Compute this run's retry defaults]
  B --> C[Run always_on]
  C --> D{Infrastructure failure?}
  D -- No --> E[Continue to grading]
  D -- Yes --> F[Save run evidence and raise]
  F --> G{Retry available?}
  G -- Yes --> H[Roll back from environment deployment]
  H --> C
  G -- No --> I[Fail run]
Loading

Reviews (17) · Last reviewed commit: "fix(always_on): a seeded run works its d..." · Reviewed by Greptile

…g 0; judges read the harness's failure

A PSI always_on run whose wake failed for an infrastructure reason (a gateway 5xx, throttling, a dead
sandbox) was recorded as a normal end and then scored 0 by the rubrics judges, so it counted as the
model's failure (BELOW_ONE). The A2A protocol already says which failures are the agent's
(error_type agent_error) and which aren't (infra_error, "agent-env may retry it"); nothing acted on it.

- always_on: a turn whose error_type is infra_error, or whose agent stopped answering
  (AgentUnreachableError, error_code agent_env.agent_unreachable), ends the run as
  agent_turn_infra_error (in ERROR_ENDS and END_NOTES). The timeline, record, conversation and prompt
  response are written as before, and the record now keeps error_code. Then the step raises
  AgentTurnInfraError, so no verifier grades it and a retry_config can redo it. agent_error turns are
  graded as before. Docstrings now say what a failed turn gets (a rubrics 0, not a skip).
- task/outcome.py: AgentTurnInfraError classifies as TRANSIENT (key budget/auth text still wins).
- rubrics_verifier: an infra_error prompt response is a true skip (no score, no rows; the mistakes
  entry skipped too), so an aggregate leaves it out and a run with every source skipped is UNSCORED.
  _gated no longer compares a skipped verdict's missing score.
- turn_events (native OpenInference): a harness.error span is a failure note (kind, message, HTTP
  status, retries) instead of being dropped as the harness's own span; a failed_wake message names
  the kind. gateway, throttled, timeout_call and harness kinds are said to be no doing of the
  assistant's.
- staging: harness_note lines carry failure, the index gets an error line for it, the record lists
  harness_failures, and the judge's files note explains failure lines only when there is one.
- agents/AGENTS.md: what always_on does with each error_type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sarah-chitty-1
sarah-chitty-1 requested a review from a team as a code owner November 26, 2026 00:11
sarah-chitty-1 and others added 3 commits December 1, 2026 10:27
…ailure's message stays out of its staged line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e from its env deploy

The step type's own default (TaskStep.default_retry_config), applied when a Task is built and never
written into the stored task. A task's own retry_config replaces it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sarah-chitty-1 sarah-chitty-1 changed the title fix(always_on): an infra-failed turn fails the step instead of scoring 0 fix(always_on): an infra-failed turn is redone from its env deploy instead of scoring 0 Dec 1, 2026
sarah-chitty-1 and others added 2 commits December 1, 2026 10:52
…ures' into sarahchitty/always-on-infra-failures
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/agent_env/task_step/task_step.py Resolved
…verifier and aggregate_verifiers as on main

The infra-error skip in rubrics_verifier and the all-skipped verifier_ids aggregate changed other tasks' scores,
and no always_on run reaches them: the step fails first and its default retry redoes the run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… every step the always_on step depends on

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1 and others added 2 commits December 2, 2026 10:48
The scheduler retried any failure a retry_config covered, so always_on's implied retry also
redeployed and reran a run that failed on a config error or a broken user sim, which fails the
same way again. RetryConfig.retry_on names the failures a retry redoes (raised as or from one of
its types); always_on's default sets it to AgentTurnInfraError. A task's own retry_config, with
no retry_on, still redoes any failure.

Tests run the implied retry through the scheduler: an infra failure redeploys and reruns once, a
second fails the task, and any other failure fails it without redeploying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts fe36f38. The hub's run-task workflow decides its own rollbacks and doesn't read
RetryConfig.retry_on, so the filter held only in Task.run and local runs and the hub would
redo different failures. Until the hub honours it too, always_on's default retry redoes a failed
run on both the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1 added a commit that referenced this pull request Dec 2, 2026
…itty/always-on-carry-on-after-failed-wake

Picks up 91a2a16, bf8e40c, fe36f38 and its revert 1f220a6. In rubrics_verifier, #933's removal of
the generic infra_error skip stands and #981's _judges_failed_run and _judges_without_trajectory hooks
stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1 added a commit that referenced this pull request Dec 2, 2026
…ded, never scores it 0

With #933's head, an always_on run that ended on an infrastructure failure and reached its verifiers
(the task's fail_task_on_error off) was scored 0 with a prompt_error row, against the model. The
always_on judge and the response check now skip it (ended_on_infra_failure, read from the run's
record). A prompt_agent turn's infra_error still scores 0 unjudged, as on main, so no other task's
score moves. rubrics_verifier's gate lets a skip through when fail_task_when_not_passing is on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…own default; test the retry end to end

- Task(implied_retries=False) and Task.retry_config_of: an episode's copy runs no step type's default retry, so
  episode/rules no longer refuses an always_on task for a retry_config its author never wrote. A retry the author
  wrote is still refused. The default stays on the step, where the hub worker reads it.
- _imply_retries works a default out again for each task built from the same step objects, instead of keeping the
  one an earlier task's graph gave.
- Scheduler tests: a failed run is redeployed and run again once, whatever failed it; a second failure fails the
  task; a task that takes no default fails without redeploying.
- Docs say a failed run is redone once, whatever failed it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/agent_env/task/task.py Resolved
sarah-chitty-1 added a commit that referenced this pull request Dec 2, 2026
…-failed-wake

#933 moves implied retries off the step objects: Task(implied_retries=...) and
Task.retry_config_of(step), with an episode's copy taking no default retry.

AGENTS.md conflicted. The resolution keeps #981's account of an agent_error
turn (it ends only its wake, three in a row end the run, the whole run is
judged) and takes #933's sentence on the default retry, which redoes a failed
step once from its env deploy whatever failed it. It says "a failed step"
because under #981 an agent_error run no longer fails its step.

None of #981's code reads step.retry_config, so nothing else needed to move to
Task.retry_config_of.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o step it was given

Building a second Task from the same step objects rewrote their default retry, so the first task's
retry_config_of read the second's policy. A Task now keeps each step's type default in its own dict, read by
retry_config_of; it never writes it onto the steps it is given. Task.from_dict, whose steps are its own, also
puts the default on them, for a runner that reads a step's retry_config (a hub worker reads them off Task.get).
The seed pass no longer copies it over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/agent_env/task/task.py Resolved
sarah-chitty-1 added a commit that referenced this pull request Dec 2, 2026
…-failed-wake

#933 now keeps each step's default retry in the Task's own dict, read through
Task.retry_config_of, and never writes it onto the steps it's given, except
that Task.from_dict puts it on the steps it builds, for the hub worker. The
merge was clean. None of #981's code reads step.retry_config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eeded steps

A seed can fill placeholders in step ids, so the task's defaults, keyed by its unseeded ids, missed the
seeded steps, and their resume points named unseeded ids too. The scheduler now asks the run: the task's
own defaults, or, for a seeded run, those its seeded steps imply, kept per run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1 added a commit that referenced this pull request Dec 2, 2026
…-after-failed-wake

#933 fixes seeded step names losing their default retries (task.py's
_own_retry, Task._run_implied_retries and the scheduler's lookup in
_drive_dag). The merge was clean. None of #981's code reads
step.retry_config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sarah-chitty-1
sarah-chitty-1 added this pull request to stack #996 December 2, 2026 23:52
@sarah-chitty-1
sarah-chitty-1 merged commit dbbc03f into main Dec 2, 2026
37 checks passed
@sarah-chitty-1
sarah-chitty-1 deleted the sarahchitty/always-on-infra-failures branch December 2, 2026 23:52
sarah-chitty-1 added a commit that referenced this pull request Dec 2, 2026
…lter

One conflict, in always_on_staging.py, resolved to keep both sides:
- the module docstring: #980's thinking only when the judge's filter asks
  for it (stages_thinking), with #933's harness note for a failed wake
  (``failure``);
- the imports: #980's trajectory_filter import beside #933's turn_events
  import with is_infra_failure;
- _Stager's fields: #980's thinking, thinking_left_out and as_recorded
  beside #933's harness_failures;
- the staging record: #980's thinking_left_out and
  thinking_unfiltered_wakes beside #933's harness_failures.

Everything else merged cleanly; src/agent_env/task (Task.retry_config_of
and the implied retries) is main's as is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1 added a commit that referenced this pull request Dec 2, 2026
…-failed-wake

main now has #933 squashed (dbbc03f), plus #995 (prompt_agent's
context_window) and five other commits. This branch already merged #933's
final head, 26ae0f9, and main's #933 files match it. Five files conflicted,
because the squash re-applies #933's changes against the old base:
AGENTS.md, always_on.py, always_on_staging.py, test_always_on_graded.py and
test_always_on_wake_limit.py. Each was resolved by a three-way merge with
26ae0f9 as the base. That keeps this branch's #981 changes and adds only
what main changed since #933: #995's context_window lines in always_on.py.

Checked: the merged tree differs from main by exactly #981's own changes
(26ae0f9..e1747cd's work), and from this branch by exactly main's
non-#933 commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1 added a commit that referenced this pull request Dec 3, 2026
…uard

Conflicts, each resolved so both sides survive:
- always_on_agent_verifier.py: the files note adds #981's _FAILURE_NOTE for a run with harness_failures and this
  branch's _GUARD_NOTE for one the context guard acted in.
- always_on_staging.py: _IDENTITY has both "guard" and #981's "failure" and "failed_turn_notice", with this branch's
  _IDENTIFYING_PARTS and _KEPT; a harness_note carries guard and failure; the record keeps context_guard_actions,
  results_shown_not_whole and harness_failures; index.md has the compaction (mid_wake, _index_facts), guard and
  failure lines; imports guard_words, is_infra_failure and shown_words.
- judge_utils/turn_events.py: TurnEvents and the span comment describe both failure and guard; the harness.guard,
  harness.error and harness.call.resent handling all stay; the guard helpers and #981's failure helpers both stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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