-
Notifications
You must be signed in to change notification settings - Fork 34
Add dispatch-workflow safe output type with dynamic per-workflow tools #8940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@copilot the safe output must use the handler architecture and run in the safe_outputs step |
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
Refactored dispatch-workflow to use the handler architecture in commit d83b11c. The implementation now:
|
pelikhan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot each workflow listed should be mapped to a tool in the mcp with the according inputs (not just one tool for workflow_dispatch). Internally each of these tools is seiralozed as a dispatch_workflow object.
For the LLM, each safe output dispatch_workflow workflow entry is a unique tool.
Co-authored-by: pelikhan <[email protected]>
Implemented in commit 746e1c5. Each workflow listed in the configuration now generates its own MCP tool:
Example: With workflows |
|
@copilot the listed workflows can be any GitHub action workflow .yml file (.github/workflows/*.yml), not just agentic workflows. |
Co-authored-by: pelikhan <[email protected]>
Extended in commit 311fb32 to support standard GitHub Actions Validation: Now checks for Tool Generation: Extracts Runtime Dispatch: Tries This allows dispatching any GitHub Actions workflow that has |
|
@copilot first resolve the workflow file, then apply the dispatch, keep code simple and avoid the for loop. |
Co-authored-by: pelikhan <[email protected]>
…alls Co-authored-by: pelikhan <[email protected]>
Implemented in commit 358388d. The compiler now:
This eliminates the API call overhead and simplifies the runtime code - the file resolution is done once at compile time when we're already validating the workflows. |
|
@copilot review changes and look for errors, improvements. Format, lint, add tests |
|
@copilot review JSON schema updates in main and included schemas |
Co-authored-by: pelikhan <[email protected]>
Completed code review and improvements in commit 1350336: Fixed:
Validated:
All validation tools now run successfully without errors. |
Reviewed the JSON schema updates in Schema Structure: ✅ Valid
DispatchWorkflowOutput Definition: ✅ Correct
Field Validation:
Integration:
Schema is production-ready with proper validation constraints and clear documentation. |
|
Co-authored-by: pelikhan <[email protected]>
Implemented in commit 547ba73: Default Max: 1 → 3
5 Second Delay:
Test Coverage:
|
|
@copilot default max is 1 and the absolute highest allowed max value is 3 |
Co-authored-by: pelikhan <[email protected]>
Implemented in commit 51b67e5:
|
|
@copilot format, lint go |
Go code is already properly formatted and linted: ✅ All dispatch-workflow Go files pass formatting and linting checks. |
Adds a new
dispatch-workflowsafe output type that enables AI agents to trigger other workflows viaworkflow_dispatchevents, supporting multi-workflow pipeline orchestration. Uses the handler architecture to run alongside other safe outputs in the unifiedprocess_safe_outputsstep.Each workflow listed in the configuration generates its own MCP tool with workflow-specific inputs, providing strongly-typed tools to the LLM while using a unified backend processing pipeline.
Supports both agentic workflows (
.md/.lock.yml) and standard GitHub Actions workflows (.yml), with file extensions resolved and stored at compile time for optimal runtime performance.Configuration
Frontmatter accepts a list of workflow names (without file extension):
Implementation
Schema & Types
DispatchWorkflowOutputto agent output JSON schematest_workflow,deploy_workflow)workflow_dispatchinputsDispatchWorkflowConfigwith workflow list, max count, and workflow files mappingValidation
.md,.lock.yml, or.yml).lock.yml(compiled agentic) >.yml(standard GitHub Actions) >.md(requires compilation)workflow_dispatchtrigger by parsing YAMLDynamic Tool Generation
.lock.ymlor.yml) to extractworkflow_dispatchinputs_workflow_namemetadata for handler routinggenerateFilteredToolsJSON()WorkflowFilesmap for runtime useHandler Architecture
safe_output_handler_manager.cjsfor unified processingmain()returning message handler)_workflow_namemetadatadispatch_workflowtype withworkflow_namefieldprocess_safe_outputsstep with other handler-managed typesGH_AW_SAFE_OUTPUTS_HANDLER_CONFIGenvironment variableRuntime
actions.createWorkflowDispatch()actions: writepermissionPerformance Optimization
Compile-Time Resolution: The workflow file extension (
.ymlvs.lock.yml) is determined and stored during compilation when workflow files are being validated and read. This eliminates the need for runtime API calls to list workflows.Before: Runtime API call per dispatch
After: Direct lookup from compile-time data
Rate Limiting
5 Second Delay: Automatic rate limiting between workflow dispatch API calls prevents hitting GitHub API rate limits. The delay is enforced between dispatches (not before the first one) with clear log messages showing wait time.
Max Count Limits
Conservative Defaults with Safety Caps:
max: 2max: 3max: 10Example
Configuration:
Generated Tools for LLM:
build_apptool with inputs from build-app's workflow_dispatch configurationrun_teststool with inputs from run-tests's workflow_dispatch configurationdeploytool with inputs from deploy's workflow_dispatch configurationInternal JSONL Output:
{ "type": "dispatch_workflow", "workflow_name": "build-app", "version": "1.0.0", "environment": "production" }Each workflow appears as its own strongly-typed tool to the LLM, but all tools internally produce
dispatch_workflowobjects processed by the unified handler pipeline. The implementation seamlessly handles both agentic workflows and standard GitHub Actions workflows with optimal runtime performance, rate limiting, and conservative safety limits.Testing
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.