-
Notifications
You must be signed in to change notification settings - Fork 46
Skip agent failure issues when PR checkout fails #13397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1111,4 +1111,96 @@ When prompted, instruct the agent to debug this workflow failure.`; | |
| expect(mockCore.info).toHaveBeenCalledWith(expect.stringContaining("Found existing parent issue #5")); | ||
| }); | ||
| }); | ||
|
|
||
| describe("checkout PR failure via output", () => { | ||
| it("should skip issue creation when checkout_pr_success is false", async () => { | ||
| // Set the checkout PR failure environment variable | ||
| process.env.GH_AW_CHECKOUT_PR_SUCCESS = "false"; | ||
|
|
||
| await main(); | ||
|
|
||
| // Verify that no issue was created | ||
| expect(mockGithub.rest.issues.create).not.toHaveBeenCalled(); | ||
| expect(mockGithub.rest.issues.createComment).not.toHaveBeenCalled(); | ||
| expect(mockCore.info).toHaveBeenCalledWith(expect.stringContaining("Skipping failure handling - failure was due to PR checkout")); | ||
| }); | ||
|
|
||
| it("should create issue when checkout_pr_success is true", async () => { | ||
| // Set the checkout PR success environment variable | ||
| process.env.GH_AW_CHECKOUT_PR_SUCCESS = "true"; | ||
|
|
||
| mockGithub.rest.search.issuesAndPullRequests | ||
| .mockResolvedValueOnce({ | ||
| // First search: PR search (no PR found) | ||
| data: { total_count: 0, items: [] }, | ||
| }) | ||
| .mockResolvedValueOnce({ | ||
| // Second search: parent issue | ||
| data: { total_count: 0, items: [] }, | ||
| }) | ||
| .mockResolvedValueOnce({ | ||
| // Third search: failure issue | ||
| data: { total_count: 0, items: [] }, | ||
| }); | ||
|
|
||
| mockGithub.rest.issues.create | ||
| .mockResolvedValueOnce({ | ||
| data: { number: 1, html_url: "https://example.com/1", node_id: "I_1" }, | ||
| }) | ||
| .mockResolvedValueOnce({ | ||
| data: { number: 2, html_url: "https://example.com/2", node_id: "I_2" }, | ||
| }); | ||
|
|
||
| mockGithub.graphql = vi.fn().mockResolvedValue({ | ||
| addSubIssue: { | ||
| issue: { id: "I_1", number: 1 }, | ||
| subIssue: { id: "I_2", number: 2 }, | ||
| }, | ||
| }); | ||
|
|
||
| await main(); | ||
|
|
||
| // Verify issue was created | ||
| expect(mockGithub.rest.issues.create).toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it("should create issue when checkout_pr_success is not set", async () => { | ||
| // Don't set GH_AW_CHECKOUT_PR_SUCCESS (workflow without PR checkout) | ||
| delete process.env.GH_AW_CHECKOUT_PR_SUCCESS; | ||
|
|
||
| mockGithub.rest.search.issuesAndPullRequests | ||
| .mockResolvedValueOnce({ | ||
| // First search: PR search (no PR found) | ||
| data: { total_count: 0, items: [] }, | ||
| }) | ||
| .mockResolvedValueOnce({ | ||
| // Second search: parent issue | ||
| data: { total_count: 0, items: [] }, | ||
| }) | ||
| .mockResolvedValueOnce({ | ||
| // Third search: failure issue | ||
| data: { total_count: 0, items: [] }, | ||
| }); | ||
|
|
||
| mockGithub.rest.issues.create | ||
| .mockResolvedValueOnce({ | ||
| data: { number: 1, html_url: "https://example.com/1", node_id: "I_1" }, | ||
| }) | ||
| .mockResolvedValueOnce({ | ||
| data: { number: 2, html_url: "https://example.com/2", node_id: "I_2" }, | ||
| }); | ||
|
|
||
| mockGithub.graphql = vi.fn().mockResolvedValue({ | ||
| addSubIssue: { | ||
| issue: { id: "I_1", number: 1 }, | ||
| subIssue: { id: "I_2", number: 2 }, | ||
| }, | ||
| }); | ||
|
|
||
| await main(); | ||
|
|
||
| // Verify issue was created (normal failure handling) | ||
| expect(mockGithub.rest.issues.create).toHaveBeenCalled(); | ||
| }); | ||
| }); | ||
|
Comment on lines
+1115
to
+1205
|
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition should also check that there are no assignment errors or missing safe outputs before skipping issue creation. If a PR checkout fails but there are also assignment errors or missing safe outputs, an issue should still be created to report those problems. The condition should be:
if (agentConclusion === "failure" && checkoutPRSuccess === "false" && !hasAssignmentErrors && !hasMissingSafeOutputs)