From dae06461f51a81a6bbf3cd36234bdef129efcc87 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 1 Mar 2026 14:49:24 +0000
Subject: [PATCH 1/2] Initial plan
From fa3d6e5ac5087b72a49e099d81b8381f22c2d9dc Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 1 Mar 2026 14:59:50 +0000
Subject: [PATCH 2/2] Remove dead code: safe_output_unified_handler_manager.cjs
and its test
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
---
.../safe_output_unified_handler_manager.cjs | 1185 -----------------
...fe_output_unified_handler_manager.test.cjs | 396 ------
pkg/workflow/cjs_require_validation_test.go | 6 +-
3 files changed, 1 insertion(+), 1586 deletions(-)
delete mode 100644 actions/setup/js/safe_output_unified_handler_manager.cjs
delete mode 100644 actions/setup/js/safe_output_unified_handler_manager.test.cjs
diff --git a/actions/setup/js/safe_output_unified_handler_manager.cjs b/actions/setup/js/safe_output_unified_handler_manager.cjs
deleted file mode 100644
index ad42acbb01b..00000000000
--- a/actions/setup/js/safe_output_unified_handler_manager.cjs
+++ /dev/null
@@ -1,1185 +0,0 @@
-// @ts-check
-///
-
-/**
- * Unified Safe Output Handler Manager
- *
- * This module manages the dispatch of safe output messages to dedicated handlers.
- * It processes both regular and project-related safe outputs in a single step,
- * using the appropriate GitHub client based on the handler type.
- *
- * Regular handlers use the `github` object from github-script (authenticated with GH_AW_GITHUB_TOKEN)
- * Project handlers use a separate Octokit instance (authenticated with GH_AW_PROJECT_GITHUB_TOKEN)
- *
- * The @actions/github package is installed at runtime via setup.sh to enable Octokit instantiation.
- */
-
-const { loadAgentOutput } = require("./load_agent_output.cjs");
-const { getErrorMessage } = require("./error_helpers.cjs");
-const { ERR_CONFIG, ERR_PARSE, ERR_VALIDATION } = require("./error_codes.cjs");
-const { hasUnresolvedTemporaryIds, replaceTemporaryIdReferences, normalizeTemporaryId, loadTemporaryIdMap, isTemporaryId } = require("./temporary_id.cjs");
-const { generateMissingInfoSections } = require("./missing_info_formatter.cjs");
-const { sanitizeContent } = require("./sanitize_content.cjs");
-const { setCollectedMissings } = require("./missing_messages_helper.cjs");
-const { writeSafeOutputSummaries } = require("./safe_output_summary.cjs");
-const { getIssuesToAssignCopilot } = require("./create_issue.cjs");
-const { sortSafeOutputMessages } = require("./safe_output_topological_sort.cjs");
-const { loadCustomSafeOutputJobTypes } = require("./safe_output_helpers.cjs");
-const { createReviewBuffer } = require("./pr_review_buffer.cjs");
-const { createManifestLogger, ensureManifestExists, extractCreatedItemFromResult } = require("./safe_output_manifest.cjs");
-const { emitSafeOutputActionOutputs } = require("./safe_outputs_action_outputs.cjs");
-
-/**
- * Handler map configuration for regular handlers
- * Maps safe output types to their handler module file paths
- * These handlers use the `github` object from github-script
- */
-const HANDLER_MAP = {
- create_issue: "./create_issue.cjs",
- add_comment: "./add_comment.cjs",
- create_discussion: "./create_discussion.cjs",
- close_issue: "./close_issue.cjs",
- close_discussion: "./close_discussion.cjs",
- add_labels: "./add_labels.cjs",
- remove_labels: "./remove_labels.cjs",
- update_issue: "./update_issue.cjs",
- update_discussion: "./update_discussion.cjs",
- link_sub_issue: "./link_sub_issue.cjs",
- update_release: "./update_release.cjs",
- create_pull_request_review_comment: "./create_pr_review_comment.cjs",
- submit_pull_request_review: "./submit_pr_review.cjs",
- reply_to_pull_request_review_comment: "./reply_to_pr_review_comment.cjs",
- resolve_pull_request_review_thread: "./resolve_pr_review_thread.cjs",
- create_pull_request: "./create_pull_request.cjs",
- push_to_pull_request_branch: "./push_to_pull_request_branch.cjs",
- update_pull_request: "./update_pull_request.cjs",
- close_pull_request: "./close_pull_request.cjs",
- mark_pull_request_as_ready_for_review: "./mark_pull_request_as_ready_for_review.cjs",
- hide_comment: "./hide_comment.cjs",
- add_reviewer: "./add_reviewer.cjs",
- assign_milestone: "./assign_milestone.cjs",
- assign_to_user: "./assign_to_user.cjs",
- unassign_from_user: "./unassign_from_user.cjs",
- create_code_scanning_alert: "./create_code_scanning_alert.cjs",
- autofix_code_scanning_alert: "./autofix_code_scanning_alert.cjs",
- dispatch_workflow: "./dispatch_workflow.cjs",
- create_missing_tool_issue: "./create_missing_tool_issue.cjs",
- missing_tool: "./missing_tool.cjs",
- create_missing_data_issue: "./create_missing_data_issue.cjs",
- missing_data: "./missing_data.cjs",
- noop: "./noop_handler.cjs",
-};
-
-/**
- * Handler map configuration for project handlers
- * Maps project-related safe output types to their handler module file paths
- * These handlers require GH_AW_PROJECT_GITHUB_TOKEN and use an Octokit instance
- */
-const PROJECT_HANDLER_MAP = {
- create_project: "./create_project.cjs",
- create_project_status_update: "./create_project_status_update.cjs",
- update_project: "./update_project.cjs",
-};
-
-/**
- * Message types handled by standalone steps (not through the handler manager)
- * These types should not trigger warnings when skipped by the handler manager
- *
- * Other standalone types: assign_to_agent, create_agent_session, upload_asset, noop
- * - Have dedicated processing steps with specialized logic
- */
-const STANDALONE_STEP_TYPES = new Set(["assign_to_agent", "create_agent_session", "upload_asset", "noop"]);
-
-/**
- * Project-related message types that are handled by project handlers
- * Used to provide more specific handling
- */
-const PROJECT_RELATED_TYPES = new Set(Object.keys(PROJECT_HANDLER_MAP));
-
-/**
- * Load configuration for safe outputs
- * Reads configuration from both GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG and GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG
- * Automatically splits project handlers from regular config if they're in the wrong place
- * @returns {{regular: Object, project: Object}} Safe outputs configuration for regular and project handlers
- */
-function loadConfig() {
- const regular = {};
- const project = {};
-
- // Load regular handler config
- if (process.env.GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG) {
- try {
- const config = JSON.parse(process.env.GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG);
- core.info(`Loaded config from GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: ${JSON.stringify(config)}`);
-
- // Normalize config keys: convert hyphens to underscores
- const normalizedEntries = Object.entries(config).map(([k, v]) => [k.replace(/-/g, "_"), v]);
-
- // Automatically split project handlers from regular handlers
- // Project handlers (update_project, create_project, create_project_status_update) require
- // a separate Octokit client authenticated with GH_AW_PROJECT_GITHUB_TOKEN because they need
- // Projects permissions that differ from regular handler permissions. This auto-split ensures
- // backward compatibility with the Go compiler which puts all handlers in a unified config.
- for (const [key, value] of normalizedEntries) {
- if (PROJECT_RELATED_TYPES.has(key)) {
- project[key] = value;
- core.info(`Auto-moved ${key} from unified config to project config (requires project token)`);
- } else {
- regular[key] = value;
- }
- }
- } catch (error) {
- throw new Error(`${ERR_PARSE}: Failed to parse GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: ${getErrorMessage(error)}`);
- }
- }
-
- // Load project handler config (if explicitly provided, merge with auto-split handlers)
- if (process.env.GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG) {
- try {
- const config = JSON.parse(process.env.GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG);
- core.info(`Loaded project handler config: ${JSON.stringify(config)}`);
- // Normalize config keys: convert hyphens to underscores
- // Explicitly provided project config takes precedence over auto-split config
- Object.assign(project, Object.fromEntries(Object.entries(config).map(([k, v]) => [k.replace(/-/g, "_"), v])));
- } catch (error) {
- throw new Error(`${ERR_PARSE}: Failed to parse GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG: ${getErrorMessage(error)}`);
- }
- }
-
- // At least one config must be present
- if (Object.keys(regular).length === 0 && Object.keys(project).length === 0) {
- throw new Error(`${ERR_CONFIG}: At least one of GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG or GH_AW_SAFE_OUTPUTS_PROJECT_HANDLER_CONFIG environment variables is required`);
- }
-
- const regularCount = Object.keys(regular).length;
- const projectCount = Object.keys(project).length;
- core.info(`Configuration loaded: ${regularCount} regular handler${regularCount === 1 ? "" : "s"}, ${projectCount} project handler${projectCount === 1 ? "" : "s"}`);
- if (projectCount > 0) {
- core.info(`Project handlers: ${Object.keys(project).join(", ")}`);
- }
-
- return { regular, project };
-}
-
-/**
- * Setup a separate GitHub client for project handlers using Octokit
- * Creates an Octokit instance authenticated with GH_AW_PROJECT_GITHUB_TOKEN
- * This is necessary because project handlers need different permissions than regular handlers
- * @returns {Promise