Skip to content

fix: improve upload_artifact error diagnostics and workflow staging instructions#25786

Merged
pelikhan merged 1 commit intomainfrom
copilot/investigate-upload-artifact-failure
Apr 11, 2026
Merged

fix: improve upload_artifact error diagnostics and workflow staging instructions#25786
pelikhan merged 1 commit intomainfrom
copilot/investigate-upload-artifact-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

The api-consumption-report workflow failed 3 consecutive days (runs 6–8) because the AI agent never copies generated charts to the staging directory before calling upload_artifact. The error message provided no hint about what went wrong — just "path does not exist."

Changes

  • actions/setup/js/upload_artifact.cjs — When a requested path doesn't exist in the staging directory, the error now lists available files (or states the directory is empty):

    path does not exist in staging directory: charts/api_calls_trend.png.
    The staging directory is empty — did you forget to copy files to /tmp/gh-aw/safeoutputs/upload-artifacts/?
    
  • .github/workflows/api-consumption-report.md (Step 5) — Replaced vague "stage each chart" instruction with explicit cp commands, a verification step, and guidance to use flat filenames (not subdirectory paths like charts/api_calls_trend.png)

…nstructions

- Enhanced error message when path not found in staging directory to list
  available files or indicate the directory is empty, helping diagnose
  whether the agent forgot to copy files or used the wrong path
- Updated api-consumption-report.md Step 5 with explicit shell commands
  for staging chart files and correct path format guidance
- Addresses 3 consecutive daily failures (runs 6-8) caused by the AI agent
  not copying charts to the staging directory before calling upload_artifact

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3240af67-1ba1-4b22-91cf-a5b20c589d5b

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review April 11, 2026 11:03
Copilot AI review requested due to automatic review settings April 11, 2026 11:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves diagnostics and workflow documentation for upload_artifact to prevent/triage failures when expected files aren’t staged into the safe-outputs upload directory.

Changes:

  • Enhance upload_artifact missing-path errors to include staged file listings (or an “empty staging dir” hint).
  • Update api-consumption-report workflow instructions to explicitly cp chart PNGs into the staging directory and verify with ls.
  • Clarify that artifact uploads should reference staged filenames (not charts/... paths) for this workflow.
Show a summary per file
File Description
actions/setup/js/upload_artifact.cjs Adds richer error hints (available staged files / empty staging directory guidance) when a requested path is missing.
.github/workflows/api-consumption-report.md Rewrites Step 5 with explicit staging + verification commands and clearer path usage guidance.

Copilot's findings

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines +145 to +149
const available = listFilesRecursive(STAGING_DIR, STAGING_DIR);
const hint =
available.length > 0
? ` Available files: [${available.slice(0, 20).join(", ")}]${available.length > 20 ? ` … and ${available.length - 20} more` : ""}`
: " The staging directory is empty — did you forget to copy files to " + STAGING_DIR + "?";
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

The hint branch treats a missing staging directory the same as an empty one: listFilesRecursive() returns [] when STAGING_DIR doesn’t exist, so the message says “The staging directory is empty …” even though the directory may be missing. Consider checking fs.existsSync(STAGING_DIR) separately and using a more accurate hint (e.g., distinguish “does not exist” vs “is empty”).

Suggested change
const available = listFilesRecursive(STAGING_DIR, STAGING_DIR);
const hint =
available.length > 0
? ` Available files: [${available.slice(0, 20).join(", ")}]${available.length > 20 ? ` … and ${available.length - 20} more` : ""}`
: " The staging directory is empty — did you forget to copy files to " + STAGING_DIR + "?";
const stagingDirExists = fs.existsSync(STAGING_DIR);
const available = stagingDirExists ? listFilesRecursive(STAGING_DIR, STAGING_DIR) : [];
const hint =
available.length > 0
? ` Available files: [${available.slice(0, 20).join(", ")}]${available.length > 20 ? ` … and ${available.length - 20} more` : ""}`
: stagingDirExists
? " The staging directory is empty — did you forget to copy files to " + STAGING_DIR + "?"
: " The staging directory does not exist — did you forget to create or populate " + STAGING_DIR + "?";

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 8b1a594 into main Apr 11, 2026
78 of 79 checks passed
@pelikhan pelikhan deleted the copilot/investigate-upload-artifact-failure branch April 11, 2026 13:45
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.

3 participants