Skip to content

Fix update_reaction job failure when agent output artifact is missing#1883

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-update-reaction-error-handling
Oct 17, 2025
Merged

Fix update_reaction job failure when agent output artifact is missing#1883
pelikhan merged 3 commits intomainfrom
copilot/fix-update-reaction-error-handling

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 17, 2025

Problem

The update_reaction job fails when the agent doesn't produce an output artifact, as seen in workflow run #18603329251. The failure occurs because:

  1. The artifact download step fails (expected, using continue-on-error: true)
  2. When the download fails, the directory /tmp/gh-aw/safe-outputs/ is never created by the actions/download-artifact action
  3. The subsequent find /tmp/gh-aw/safe-outputs/ -type f -print command fails with exit code 1
##[error]Unable to download artifact(s): Artifact not found for name: agent_output.json
find: '/tmp/gh-aw/safe-outputs/': No such file or directory
##[error]Process completed with exit code 1.

Solution

Modified the buildAgentOutputDownloadSteps() function in pkg/workflow/safe_output_helpers.go to create the directory before attempting to list its contents:

- name: Setup agent output environment variable
  run: |
    mkdir -p /tmp/gh-aw/safe-outputs/
    find /tmp/gh-aw/safe-outputs/ -type f -print
    echo "GITHUB_AW_AGENT_OUTPUT=/tmp/gh-aw/safe-outputs/agent_output.json" >> $GITHUB_ENV

This ensures the directory exists even when the artifact download fails, allowing the job to continue gracefully.

Impact

This fix applies to all safe output jobs that download agent output artifacts:

  • add_comment job
  • missing_tool job
  • update_reaction job

These jobs will now handle the case where the agent doesn't produce output artifacts without failing.

Testing

  • Added TestBuildAgentOutputDownloadSteps to verify directory creation occurs before the find command
  • All existing tests pass
  • Recompiled all 64 workflows successfully
  • Verified the fix appears in generated workflow files
Original prompt

The javascript for the "update_reaction" job needs to handle the case where the agent output artifact was not created and the folder is not present.

See error in update_reaction job in https://github.com/githubnext/gh-aw/actions/runs/18603329251/job/53047201050


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…tory

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error handling for missing artifact in update_reaction job Fix update_reaction job failure when agent output artifact is missing Oct 17, 2025
Copilot AI requested a review from pelikhan October 17, 2025 20:18
@pelikhan pelikhan marked this pull request as ready for review October 17, 2025 20:23
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit d662a82 into main Oct 17, 2025
9 of 15 checks passed
@pelikhan pelikhan deleted the copilot/fix-update-reaction-error-handling branch October 17, 2025 20:26
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