Skip to content

feat(task_step): StepContextError, for a step the run's context can't satisfy - #620

Merged
andrewpark-scaleai merged 2 commits into
mainfrom
andrew.park/step-prerequisite-error
Nov 11, 2026
Merged

andrewpark-scaleai merged 2 commits into
mainfrom
andrew.park/step-prerequisite-error

Conversation

@andrewpark-scaleai

@andrewpark-scaleai andrewpark-scaleai commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

Some step failures can't be fixed by a retry, and the agent-env worker retries them anyway. A step that finds its input missing from the run's context fails the same way on every attempt, because each attempt starts from that same context. Datadog shows the scale of it over the last 3 days of run_task_step failures:

Check Steps failed Failed all 3 attempts
load_artifact: no artifact recorded by step X 1,868 1,868
deploy_env: env already deployed 387 386
rubrics_verifier: PromptResponse not found in context 160 160

Each of those spends two more attempts and their backoff before the run fails. The worker can't tell these apart from a transient error, because every one is a plain RuntimeError.

What

  • agent_env.task_step.StepContextError (a RuntimeError) marks a step the run's context can't satisfy. It covers two cases. Something the step needs from an earlier step is missing, or something it would create is already there.
  • 47 raises across 23 step files now use it. They cover every not found in context.deployed_envs / deployed_agents / deployed_sandboxes check, every is already deployed check, the PromptResponse ... not found in context checks, and No artifact recorded by step. A codemod made the change, and rerunning it changes nothing.
  • test_step_context_error.py fails if a step raises one of these as a plain RuntimeError again.

Callers that catch RuntimeError behave the same. The worker change that reads the new type is scaleapi/scaleapi#174619.

Validation

The new guard test fails on the step files before this change and passes after it. Three existing tests now expect StepContextError. In the full unit suite, 14,520 tests pass and 2 fail. test_mcp_cli_builder.py::test_codegen_loads_sibling_env_file fails on main too, because its subprocess can't import httpx here. test_a_repl_left_idle_is_closed_... passed when rerun.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no blocking issues remain.

Summary

Adds StepContextError, a RuntimeError subclass, so callers can identify steps that cannot succeed with the run's current context.

  • Task steps mark context failures with a distinct error type.

The previous finding is addressed. No new actionable issues were found in the changes since the last review.

Reviews (2) · Last reviewed commit: "test: the StepContextError guard reads r..." · Reviewed by Greptile

@andrewpark-scaleai
andrewpark-scaleai requested a review from a team as a code owner November 11, 2026 17:26
@andrewpark-scaleai
andrewpark-scaleai enabled auto-merge (squash) November 11, 2026 17:34
@andrewpark-scaleai
andrewpark-scaleai merged commit 35ff9e5 into main Nov 11, 2026
81 of 88 checks passed
@andrewpark-scaleai
andrewpark-scaleai deleted the andrew.park/step-prerequisite-error branch November 11, 2026 19:32
sarah-chitty-1 added a commit that referenced this pull request Nov 12, 2026
One set_rate and one route: main's PUT /clock/set-rate and its _clock_write path replace this branch's
/clock/rate. Rate 0 still freezes the clock (the card says so and sets minimum 0). Clock.set_rate keeps
main's version/count/lived bookkeeping and current-time overflow guard. _change_clock wakes the fires
waiting out virtual time on every write: clock_advanced already does for set_rate and advance, and
clock_changed now does for set_time and clear. The executor read keeps this branch's 30 s of slack past
the executor's own timeout, on top of main's FD-5333 fix. always_on raises StepContextError (#620) for an
agent or user sim missing from the run's context.

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.

2 participants