Repository navigation
Record each failed step's role and cause in failed_steps - #692
Draft
andrewpark-scaleai wants to merge 1 commit into
Draft
andrewpark-scaleai wants to merge 1 commit into
andrewpark-scaleai wants to merge 1 commit into
Conversation
A step that fails with fail_task_on_error=False lets its run complete, and the failed_steps entry is the only record of what the run lost. The entry now says which role the step played (grader, evidence, agent, other) and why it failed (key_budget, key_auth, transient, unknown). - StepRole on TaskStep: verifiers declare grader, snapshot and collect steps evidence, prompt_agent agent. A step overrides it in config with step_role, so a run_code step can say it grades. - task/outcome.py: FailureCause, classify_failure, FailedStep. The DAG runner builds its entry with FailedStep.from_exception. - attach_retry_config becomes attach_base_fields and hydrates step_role too. No behavior changes. Entries keep every existing key.
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.
Why
A run whose grader, snapshot or agent step failed but was tolerated (
fail_task_on_error=False) completes and counts as a success. Nothing on the run says what it lost, so no reader can flag it, hold it, or repair it.Today a
context.metadata.failed_stepsentry records the step id, type, error text and whether it was fatal. It does not say whether the failed step was the grader or an optional snapshot, and it does not say whether the error was a model key out of budget (permanent until the budget resets) or a timeout (worth retrying). This PR adds those two facts. It changes no behavior. The next PR derives the run's quality from them.What
StepRole(grader,evidence,agent,other) onTaskStepasstep_role. Every step type that writescontext.metadata["verifications"]declaresgrader.snapshot_env,snapshot_agent_stateandcollect_artifactsdeclareevidence.prompt_agentdeclaresagent. Every other step staysother.step_role, so arun_codestep that grades can say so. It serializes only when it differs from the type's role, so existing step documents are unchanged. An unknown value is refused when the task loads.agent_env/task/outcome.pywithFailureCause(key_budget,key_auth,transient,unknown),classify_failure(exc)and theFailedStepentry withFailedStep.from_exception(...).classify_failurereads the type names and messages of the exception's whole__cause__/__context__chain. A key cause wins over a transient one, because a timeout that wraps an out-of-budget error still fails on every retry.failed_stepsentry withFailedStep.from_exception. The entry keeps every existing key and addsstep_roleandcause.attach_retry_configbecomesattach_base_fields, since it now hydratesstep_roleas well. All five callers are migrated.Design decisions
verificationsis not agrader, so a new verifier cannot forget.step_role, notrole.deploy_agentandmodify_env_tool_accessalready use aroleconfig field for their own meaning. A baserolefield would collide with both in config and on the instance.classify_failuremeans one place to fix when a provider changes its wording. The cost is that an unfamiliar message reads asunknown, which is the safe default.StepRolelives intask_step/task_step.pyandoutcome.pyre-exports it.task_stepcannot import fromagent_env.taskwithout an import cycle throughagent_env/task/__init__.py.Test
Without the change the module does not exist and collection fails. With only
outcome.pypresent and the runner and step classes reverted, 6 of 25 fail: the tolerated-grader run records nostep_roleorcause, the step types declare no role, and the config override does not load.