Skip to content

Evergreen: skip agent and conclusion when no PR needs attention#161

Merged
mrjf merged 2 commits into
mainfrom
copilot/fix-agent-job-no-prs-need-attention
Apr 21, 2026
Merged

Evergreen: skip agent and conclusion when no PR needs attention#161
mrjf merged 2 commits into
mainfrom
copilot/fix-agent-job-no-prs-need-attention

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 21, 2026

At every-5-min cadence, Evergreen runs the agent even when no open PR is sick. The agent responds with prose instead of calling noop, gh-aw treats the empty safe-outputs as failure, and a fresh false-failure issue gets filed every run.

Fix: surface the pre-step's selection as a step output and gate the expensive/noisy downstream work on it.

.github/workflows/evergreen.md (source)

  • Add id: find-pr to the pre-step.
  • Add an emit_selected_output(pr_number) helper invoked at every exit path so selected is always written to $GITHUB_OUTPUT (empty when nothing to do, PR number otherwise).
def emit_selected_output(pr_number):
    gh_output = os.environ.get("GITHUB_OUTPUT")
    if gh_output:
        with open(gh_output, "a") as f:
            f.write(f"selected={'' if pr_number is None else pr_number}\n")

.github/workflows/evergreen.lock.yml (mirrors source so the fix is effective without waiting for a gh-aw recompile)

  • Same id + emit changes inside the embedded python.
  • Promote selected to an agent job output: selected: ${{ steps.find-pr.outputs.selected }}.
  • Gate the Execute GitHub Copilot CLI step with if: steps.find-pr.outputs.selected != '' — skips the Copilot invocation when idle.
  • Extend the conclusion job condition with && (needs.agent.outputs.selected != '' || needs.activation.outputs.lockdown_check_failed == 'true'). The conclusion job hosts Handle Agent Failure (the step that files the false issue); gating it here is what stops the noise. Lockdown-failure escape hatch preserved.

Behavior

  • Idle: Copilot step skipped, conclusion job skipped → no failure issue filed, no Copilot spend.
  • Sick PR: unchanged end-to-end.
  • Forced PR via workflow_dispatch: unchanged; selected is populated as today.

Note

The .lock.yml edit duplicates the .md change so the fix takes effect immediately. A subsequent gh-aw recompile will reproduce the same result from source.

Copilot AI changed the title [WIP] Fix agent job to skip runs when no PRs need attention Evergreen: skip agent and conclusion when no PR needs attention Apr 21, 2026
Copilot finished work on behalf of mrjf April 21, 2026 04:25
Copilot AI requested a review from mrjf April 21, 2026 04:25
@mrjf mrjf marked this pull request as ready for review April 21, 2026 15:02
@mrjf mrjf merged commit 8c186af into main Apr 21, 2026
17 checks passed
@mrjf mrjf deleted the copilot/fix-agent-job-no-prs-need-attention branch April 21, 2026 15:07
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.

Evergreen: skip agent job when no PR needs attention (stop creating false failure issues)

2 participants