feat(orchestrator): status-aware guards, per-host results, and inter-task data#25
Closed
feat(orchestrator): status-aware guards, per-host results, and inter-task data#25
Conversation
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Previously the runner only stored a Result for successfully completed tasks. Skipped and failed tasks had no entry in the results map, which prevented guards from inspecting their status. Now every code path (dep-failed skip, OnlyIfChanged skip, guard-false skip, failure, and success) stores a Result with the appropriate Status field set. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add HostResult struct for per-host responses in broadcast operations and a HostResults slice field to Result. This enables downstream tasks and guards to inspect individual host outcomes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add IsBroadcastTarget helper to detect broadcast/label targets, extractHostResults to parse per-agent results from collection responses, and isCommandOp to identify command operations. Update executeOp to populate HostResults for broadcast targets and fail on non-zero exit codes for command operations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add inter-task data access mechanism: TaskFnWithResults lets a task closure receive the results map from prior tasks, enabling data flow between dependent tasks. Add Data field to TaskResult so post-execution result inspection can access task output data. - Add TaskFnWithResults type and fnr field on Task - Add NewTaskFuncWithResults constructor - Update IsFunc() to account for fnr - Add Data map[string]any field to TaskResult - Update runner to handle fnr execution with lock-protected results - Populate Data on TaskResult in success path - Add TaskFuncWithResults method on Plan - Fix Explain() to use IsFunc() for fnr task detection 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add TaskFuncWithResults, Result types (Status, HostResult, Data on TaskResult), and broadcast results to docs. Update example to use TaskFuncWithResults with Results access and show Data on TaskResult. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Rewrite examples/all to showcase low-level SDK patterns: TaskFuncWithResults reading data from prior tasks, Status inspection in When guards, alert-on-failure triggered by StatusFailed, and Data extraction in post-run reporting. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Tasks with a When guard were being auto-skipped when a dependency failed, preventing failure-triggered patterns like alert-on-failure. Now tasks with guards bypass the dependency-failed skip and let the guard decide whether to run. Also print all Data keys in the example instead of only stdout/hostname. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
The runner extracted the changed boolean from the API response data but left it in the Data map, causing it to appear alongside real fields in result output. Also switch example detailed results to JSON formatting for readability. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Propagate HostResults from Result to TaskResult so AfterTask hooks can display per-host data for broadcast operations. Add SetName method to Task for renaming after creation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add WhenWithReason method to Task that allows setting a custom reason string shown when a guard returns false, improving skip hook output. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Cover SetName and WhenWithReason with table-driven unit tests and an integration test verifying custom skip reasons flow through OnSkip. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
Thank you for contributing to this project! 😊🕹️ |
Collaborator
Author
|
Duplicate of #23 which was already merged. This branch was stale. |
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
Statusfield toResultand store results for all task paths (success, failure, skip) enabling status-aware guard logicHostResulttype and extract per-host results from broadcast operations (_all/label targets)TaskFnWithResultsfor inter-task data passing — tasks can read results from prior tasksDataandHostResultsfields toTaskResultfor post-run access in hooksWhenguards to run on tasks with failed dependencies, enabling error-handler patternsWhenWithReasonfor custom skip messages andSetNamefor task renamingSetNameandWhenWithReason(unit + integration)Test plan
SetNamecovered with table-driven unit testWhenWithReasoncovered with table-driven unit test and integration test verifying custom reason flows throughOnSkiphook🤖 Generated with Claude Code