Skip to content

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

Open
sarah-chitty-1 wants to merge 8 commits into
mainfrom
sarahchitty/always-on-infra-failures
Open

sarah-chitty-1 wants to merge 8 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 (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. It's kept in seeded runs. A task's own retry_config replaces it. The default isn't written into the stored task (RetryConfig.implied), so stored tasks and bundle hashes don't change. Every always_on task on the hub (48 PSI tasks, 2 others) has no retry_config today.
  • 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 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 failures in always_on are recorded, then fail the step so it can retry without receiving a grade.

  • Always-on runs record infrastructure failures without grading them as agent failures.
  • Always-on tasks without their own retry setting restart once from an earlier environment deployment.
  • Always-on judge files show why the harness says a wake failed.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Agent turn ends] --> B{Infrastructure failure?}
  B -- No --> C[Keep existing grading behavior]
  B -- Yes --> D[Save run evidence]
  D --> E[Raise AgentTurnInfraError]
  E --> F{Retry configured and available?}
  F -- Yes --> G[Roll back and redeploy]
  G --> A
  F -- No --> H[Fail run without grading]
Loading

Reviews (8) · Last reviewed commit: "fix(always_on): imply the default retry ..." · 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>

This branch has not been deployed

No deployments
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