Fix: Set all job outputs in collect_ndjson_output.cjs early returns and error paths#15603
Merged
Conversation
…ollect_ndjson_output.cjs This fixes a bug where job outputs remain undefined when early return paths are taken (no output file, file doesn't exist) or when errors occur during ingestion. The detection and safe_outputs jobs depend on these outputs being defined, so they would skip if outputs were undefined. Changes: - Set output_types="" and has_patch="false" in early return paths - Set all outputs in error catch block before failing - Add tests to verify outputs are set in early return scenarios Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix collect_ndjson_output.cjs to set job outputs
Fix: Set all job outputs in collect_ndjson_output.cjs early returns and error paths
Feb 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in the collect_ndjson_output.cjs script where job outputs (output_types and has_patch) were not being set in early return paths and error handlers, causing downstream workflow jobs to skip incorrectly when they checked conditions like needs.agent.outputs.output_types != ''.
Changes:
- Set all three job outputs (
output,output_types,has_patch) in early return paths when no output file is configured or when the output file doesn't exist - Set all three job outputs in the error catch block before calling
setFailed() - Added test assertions to verify that all outputs are properly set in early return scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| actions/setup/js/collect_ndjson_output.cjs | Added core.setOutput() calls for output_types and has_patch in two early return paths (lines 170-171, 177-178) and in the error catch block (lines 342-344) to ensure all job outputs are consistently defined |
| actions/setup/js/collect_ndjson_output.test.cjs | Enhanced existing tests for early return scenarios to verify that output_types and has_patch outputs are properly set, ensuring the fix is covered by tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Feb 14, 2026
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
collect_ndjson_output.cjsscript only set theoutputjob output in early return and error code paths, leavingoutput_typesandhas_patchundefined. This caused the detection job conditionneeds.agent.outputs.output_types != ''to evaluate false, breaking the workflow chain.Changes
actions/setup/js/collect_ndjson_output.cjsoutput_types=""andhas_patch="false"setFailed()actions/setup/js/collect_ndjson_output.test.cjsoutput_typesandhas_patchare set in early return scenariosExample
Before:
After:
This ensures downstream jobs can evaluate conditions correctly even when the agent produces no outputs or encounters errors during ingestion.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name 64/pkg/tool/linu-importcfg(http block)/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name 64/pkg/tool/linu-nolocalimports 1 1 /var/log/sysstat--show-toplevel 64/pkg/tool/linu/tmp/go-build3162939764/b412/_testmain.go -c 1333162328/.github/workflows .cfg 64/pkg/tool/linux_amd64/vet(http block)https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha 2939764/b399/_pkg_.a /tmp/go-build3162939764/b201/vet.cfg 2939764/b399=>(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v3/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha se 2939764/b048/vet.cfg .cfg(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha .go o x_amd64/vet ath ../../../.prgit b/gh-aw/pkg/giturev-parse _modules/.bin/sh--show-toplevel x_amd64/vet -ato�� Gnbv/0a23WC6_jxwYuk0mGnbv -buildtags /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -errorsas -ifaceassert -nilfunc 2939764/b388/importcfg(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha OKEN }}(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -test.paniconexit0 -test.v=true(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v5/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha qbrT4ak5e .cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 2939764/b414/testutil.test -buildtags clusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle -errorsas -ifaceassert -nilfunc 4qBSgoBRlrikz/avxLPGO5v5ZsAOsG8WsF/788KaSlanoh1QIKEP8dB/iAJz33n4qBSgoBRlrikz -C runs/20260214-050203-14833/test-968444793 config 2939764/b414/_pkg_.a s/test.md --global ode_modules/.bin--show-toplevel git(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha WorkflowFiles_TransitiveImports1761435968/001 -1 /usr/bin/git */*.ts' '**/*.jsgit(http block)https://api.github.com/repos/actions/github-script/git/ref/tags/v8/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha on' --ignore-path ../../../.prettierignore(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha go1.25.0 -c=4 -nolocalimports -importcfg /tmp/go-build3162939764/b386/importcfg -pack /tmp/go-build3162939764/b386/_testmain.go conf�� --no-file-parall-errorsas user.email tions/node_modul-nilfunc(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha g/cli /tmp/go-build3162939764/b058/vet.cfg(http block)https://api.github.com/repos/actions/setup-node/git/ref/tags/v4Trev-parse sh x_amd64/link t-ha�� ithub/workflows/ai-moderator.md -buildtags /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet l -ifaceassert -nilfunc jN/JBtykRIlcGWOtwYUQjgZ/naM-_mlLtQWiLmcfGX_G` (http block)
Original prompt
This section details on the original issue you should resolve
<issue_title>Bug: collect_ndjson_output.cjs doesn't set job outputs, breaking workflow chain</issue_title>
<issue_description># Bug Report: Agent Job Outputs Not Set, Breaking Workflow Chain
Summary
The
collect_ndjson_output.cjsscript successfully processes safe outputs but fails to set GitHub Actions job outputs (output_types,has_patch). This breaks the workflow chain, causingdetectionandsafe_outputsjobs to skip, preventing PR comments from being posted.Environment
Expected Behavior
add_comment)/opt/gh-aw/safeoutputs/outputs.jsonlIngest agent outputstep (usingcollect_ndjson_output.cjs) processes outputsoutput_types= "add_comment",has_patch= appropriate valueneeds.agent.outputs.output_types != '')needs.detection.outputs.success == 'true')Actual Behavior
add_commentsuccessfullyIngest agent outputstep succeeds (conclusion: success)Evidence
Workflow Run Details
Agent Job Status
{ "name": "agent", "conclusion": "failure", "outputs": {} // Empty - should contain output_types and has_patch }Ingest Agent Output Step
Safe Outputs File Content
{ "items": [ { "body": "## 🤖 Automated PR Review: ...", "item_number": 80, "type": "add_comment" } ], "errors": [] }Note: The safe outputs file is correctly formatted with
type: "add_comment", butoutput_typesjob output was not set.Expected Job Outputs (from workflow line 88-94)
These should be set by
collect_ndjson_output.cjsbut remain undefined.Steps to Reproduce
add_commentsuccessfullyWorkflow Configuration
.md source (simplified):
Compiled workflow: https://github.com/otrajman/chichaq/blob/main/.github/workflows/pr-review-agent.lock.yml
Impact
Relevant Workflow Lines
Additional Context
collect_ndjson_output.cjsscript appears to process the file successfully (step succeeds)core.setOutput()is either not being called or outputs aren't propagating to job levelArtifacts Available
If helpful for debugging, these artifacts are available from the workflow run:
💡 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.