fix: route sync output_invalid through _fail_run - #13
Open
rickgorman wants to merge 1 commit into
Open
Conversation
The async tick path already retries missing declared outputs via _fail_run + exit rules. The sync _process_launch_result path marked FAILED and halted the job immediately, so a loop-on-output_invalid rule never fired. Match the async path. Reproduce: uv run pytest tests/test_engine.py::TestSyncOutputInvalidExitRules -q On unpatched master that test fails with job FAILED after one empty artifact.
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.
Summary
Sync
executor.start()results that fail declared-output validation (artifact is empty/ missing fields) currently mark the run FAILED and call_halt_jobimmediately. The async tick path already routes the same failure through_fail_run(..., error_category=\"output_invalid\"), which is what lets exit rules retry.This made a
looponoutput_invalidfire for async executors and never fire for sync ones (script / callable). Arena hits this onstepwise-run --local --waitwith a script invoke that must honor output contracts.Reproduce
git clone https://github.com/zackham/stepwise.git cd stepwise uv sync uv run pytest tests/test_engine.py::TestSyncOutputInvalidExitRules -qOn current
master(this PR's parent):The test is a callable step that returns
{}on attempt 1 (declared outputstatusmissing) and{\"status\": \"ok\"}on retry, with an exit rule:With this change the same test completes after two runs: FAILED (
output_invalid) then COMPLETED.Minimal CLI equivalent (same engine path as
--local --wait):Unpatched: job fails after one empty artifact. Patched: retries and completes.
Change
In
_process_launch_resultforresult.type == "data", when_validate_artifact/_check_artifact_sizefails, call_fail_runwitherror_category="output_invalid"instead of_halt_job. Same as the async poll path a few hundred lines above.No exit-rule change; jobs without a matching rule still halt via
_fail_run's existing fallthrough.