Repository navigation
fix(always_on): a failed wake ends only that wake; the whole run is judged - #981
Open
sarah-chitty-1 wants to merge 3 commits into
Open
sarah-chitty-1 wants to merge 3 commits into
sarah-chitty-1 wants to merge 3 commits into
Conversation
… is judged A turn that fails as the agent's own failure (error_type agent_error, or anything but infra_error) no longer ends the multi-day run. It is recorded (a turn_failed timeline event, and the record's failed_turns with its error_type, error_code and message), what it sent the user is taken as any wake's is, and the run goes on to its next wake, check or user message, the prompt response keeping no error_type. - Infra failures keep #933's behaviour: the run ends as agent_turn_infra_error and the step fails with AgentTurnInfraError. - FAILED_TURNS_IN_A_ROW_MAX (3) failed turns in a row end the run as agent_turn_failed, so a dead agent can't spin through every scheduled wake. A completed or cut-off turn starts the count again. - A turn agent-env gave up waiting on (agent_turn_timeout) still ends the run: no terminal state says it stopped, so a next wake would share its session and world with it. - A run that ended on its agent's own failure (AGENT_FAILURE_ENDS) is judged as a whole, not skipped: always_on_agent_verifier (via a rubrics_verifier hook), user_sim_judge, agent_prompt_response_verifier and rate_user_satisfaction. env_outcome never skipped. A run the user sim or the step broke is still scored 0 unjudged. - The record reports early ends per run: failed_turns, counts.failed_turns, counts.failed_turn_kinds (by error_code, else error_type) and reached_scheduled_end. The judge's wake-by-wake text and the staged index say which turn failed and whether the run went on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th an error After a failed turn the run went on from, the next wake opens with the step's own note (FAILED_TURN_TEXT), as it does after a cut-off (CUT_OFF_TEXT). It is the same for every harness and failure kind and never carries the error's text, which can name the infrastructure. It is recorded as the cut-off note is: failed_turn_notice on the wake event and the staged "woke" line, told_in_wake on the failed turn's entry, and the judge's index says it is the run's note, not the user's words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reaches staging, never "No trajectory available" A turn agent-env gave up waiting on returns before its trajectory is read, so a run whose opening wake timed out stored none; with use_trajectory, rubrics_verifier then raised "No trajectory available" (and _compact_trajectory would again) instead of judging the run #981 now judges. The same held for a run its failed turns in a row ended, and for one that went on after failed turns (ended at its wake cap, no error on its response), whenever none stored one. rubrics_verifier gets a hook, _judges_without_trajectory (never in the base): when it says so, a run with no trajectory skips the guard and the single-file compaction and goes to stage_trajectory, refused still if nothing was staged. always_on_agent_verifier says so for a run with any failed turn of its agent's own; each such wake is staged from the run's record with a trajectory_missing line and named in the judge's prompt. A run that failed no turn and stored none is still refused. Staged by position (no timeline kept), the turn agent-env gave up waiting on, sent but with no per-turn trajectory entry, is now staged as a turn whose trajectory is missing instead of left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacks on #933 (
sarahchitty/always-on-infra-failures). Merge that first.What was broken
In the always_on step, one failed wake ended the whole multi-day run. The judges then skipped the run, or scored it 0 without reading it. Hark's audit found 43 of 210 graded runs ended early this way. Those runs averaged 0.11 rubric satisfaction, against 0.65 for runs that finished. In one example, a turn cap in wake 1 of a 10-day task scored 0.
What each failure kind does now
agent_error, a crash, canceled, rejected, a turn cap withcontinue_after_wake_limitoff): only that wake ends. The failure is recorded and the run goes on to its next wake, check or user message. The prompt response keeps noerror_type.infra_error, an agent that stopped answering): unchanged from fix(always_on): an infra-failed turn is redone from its env deploy instead of scoring 0 #933. The run ends asagent_turn_infra_error, the step fails withAgentTurnInfraError, and the run is redone.agent_turn_failed. The run is still judged.agent_turn_timeout) still ends the run. It is now judged, not skipped.The cap of 3
One failure is the case a run should survive. The harness can recover: the PSI neutral harness writes the next wake a note and compacts. A second failure in a row can still be the same condition clearing. A third means two chances to recover are gone. Ending there stops a dead agent spinning through every scheduled wake, each of which can cost up to
timeout_secondsof the budget. A completed turn, or one cut off at a limit, starts the count again. The cap is a module constant,FAILED_TURNS_IN_A_ROW_MAX.Why agent-env's own timeout still ends the run
No end state says the turn stopped, so it may still be running. A next wake would share its session and its world. Its tool calls and app changes would land in another wake's record. With
continue_after_wake_limiton, the step still cancels such a turn and goes on once the agent confirms it stopped, as before.Verifiers that now judge these runs
A run that ended on its agent's own failure is judged as a whole, and its failed turns count against the agent.
always_on_agent_verifier, through a newrubrics_verifierhook,_judges_failed_run.user_sim_judge.agent_prompt_response_verifier.rate_user_satisfaction.env_outcomenever skipped.A run that the user sim or the step broke is still scored 0 without being judged. A plain
rubrics_verifieron aprompt_agentturn is unchanged.New record fields and the step note
metadata["always_on"][step_id]gains:failed_turns: each failed turn's wake, turn,error_type,error_code, message,went_onandtold_in_wake.counts.failed_turnsandcounts.failed_turn_kinds, keyed byerror_code, elseerror_type.reached_scheduled_end, true forend_time,user_doneandfinished_nothing_pending.turn_failedevent for each failed turn.failed_turn_noticeon the wake event and on the stagedwokeline.Tests
tst/unit/task_step/test_always_on_failed_turns.py, 25 tests. Every new test fails against the base source.test_user_sim_judge.py,user_sim_judgejudges a run ended by the cap.test_user_sim_satisfaction.py,rate_user_satisfactionrates a run ended by the cap.prompt_errorpath through a user-sim error, and only its message changed.tst/unit/task_stepplus the other always_on-touching unit tests (agents/claude_code,bundle,cli,env/gateway/triggers_fires_test.py,task,training): 7418 passed, 6 failed. The 6 also fail on the base branch:computer_exec_test.py(4) andtest_mcp_cli_builder.py(2).ruff checkis clean.🤖 Generated with Claude Code
Confidence Score: 5/5

The changes appear safe to merge; the earlier grading failure is addressed.Summary
always_onnow continues after an agent's failed wake and judges the whole run. Infrastructure failures still stop the step for retry.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Agent turn ends] --> B{How did it end?} B -->|Completed or cut off| C[Reset failure count] B -->|Agent failed| D[Record failure] D --> E{Three failures in a row?} E -->|No| F[Continue to next wake] E -->|Yes| G[End run and judge it] B -->|No answer before timeout| G B -->|Infrastructure failed| H[Fail step for retry] G --> I[Stage available records] I --> J[Mark missing trajectories explicitly]Reviews (2) · Last reviewed commit: "fix(always_on): a judged run whose faile..." · Reviewed by Greptile