Skip to content

Fix safe output handlers returning { success: false } incorrectly marked as successful and GraphQL query error in project status updates - #9666

Merged
mnkiefer merged 3 commits into
mainfrom
copilot/fix-project-status-update
Jan 11, 2026
Merged

Fix safe output handlers returning { success: false } incorrectly marked as successful and GraphQL query error in project status updates#9666
mnkiefer merged 3 commits into
mainfrom
copilot/fix-project-status-update

Conversation

Copilot AI commented Jan 11, 2026

Copy link
Copy Markdown
Contributor

Safe output handlers that catch exceptions and return { success: false, error: "..." } were incorrectly logged as successful. The handler manager only caught thrown exceptions, missing the explicit failure signal in the return value.

Additionally, the GraphQL query for listing projects was causing API errors due to requesting redundant fields.

From workflow run #20901743240:

Creating status update for project: https://github.com/orgs/githubnext/projects/73
✗ Failed to create project status update: GraphQL query failed
✓ Message 16 (create_project_status_update) completed successfully  ← Wrong

Changes

Handler manager (safe_output_handler_manager.cjs)

  • Added explicit check for result.success === false after handler invocation
  • Applied in both main processing loop and deferred retry loop
  • Skip success logic and record error when detected
const result = await messageHandler(message, resolvedTemporaryIds);

if (result && result.success === false && !result.deferred) {
  const errorMsg = result.error || "Handler returned success: false";
  core.error(`✗ Message ${i + 1} (${messageType}) failed: ${errorMsg}`);
  results.push({ type: messageType, messageIndex: i, success: false, error: errorMsg });
  continue;
}

Project status update handler (create_project_status_update.cjs)

  • Fixed listAccessibleProjectsV2 GraphQL query to use only nodes field instead of both nodes and edges
  • Removed redundant field that was causing "Something went wrong while executing your query" API errors
  • Simplified node processing logic

Test coverage (safe_output_handler_manager.test.cjs)

  • Added test case verifying handlers returning { success: false } are treated as failures

Impact

Handler Manager Fix: Affects all handlers using the error-catching pattern (~20+ handlers):

  • create_project_status_update, create_issue, add_comment, add_labels, add_reviewer, assign_milestone, close_issue, close_pull_request, create_code_scanning_alert, dispatch_workflow, hide_comment, link_sub_issue, update_issue, update_discussion, update_pull_request, and others

GraphQL Query Fix: Eliminates API errors when falling back to list-based project resolution, making project status updates more reliable

Original prompt

See run: https://github.com/githubnext/gh-aw/actions/runs/20901743240
We see the agent called:
Analyze failing ✓ safeoutputs-update_project
└ {"content":[{"text":"{"result":"success"}","type":"text"}]}
But the project status update never happens.
safe_outputs
Failed to create project status update: Request failed due to following response errors:

  • Something went wrong while executing your query on 2026-01-11T21:14:46Z. Please include 1830:81121:56BF94:175C13D:696412C6 when reporting this issue.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

The safe_output_handler_manager now checks if handlers return { success: false }
and treats them as failures. Previously, only exceptions were caught as failures,
causing handlers that catch their own errors and return success:false to be
incorrectly marked as successful.

This fixes the issue where create_project_status_update would report success
even when encountering GraphQL errors.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix project status update failure due to query error Fix safe output handlers returning { success: false } incorrectly marked as successful Jan 11, 2026
Copilot AI requested a review from mnkiefer January 11, 2026 21:34
@mnkiefer

Copy link
Copy Markdown
Collaborator

@copilot Also fix underlying issue for failing project status update.

Removed redundant edges field from the GraphQL query which was causing
API errors. The projectsV2 connection should use nodes field for simple
queries without pagination cursors. This fixes the "Something went wrong
while executing your query" error when falling back to list-based project
resolution.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>

Copilot AI commented Jan 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Also fix underlying issue for failing project status update.

Fixed in 0f54983. The underlying issue was that the GraphQL query in listAccessibleProjectsV2 was requesting both nodes and edges fields, which was causing API errors. Simplified the query to use only the nodes field, which is the standard pattern for non-paginated queries.

Copilot AI changed the title Fix safe output handlers returning { success: false } incorrectly marked as successful Fix safe output handlers returning { success: false } incorrectly marked as successful and GraphQL query error in project status updates Jan 11, 2026
@mnkiefer
mnkiefer marked this pull request as ready for review January 11, 2026 21:41
@mnkiefer
mnkiefer merged commit 707ef0f into main Jan 11, 2026
115 checks passed
@mnkiefer
mnkiefer deleted the copilot/fix-project-status-update branch January 11, 2026 21:52
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.

2 participants