From d8087ca1360001ddbb4b4bfb48f054633c02c895 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 22:41:37 +0000 Subject: [PATCH 1/3] Initial plan From fad8b3a6f5f000c0dfe184795e190dac6549674e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 22:46:25 +0000 Subject: [PATCH 2/3] fix(USE-001): add ERR_* error codes to close_entity_helpers and generate_safe_outputs_tools Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3ba6b526-f9a4-4964-aac7-3d4196459928 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/close_entity_helpers.cjs | 3 ++- actions/setup/js/generate_safe_outputs_tools.cjs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/actions/setup/js/close_entity_helpers.cjs b/actions/setup/js/close_entity_helpers.cjs index 82bdce944b8..eb138b08f5f 100644 --- a/actions/setup/js/close_entity_helpers.cjs +++ b/actions/setup/js/close_entity_helpers.cjs @@ -11,6 +11,7 @@ const { buildWorkflowRunUrl } = require("./workflow_metadata_helpers.cjs"); const { isStagedMode } = require("./safe_output_helpers.cjs"); const { logStagedPreviewInfo } = require("./staged_preview.cjs"); const { validateTargetRepo, resolveTargetRepoConfig } = require("./repo_helpers.cjs"); +const { ERR_API } = require("./error_codes.cjs"); /** * @typedef {'issue' | 'pull_request'} EntityType @@ -401,7 +402,7 @@ function createCloseEntityHandler(config, entityConfig, callbacks, githubClient) ); // commentPosted stays false; close operation continues } else { - throw commentError; + throw new Error(`${ERR_API}: Failed to add comment to ${entityConfig.displayName} #${entityNumber}: ${errorMsg}`); } } diff --git a/actions/setup/js/generate_safe_outputs_tools.cjs b/actions/setup/js/generate_safe_outputs_tools.cjs index e26861190de..25f5d39d382 100644 --- a/actions/setup/js/generate_safe_outputs_tools.cjs +++ b/actions/setup/js/generate_safe_outputs_tools.cjs @@ -28,6 +28,7 @@ const fs = require("fs"); const path = require("path"); +const { ERR_CONFIG } = require("./error_codes.cjs"); async function main() { const toolsSourcePath = process.env.GH_AW_SAFE_OUTPUTS_TOOLS_SOURCE_PATH || `${process.env.RUNNER_TEMP}/gh-aw/actions/safe_outputs_tools.json`; @@ -46,7 +47,7 @@ async function main() { // Load all source tools from the actions folder if (!fs.existsSync(toolsSourcePath)) { - const msg = `Error: Source tools file not found at: ${toolsSourcePath}`; + const msg = `${ERR_CONFIG}: Source tools file not found at: ${toolsSourcePath}`; console.error(msg); throw new Error(msg); } @@ -55,7 +56,7 @@ async function main() { // Load config to determine which tools are enabled if (!fs.existsSync(configPath)) { - const msg = `Error: Config file not found at: ${configPath}`; + const msg = `${ERR_CONFIG}: Config file not found at: ${configPath}`; console.error(msg); throw new Error(msg); } From e24cabb2ff99836452e426f8b2f71657346b63b4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 22:47:07 +0000 Subject: [PATCH 3/3] fix(USE-001): preserve original error cause in close_entity_helpers re-throw Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3ba6b526-f9a4-4964-aac7-3d4196459928 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/close_entity_helpers.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/setup/js/close_entity_helpers.cjs b/actions/setup/js/close_entity_helpers.cjs index eb138b08f5f..df3b71f8ec5 100644 --- a/actions/setup/js/close_entity_helpers.cjs +++ b/actions/setup/js/close_entity_helpers.cjs @@ -402,7 +402,7 @@ function createCloseEntityHandler(config, entityConfig, callbacks, githubClient) ); // commentPosted stays false; close operation continues } else { - throw new Error(`${ERR_API}: Failed to add comment to ${entityConfig.displayName} #${entityNumber}: ${errorMsg}`); + throw new Error(`${ERR_API}: Failed to add comment to ${entityConfig.displayName} #${entityNumber}: ${errorMsg}`, { cause: commentError }); } }