Skip to content

Safe outputs: pre-validate dispatch_workflow required inputs and downgrade missing-input failures to non-fatal#41992

Closed
Copilot wants to merge 4 commits into
mainfrom
copilot/aw-failures-fix-dispatch-workflow
Closed

Safe outputs: pre-validate dispatch_workflow required inputs and downgrade missing-input failures to non-fatal#41992
Copilot wants to merge 4 commits into
mainfrom
copilot/aw-failures-fix-dispatch-workflow

Conversation

Copilot AI commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

safe_outputs was failing the entire job when a dispatch_workflow message omitted a target workflow’s required workflow_dispatch input (e.g. message for haiku-printer), even when all other safe outputs succeeded. This change adds required-input awareness to dispatch handling and treats that specific validation failure as report-only.

  • Compile-time: capture required dispatch inputs

    • Extended DispatchWorkflowConfig with required_inputs (workflow -> []requiredInputName).
    • During safe-output config population, extract required workflow_dispatch.inputs from target workflow definitions and persist them into handler config.
  • Runtime: pre-dispatch validation in dispatch_workflow handler

    • Before calling Actions dispatch API, validate message.inputs against compile-time required_inputs.
    • On missing required fields, return a typed validation result (success: false, reportOnly: true) with actionable error text naming the missing input.
  • Runtime: normalize API missing-input errors

    • If GitHub returns 400/422 with Required input 'X' not provided, translate it to the same typed report-only validation error instead of surfacing raw REST failure text.
  • Job outcome semantics: report-only failures

    • Updated safe output failure partitioning to honor explicit reportOnly: true on results (in addition to existing type-based report-only rules), so a single malformed dispatch does not make safe_outputs red.
// dispatch_workflow.cjs
const requiredInputs = Array.isArray(requiredInputsByWorkflow[workflowName])
  ? requiredInputsByWorkflow[workflowName]
  : [];

const missing = requiredInputs.find(name => !Object.prototype.hasOwnProperty.call(inputs, name));
if (missing) {
  return {
    success: false,
    reportOnly: true,
    error: `Validation failed for dispatch_workflow "${workflowName}": missing required input "${missing}".`,
  };
}

pr-sous-chef run 28311797805

Generated by 👨‍🍳 PR Sous Chef · 111.6 AIC · ⌖ 0.953 AIC · ⊞ 17.2K ·

Copilot AI changed the title [WIP] Fix dispatch_workflow input validation for haiku-printer Safe outputs: pre-validate dispatch_workflow required inputs and downgrade missing-input failures to non-fatal Jun 28, 2026
Copilot AI requested a review from pelikhan June 28, 2026 02:50
@pelikhan pelikhan marked this pull request as ready for review June 28, 2026 04:48
Copilot AI review requested due to automatic review settings June 28, 2026 04:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the safe_outputs “dispatch_workflow” handler by capturing required workflow_dispatch.inputs at compile time and using that metadata at runtime to pre-validate dispatch messages, converting “missing required input” failures into report-only results so they don’t fail the entire safe_outputs job.

Changes:

  • Compile-time: extract and persist per-workflow required workflow_dispatch inputs into safe-outputs handler config (required_inputs).
  • Runtime: validate dispatch_workflow messages against required_inputs before dispatch, and normalize certain 400/422 API errors into report-only validation failures.
  • Job semantics: extend report-only partitioning logic to honor an explicit reportOnly: true flag (in addition to type-based rules).
Show a summary per file
File Description
pkg/workflow/safe_outputs_handler_registry.go Emits required_inputs into the generated safe-outputs handler config when present.
pkg/workflow/safe_outputs_dispatch.go Extracts required workflow_dispatch inputs from target workflows during compilation.
pkg/workflow/dispatch_workflow.go Extends DispatchWorkflowConfig with RequiredInputs for compile→runtime transfer.
pkg/workflow/dispatch_workflow_test.go Verifies required inputs are captured and serialized into config.
actions/setup/js/safe_output_handler_manager.cjs Updates report-only classification/partitioning to honor explicit reportOnly: true.
actions/setup/js/safe_output_handler_manager.test.cjs Adds tests for explicit reportOnly classification and partitioning.
actions/setup/js/dispatch_workflow.cjs Adds pre-dispatch required-input validation and API missing-input normalization to report-only failures.
actions/setup/js/dispatch_workflow.test.cjs Adds tests for the new report-only missing-input behaviors (pre-dispatch and API-error normalization).

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 8/8 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment on lines 580 to 582
function isReportOnlyFailureResult(result) {
return isFailedProcessingResult(result) && !!(result?.type && REPORT_ONLY_FAILURE_TYPES.has(result.type));
return isFailedProcessingResult(result) && (result?.reportOnly === true || !!(result?.type && REPORT_ONLY_FAILURE_TYPES.has(result.type)));
}
Comment thread actions/setup/js/dispatch_workflow.cjs
Comment thread actions/setup/js/dispatch_workflow.cjs
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address remaining review feedback, refresh this branch from main, and rerun checks once it is up to date.

Generated by 👨‍🍳 PR Sous Chef · 111.6 AIC · ⌖ 0.953 AIC · ⊞ 17.2K ·

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage — Run §28315307719

Category bug
Risk medium
Priority high
Score 64/100 — impact 32 · urgency 20 · quality 12
Action fast_track
Batch production-fixes (#41830 · #41912 · #41992)

Fixes safe_outputs CI failures caused by missing dispatch_workflow required inputs by adding compile-time capture and downgrading validation errors to non-fatal (+177/-30, 13 files). pr-finisher skill requested. 5h old.

Generated by 🔧 PR Triage Agent · 82.5 AIC · ⌖ 10.6 AIC · ⊞ 5.4K ·

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.

4 participants