Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(orchestrator): status-aware guards, per-host results, and inter-task data#25

Closed
retr0h wants to merge 12 commits intomainfrom
feat/status-aware-guards-per-host-results
Closed

feat(orchestrator): status-aware guards, per-host results, and inter-task data#25
retr0h wants to merge 12 commits intomainfrom
feat/status-aware-guards-per-host-results

Conversation

@retr0h
Copy link
Collaborator

@retr0h retr0h commented Mar 3, 2026

Summary

  • Add Status field to Result and store results for all task paths (success, failure, skip) enabling status-aware guard logic
  • Add HostResult type and extract per-host results from broadcast operations (_all/label targets)
  • Add TaskFnWithResults for inter-task data passing — tasks can read results from prior tasks
  • Add Data and HostResults fields to TaskResult for post-run access in hooks
  • Allow When guards to run on tasks with failed dependencies, enabling error-handler patterns
  • Add WhenWithReason for custom skip messages and SetName for task renaming
  • Update docs, examples, and generated API reference
  • Add tests for SetName and WhenWithReason (unit + integration)

Test plan

  • All existing tests pass
  • SetName covered with table-driven unit test
  • WhenWithReason covered with table-driven unit test and integration test verifying custom reason flows through OnSkip hook
  • Coverage at 98.9%
  • Verify lint and formatting pass in CI

🤖 Generated with Claude Code

retr0h and others added 12 commits March 1, 2026 22:19
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]>
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Thank you for contributing to this project! 😊🕹️

@retr0h
Copy link
Collaborator Author

retr0h commented Mar 3, 2026

Duplicate of #23 which was already merged. This branch was stale.

@retr0h retr0h closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant