Report agent assignment failures without blocking safe_outputs job#13719
Report agent assignment failures without blocking safe_outputs job#13719
Conversation
…tputs job Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR ensures that agent assignment failures no longer cause the safe_outputs job to fail, allowing downstream safe-output operations (issues, comments, etc.) to still run while surfacing assignment problems via the conclusion job.
Changes:
- Update
assign_to_agent.cjsto replacecore.setFailedwithcore.warningwhen one or more agent assignments fail, while still settingassignment_errorsandassignment_error_countoutputs for the conclusion job. - Keep configuration validation errors (e.g., invalid
GH_AW_AGENT_MAX_COUNT) failing the job viacore.setFailed, preserving strictness for misconfiguration. - Adjust unit tests in
assign_to_agent.test.cjsto expect warnings instead of job failure for assignment error paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| actions/setup/js/assign_to_agent.cjs | Switches agent-assignment failure handling from failing the job to emitting a warning, while preserving outputs consumed by handle_agent_failure.cjs. |
| actions/setup/js/assign_to_agent.test.cjs | Updates tests to assert on core.warning for assignment failures and maintains existing checks around core.setFailed only for configuration/other non-assignment paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| expect(mockCore.warning).toHaveBeenCalledWith(expect.stringContaining('Agent "unsupported-agent" is not supported')); | ||
| expect(mockCore.setFailed).toHaveBeenCalledWith(expect.stringContaining("Failed to assign 1 agent(s)")); | ||
| expect(mockCore.warning).toHaveBeenCalledWith(expect.stringContaining("Failed to assign 1 agent(s)")); |
There was a problem hiding this comment.
Given the PR’s goal is to stop failing the safe_outputs job on agent-assignment errors, this test now only asserts that a warning is logged but no longer checks that core.setFailed is not called. To lock in the new behavior and prevent regressions where assignment failures start failing the job again, consider adding an assertion like expect(mockCore.setFailed).not.toHaveBeenCalled() here (and/or in at least one other failure-path test).
Agent assignment failures currently fail the
safe_outputsjob viacore.setFailed(), blocking other safe output operations (issue creation, comments, etc). Assignment errors should be reported in the conclusion job without failingsafe_outputs.Changes
actions/setup/js/assign_to_agent.cjscore.setFailed()withcore.warning()when assignments fail (line 431)assignment_errors,assignment_error_count)actions/setup/js/assign_to_agent.test.cjsexpect(mockCore.setFailed)→expect(mockCore.warning)Flow
The
handle_agent_failure.cjsscript already reads these outputs fromsafe_outputsjob and formats them in failure issues/comments (lines 339-340, 429-444, 511-527).Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.