Skip to content

Document custom job dependencies (needs) for agentic workflows#14305

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/investigate-metrics-jobs-capabilities
Closed

Document custom job dependencies (needs) for agentic workflows#14305
Copilot wants to merge 4 commits intomainfrom
copilot/investigate-metrics-jobs-capabilities

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Investigation Complete: Matrix Jobs and Job Dependencies for Project Boards and Orchestration

Summary

Finding: The needs field for job dependencies is already fully supported. Matrix jobs are not beneficial for project boards or orchestration patterns due to their dynamic, agentic nature.

Key Discoveries

  • needs field fully functional - custom jobs can define complex dependency chains
  • ⚠️ Matrix strategy in schema but unused - not processed by compiler
  • Matrix jobs not suitable - projectops/orchestration require runtime decisions
  • 📝 Documentation gap identified - users unaware of needs support
  • Test validation complete - dependencies compile and execute correctly
  • All documentation updated - including clear guidance on when to use needs vs orchestration

Changes Made

1. Documentation Enhancements ✅

  • docs/src/content/docs/reference/frontmatter.md

    • Added "Job Dependencies (needs)" section with examples
    • Documented multi-dependency syntax: needs: [job1, job2]
    • Showed job output references: ${{ needs.job.outputs.value }}
    • Added best practices and cycle detection notes
  • docs/src/content/docs/patterns/orchestration.md

    • Added "Dynamic vs. Static Parallelization" section
    • Explained why matrix jobs don't fit agentic workflows
    • Clarified when to use custom jobs with dependencies
  • .github/aw/orchestration.md

    • Added "When Execution Order Matters" section
    • Clarified when to use needs (deterministic single-run order) vs dispatch-workflow (dynamic multi-run orchestration)
    • Simplified examples to show pre/post-processing pattern
    • Contrasts fixed-order dependencies with dynamic orchestration decisions

2. Test Validation ✅

  • .github/workflows/test-custom-jobs-needs.md
    • Demonstrates complex job dependency chains
    • Shows multiple dependencies: needs: [agent, collect_data]
    • Tests job output passing between jobs
    • Verified compilation and correct dependency ordering

3. Investigation Report ✅

  • MATRIX_JOBS_INVESTIGATION.md
    • Complete analysis of matrix vs needs capabilities
    • Use case assessment for projectops and orchestration
    • Recommendations with rationale
    • Documentation of changes made

When to Use Each Pattern

Use needs for deterministic execution order (single workflow run):

  • Pre-processing steps must complete before agent (data fetch, linting, static analysis)
  • Post-processing requires outputs from agent and other jobs (reporting, cleanup)
  • Execution order is fixed and known at workflow design time

Use dispatch-workflow for dynamic orchestration (multiple workflow runs):

  • Orchestrator makes runtime decisions about which workers to dispatch
  • Workers can update Projects to coordinate state across runs
  • Each workflow run is independent and can be retried
  • Number and type of workers depends on runtime analysis

Dependency Graph from Test Workflow

pre_activation
    ↓
activation
    ↓
    ├─→ collect_data (outputs: item_count)
    │       ↓
    │   process_data (uses collect_data output)
    │       ↓
    └─→ agent
            ↓
        report (needs: [agent, collect_data], if: always())

Why Matrix Jobs Are Not Needed

ProjectOps: Content-driven decisions require dynamic routing

  • Agent analyzes issue/PR content → decides which projects to update
  • Matrix requires predefined static combinations
  • Current pattern (update_project with max) is correct

Orchestration: Intelligent worker dispatch based on analysis

  • Orchestrator discovers work items at runtime → dispatches appropriate workers
  • Matrix would force premature static decisions
  • Current pattern (dispatch-workflow with max) is correct

Bottom Line

needs already works - now documented with clear guidance on when to use it
Matrix not needed - incompatible with agentic patterns
Current patterns correct - dynamic decision-making preserved
No code changes required - feature already exists and functions properly


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…stigation

- Add comprehensive documentation for custom job dependencies in frontmatter.md
- Add dynamic vs static parallelization section to orchestration.md
- Create test workflow demonstrating job dependencies with outputs
- Add MATRIX_JOBS_INVESTIGATION.md with complete analysis
- Confirm needs field is fully supported, matrix jobs not needed for agentic patterns

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate metrics jobs and action capabilities for project boards Document custom job dependencies (needs) for agentic workflows Feb 7, 2026
Copilot AI requested a review from mnkiefer February 7, 2026 07:31
@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 7, 2026

@copilot update aw/orchestration.md to be aware that needs syntax for dependency chains can be used.

…s syntax

- Add "Custom Job Dependencies" section with comprehensive example
- Show dependency chains, multiple dependencies, and job outputs
- Update design guidelines to reference needs for custom job dependencies
- Add cross-reference to frontmatter documentation

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot update aw/orchestration.md to be aware that needs syntax for dependency chains can be used.

Updated .github/aw/orchestration.md with a new "Custom Job Dependencies" section that documents needs syntax for dependency chains. Includes examples of single dependencies, multiple dependencies, job outputs, and key capabilities. Commit: a9e5817

@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 7, 2026

@copilot Maybe this should be rephrased as for orchestration where order matters? Or should be solved more naturally by orchestration cycles/runs?

- Rename section to "When Execution Order Matters" to focus on deterministic ordering
- Add clear guidance on when to use needs vs dispatch-workflow
- Simplify example to show pre/post-processing pattern
- Contrast single-run dependencies with multi-run orchestration
- Emphasize that needs is for fixed order, dispatch-workflow for dynamic decisions

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot Maybe this should be rephrased as for orchestration where order matters? Or should be solved more naturally by orchestration cycles/runs?

Rephrased the section to focus on "When Execution Order Matters" - clarified that needs is for deterministic single-run ordering (pre/post-processing), while dispatch-workflow is for dynamic multi-run orchestration. The section now contrasts when to use each pattern. Commit: a2ea4c9

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