Save failure mode to usage artifact as failure_mode.json#38511
Closed
Copilot wants to merge 2 commits into
Closed
Conversation
- Add FAILURE_MODE_PATH constant and write three-stage JSON (detected, filtered, identified) in handle_agent_failure.cjs - Move buildUsageArtifactUploadSteps after agentFailureSteps in notify_comment.go so failure_mode.json is written before upload - Add failure_mode.json to usage artifact upload path list - Add FAILURE_MODE_PATH to module exports - Update Go and JS tests; recompile all lock files Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
June 11, 2026 06:08
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures a structured failure_mode.json file produced by handle_agent_failure is captured in the compact “usage” artifact by (1) writing the file under /tmp/gh-aw/usage/ and (2) reordering/uploading artifact steps so the file exists before upload across generated workflows.
Changes:
- Write
/tmp/gh-aw/usage/failure_mode.jsonfromhandle_agent_failure.cjswith{ detected, filtered, identified }failure-mode data. - Reorder conclusion-job steps so usage artifact upload occurs after “Handle agent failure”, and include
failure_mode.jsonin the upload paths. - Add/extend Go + JS tests to cover the new path and step ordering, plus env cleanup.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/notify_comment.go | Moves usage artifact upload steps after agent failure handling; adds failure_mode.json to artifact paths. |
| pkg/workflow/notify_comment_test.go | Asserts failure_mode.json is included and upload ordering is after “Handle agent failure”. |
| actions/setup/js/handle_agent_failure.cjs | Writes failure_mode.json under /tmp/gh-aw/usage/ and exports FAILURE_MODE_PATH. |
| actions/setup/js/handle_agent_failure.test.cjs | Adds coverage for failure_mode.json output shape and fixes missing env cleanup. |
| .github/workflows/workflow-normalizer.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/workflow-health-manager.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/workflow-generator.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/video-analyzer.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/update-astro.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/typist.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/test-workflow.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/test-project-url-default.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/test-dispatcher.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/super-linter.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/static-analysis-report.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/spec-extractor.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/spec-enforcer.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/sergo.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/security-compliance.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/research.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/release.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/refiner.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/org-health-report.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/jsweep.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/hippo-embed.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/gpclean.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/go-logger.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/go-fan.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/firewall.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/example-permissions-warning.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/dev-hawk.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/delight.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/deep-report.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/daily-news.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/copilot-opt.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/contribution-check.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/codex-github-remote-mcp-test.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/changeset.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/avenger.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
| .github/workflows/artifacts-summary.lock.yml | Reorders usage artifact collection/upload after handle-failure; adds failure_mode.json path. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 138/249 changed files
- Comments generated: 1
Comment on lines
+2677
to
+2680
| hasCreateDiscussionErrors, | ||
| hasCodePushFailures, | ||
| hasPushRepoMemoryFailure, | ||
| hasMissingSafeOutputs, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The conclusion job's handle-failure step writes failure signal data but it wasn't captured in the usage artifact — analytics consumers had no structured record of how a run failed.
Changes
handle_agent_failure.cjsFAILURE_MODE_PATH = "/tmp/gh-aw/usage/failure_mode.json"and writes it alongsidefailure_categories.jsonwith three stages of failure analysis:{ "detected": { "agentConclusion": "failure", "isTimedOut": false, ... }, "filtered": ["agent_failure"], "identified": "agent_failure" }detected: all raw boolean signal flags read from env/agent outputfiltered: thefailureCategoriesarray (same source asfailure_categories.json)identified:failureCategories[0]ornullnotify_comment.go— step ordering fixbuildUsageArtifactUploadStepsto afteragentFailureStepsinbuildConclusionJob. Previously the usage artifact was uploaded before handle-failure ran, so any file written there would be missed./tmp/gh-aw/usage/failure_mode.jsonto the upload path list (if-no-files-found: ignorekeeps this safe on success runs where the file is never written).Tests
failure_mode.jsonin upload paths and that "Upload usage artifact" follows "Handle agent failure" in step order.FAILURE_MODE_PATHis written with correctdetected/filtered/identifiedstructure; fixes missingGH_AW_AGENTIC_ENGINE_TIMEOUTcleanup inafterEach.