MCPcopy Create free account
hub / github.com/github/gh-aw / buildAssignmentErrorsContext

Function buildAssignmentErrorsContext

actions/setup/js/handle_agent_failure.cjs:2093–2119  ·  view source on GitHub ↗

* Build a context string when assign_to_agent reported assignment errors. * Includes remediation guidance for token and Copilot access setup. * @param {string} assignmentErrors * @returns {string}

(assignmentErrors)

Source from the content-addressed store, hash-verified

2091 * @returns {string}
2092 */
2093function buildAssignmentErrorsContext(assignmentErrors) {
2094 if (!assignmentErrors || !assignmentErrors.trim()) {
2095 return "";
2096 }
2097
2098 let context = buildWarningAlertLine("Agent Assignment Failed", "Failed to assign agent to issues or pull requests.");
2099 context += "\n**Assignment Errors:**\n";
2100
2101 const errorLines = assignmentErrors.split("\n").filter(line => line.trim());
2102 for (const errorLine of errorLines) {
2103 const parts = errorLine.split(":");
2104 if (parts.length >= 4) {
2105 const type = parts[0]; // "issue" or "pr"
2106 const number = parts[1];
2107 const agent = parts[2];
2108 const error = parts.slice(3).join(":");
2109 context += `- ${type === "issue" ? "Issue" : "PR"} #${number} (agent: ${agent}): ${error}\n`;
2110 }
2111 }
2112
2113 context += "\nTo resolve this, verify the agent token and Copilot access configuration:\n";
2114 context += "- Configure a valid `GH_AW_AGENT_TOKEN` as a fine-grained PAT with **Agent tasks: read and write** permission (GitHub App installation tokens are not supported)\n";
2115 context += "- Ensure Copilot coding agent is enabled for this repository and a Copilot Business or Enterprise subscription is active\n";
2116 context += "- Docs: https://github.github.com/gh-aw/reference/copilot-cloud-agent/#authentication\n\n";
2117
2118 return context;
2119}
2120/**
2121 * Build a context string when assigning the Copilot coding agent to created issues failed.
2122 * @param {boolean} hasAssignCopilotFailures - Whether any copilot assignments failed

Callers 2

mainFunction · 0.85

Calls 1

buildWarningAlertLineFunction · 0.85

Tested by

no test coverage detected