fix: return CollectionStats from collect_results, unify zero-output check (#95)#103
Merged
Muizzkolapo merged 2 commits intomainfrom Apr 2, 2026
Merged
Conversation
…heck Root cause: the zero-output check (raise when 0/N items succeed) only existed in pipeline.py. The initial pipeline (first action) had no equivalent — so when all items failed with 401, it wrote empty output and "completed" instead of failing. The circuit breaker never fired. Fix: collect_results() now returns (output, CollectionStats) instead of just output. Both pipeline.py and initial_pipeline.py use stats.failed to make the same decision. No more ad-hoc re-scanning of results. Changes: - Added CollectionStats dataclass to result_collector.py - collect_results() returns tuple[list[dict], CollectionStats] - pipeline.py: uses stats.failed instead of re-scanning results list - initial_pipeline.py: adds zero-output check using stats (was missing) - Updated ~20 test call sites to unpack the new return type Mitigates #95 — invalid API key on first action now properly fails instead of silently completing with empty output.
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
completed_with_failures(PARTIAL) instead offailed(ERROR) because the initial pipeline had no zero-output checkcollect_results()computed success/failure counts internally but discarded them — callers had to re-derive the information independently, and the initial pipeline didn'tcollect_results()now returns(output, CollectionStats)— both pipelines use the same stats to make the same decisionChanges
result_collector.py: AddedCollectionStatsdataclass, changed return type totuple[list[dict], CollectionStats]pipeline.py: Usesstats.failedinstead of re-scanning results list for FAILED itemsinitial_pipeline.py: Adds zero-output check using stats (was completely missing — this was the bug)Root cause analysis
Two code paths both call
collect_results():StandardStrategy→pipeline.py— had a zero-output check (PR feat: pre-flight validation and dependency-aware execution guards #67)InitialStrategy→initial_pipeline.py— had no check at allWhen the first action (initial strategy) failed all items with 401, it wrote empty output and returned successfully. The executor called
_handle_run_success→_resolve_completion_statusfound failed dispositions → setcompleted_with_failures. The circuit breaker didn't fire becausecompleted_with_failuresis not a failure status.Mitigates #95 — downstream actions no longer execute after the first action fails entirely.
Test plan
ruff check .— cleanruff format --check— cleanpytest— 4300 passed, 2 skipped, 0 failuresfailed→ circuit breaker skips all downstream → tally shows0 OK | 0 PARTIAL | N SKIP | 1 ERROR