Skip to content

Conclusion job (and failure reporting) is skipped when activation fails outside a named guardrail #74104

Done

Description

@johnwilliams-12

Summary

When the activation job fails for a reason that is not one of the named activation guardrails, the
agent job is skipped and so is the conclusion job. As a result, no failure issue or comment is
created: the only signal is the red run in the Actions tab. Typical causes:

  • an action used by the job cannot be downloaded in "Set up job" (repository not accessible, or blocked
    by an organisation policy), so the job runs none of its steps;
  • a checkout failure;
  • any step that crashes before it sets the guardrail outputs.

Users who want to be alerted have to add their own custom job with
if: always() && needs.activation.result == 'failure'.

Reproduced with gh-aw v1.0.1, the latest release. The code is unchanged on main at f37d3b9 (2026-11-02).

Evidence

The compiled conclusion job for a minimal Copilot workflow (v1.0.1):

  conclusion:
    needs: [activation, agent, ...]
    if: >
      always() && (needs.agent.result != 'skipped' || needs.activation.outputs.lockdown_check_failed == 'true' ||
      needs.activation.outputs.oauth_token_check_failed == 'true' || needs.activation.outputs.stale_lock_file_failed == 'true' ||
      needs.activation.outputs.secret_verification_result == 'failed' || needs.activation.outputs.daily_ai_credits_exceeded == 'true' ||
      needs.activation.outputs.daily_ai_credits_guardrail_status == 'structural_error' || needs.activation.outputs.daily_ai_credits_guardrail_status == 'transient_error')

If activation fails without setting any of those outputs, needs.agent.result is skipped and every
output is empty, so the condition is false and the job is skipped. The steps inside conclusion
(Handle agent failure, Report failed jobs) all use if: always(), so the job-level condition is
the only gate.

Analysis

There are three gates, and each excludes a generic activation failure:

  1. Job condition: buildConclusionJobCondition
    in pkg/workflow/notify_comment_conclusion_helpers.go builds
    always() && (agentNotSkipped || activationGuardrailsFailed), and activationGuardrailsFailed is
    only the named outputs.
  2. Failure handler: handle_agent_failure.cjs
    returns early unless GH_AW_AGENT_CONCLUSION is failure or one of the named flags is set. A skipped
    agent with no flags gives "skipping failure handling".
  3. Failed-jobs report: report_failed_jobs.cjs
    puts activation and pre_activation in BUILTIN_REPORTED_JOB_IDS ("reported via agent failure
    issue flags"). That holds only for the named guardrails.

Related: #59183 (a silent pre_activation failure, now closed) covered a different job and path.

A skipped (not failed) activation, for example when pre_activation decides not to run, must keep
skipping the conclusion. The fix should test needs.activation.result == 'failure', not
!= 'skipped'.

Implementation plan

  1. Conclusion condition (pkg/workflow/notify_comment_conclusion_helpers.go, buildConclusionJobCondition):

    • Add activationFailed := BuildEquals(BuildPropertyAccess("needs.activation.result"), BuildStringLiteral("failure"))
      using constants.ActivationJobName.
    • OR it into activationGuardrailsFailed.
    • Leave the work-queue early return and the add_comment handling unchanged.
  2. Pass the result to the handler (same file, next to each
    GH_AW_AGENT_CONCLUSION: ${{ needs.<main>.result }} at lines 130, 275 and 558):

    • Add GH_AW_ACTIVATION_RESULT: ${{ needs.activation.result }}.
  3. Handle it (actions/setup/js/handle_agent_failure.cjs):

    • Read const activationResult = process.env.GH_AW_ACTIVATION_RESULT || "" in main().
    • Define hasActivationFailure = activationResult === "failure" && !<any named activation flag>.
    • Add !hasActivationFailure to the early-return guard.
    • Add an "activation failed" failure category, following the existing lockdown and stale-lock-file
      categories. Its message tells the user the activation job failed before the agent started and links
      the run (GH_AW_RUN_URL), so they can inspect "Set up job" and the checkout steps.
    • Include it in the categories accepted by the report-failure-as-issue categories filter.
  4. Failed-jobs report (actions/setup/js/report_failed_jobs.cjs): either keep excluding
    activation now that step 3 reports it, or report it when GH_AW_ACTIVATION_RESULT is failure and
    no named flag is set. Pick one and document it, but don't report it twice.

  5. Tests:

    • Go: assert that the compiled conclusion.if contains needs.activation.result == 'failure', and
      that a workflow with an activation that is only skipped still produces a condition which is
      false for skipped activation. Extend notify_comment_test.go / notify_comment_failed_jobs_test.go.
    • JS: handle_agent_failure.test.cjs with GH_AW_AGENT_CONCLUSION=skipped and
      GH_AW_ACTIVATION_RESULT=failure creates the failure issue with the new category. With
      GH_AW_ACTIVATION_RESULT=skipped it still returns early.
    • Recompile the repository's workflows so the lock files pick up the new condition.
  6. Docs: add the activation-failure category wherever the failure-report categories are listed
    (docs/src/content/docs/reference/ safe-outputs / failure reporting).

  7. Run make agent-finish.

Acceptance criteria

  • When activation fails, the conclusion job runs and Handle agent failure creates the failure issue
    or comment with an "activation failed" category. That includes a failure in "Set up job" or in any step
    that sets none of the named outputs.
  • When activation is skipped, the conclusion job is still skipped.
  • The existing named-guardrail reports are unchanged and not duplicated.

Suggested labels: bug, workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions