Repository navigation
fix(always_on): an infra-failed turn fails the step instead of scoring 0 - #933
sarah-chitty-1 wants to merge 1 commit into
Conversation
…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>
| for rubric_evidence_with_mistakes the second entry is skipped too.""" | ||
| mistakes = ({**self._mistakes_entry_fields(), "results": [], "score": None, "skipped": reason} | ||
| if self.writes_mistakes_entry else None) | ||
| return RubricsVerdict(skipped=reason, output=self._entry_format_fields(), mistakes_entry=mistakes) |
There was a problem hiding this comment.
_not_graded returns no rows for an infrastructure failure, but aggregates configured with verifier_ids turn an empty row list into score 0. When every source skips, _pooled_entries records a graded zero, so the run still counts against the model.
Make that aggregate path skip when all its sources were skipped, and test it alongside the new sources case.
Knowledge Base Used: Agent and environment validation
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/task_step/task_steps/verifiers/rubrics_verifier.py
Line: 822
Comment:
**Skipped runs still score zero**
`_not_graded` returns no rows for an infrastructure failure, but aggregates configured with `verifier_ids` turn an empty row list into score 0. When every source skips, `_pooled_entries` records a graded zero, so the run still counts against the model.
Make that aggregate path skip when all its sources were skipped, and test it alongside the new `sources` case.
**Knowledge Base Used:** [Agent and environment validation](https://app.greptile.com/-/switch-tenant?tenant=scale-ai&next=%2Fcustom-context%2Fknowledge-base%2Fscaleapi%2Fagentenv-framework%2F-%2Fdocs%2Fagent-and-environment-validation.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| # A line's fields that say what and where it is; ``fit`` moves only the others. | ||
| _IDENTITY = frozenset({"event", "wake", "at", "call", "turn", "tool", "kind", "state", "outcome", "phase", "by", | ||
| "step", "subagent", "compaction", "internal", "cut_off", "cut_off_notice", "limit"}) | ||
| "step", "subagent", "compaction", "failure", "internal", "cut_off", "cut_off_notice", |
There was a problem hiding this comment.
Long failure lines get truncated
Adding failure to _IDENTITY keeps its entire contents inline, including the unrestricted harness.error.message. If an error contains a long body or traceback, it stays in both wake files and events.jsonl even after fit_all moves text aside. The line can exceed LINE_CHARS, leaving the judge with truncated failure details.
Keep only small failure fields inline and move the message to a side file.
Knowledge Base Used: Task-step context and execution
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/task_step/task_steps/verifiers/always_on_staging.py
Line: 78
Comment:
**Long failure lines get truncated**
Adding `failure` to `_IDENTITY` keeps its entire contents inline, including the unrestricted `harness.error.message`. If an error contains a long body or traceback, it stays in both wake files and `events.jsonl` even after `fit_all` moves `text` aside. The line can exceed `LINE_CHARS`, leaving the judge with truncated failure details.
Keep only small failure fields inline and move the message to a side file.
**Knowledge Base Used:** [Task-step context and execution](https://app.greptile.com/-/switch-tenant?tenant=scale-ai&next=%2Fcustom-context%2Fknowledge-base%2Fscaleapi%2Fagentenv-framework%2F-%2Fdocs%2Ftask-step-execution.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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_errormeans the agent failed.infra_errormeans it didn't, and agent-env may retry. Nothing acted on that.With this change:
agent_turn_infra_errorwhen a turn'serror_typeisinfra_error, or when the agent stops answering (AgentUnreachableError,agent_env.agent_unreachable).error_code.AgentTurnInfraError, so no verifier grades it and aretry_configcan redo it.agent_errorturns are graded as before. agent-env's own turn timeout is still graded.AgentTurnInfraErroris TRANSIENT, the same cause as other retryable failures. Key, budget and auth text still decides first.infra_errorprompt response is skipped, with no score and no rows, so aggregates leave it out. A run where every source is skipped is UNSCORED._gatedno longer compares a skipped verdict's missing score.harness.errorspan becomes a failure note for the judge (kind, message, HTTP status, retries). Until now it was dropped as the harness's own span.failed_wakemessage names its kind.harness_notelines carry the failure, the index gets an error line for it, and the record listsharness_failures.error_type.Effect on other harnesses
Under always_on, any harness that already sends
infra_errornow fails the step where it used to score 0. That covers Pi'spi.model_error, OpenHands, Pydantic AI HTTP errors and framework exceptions. Their time-limit codes areagent_error, so time limits don't change.Overlap with open PRs
agent_prompt_response_verifier._judged. Its hunks sit near the new early return but not on it.Not in this PR
agent_prompt_response_verifierstill scores infra failures 0.user_sim_errordoesn't raise the same way.How it was tested
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 checkis clean on the changed files.tst/unit/task_step,tst/unit/taskandtst/unit/bundle: 6,411 passed and 4 failed. The 4 are incomputer_exec_test.py, which this PR doesn't touch; its shell command exits 127 on macOS.🤖 Generated with Claude Code
Fix the older aggregate path before merging so infrastructure failures do not still count as zero.
Fix with agent prompt
Summary
This PR separates infrastructure failures from model failures.
The older
verifier_idsaggregate still assigns zero when every source skips. Failure messages also bypass the staged line-length limit.Explicitly deferred by
sarah-chitty-1: infrastructure failures inagent_prompt_response_verifier, matching treatment foruser_sim_error, in-run retries, and ATIF profile 1.3.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Agent turn ends] --> B{Infrastructure failure?} B -->|Yes| C[Write timeline, conversation and response] C --> D[Raise AgentTurnInfraError] D --> E{Retry configured?} E -->|Yes| F[Roll back configured steps and retry] E -->|No| G[Fail step] B -->|No| H[Keep existing grading behavior] I[Rubric reads infrastructure error] --> J[Skip with no score or rows] J --> K[Named-source aggregate skips] J --> L[Older verifier_ids aggregate records zero]Reviews (1) · Last reviewed commit: "fix(always_on): an infra-failed turn fai..." · Reviewed by Greptile