Skip to content

Commit 8c7d04e

Browse files
chore: sync actions from gh-aw@v0.80.9 (#166)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent bee9622 commit 8c7d04e

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

setup/js/assign_to_agent.cjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async function main(config = {}) {
8787
if (configuredBaseBranch) core.info(`Configured base branch: ${configuredBaseBranch}`);
8888
core.info(`Target configuration: ${targetConfig}`);
8989
core.info(`Max count: ${maxCount}`);
90-
if (ignoreIfError) core.info("Ignore-if-error mode enabled: Will not fail if agent assignment encounters auth errors");
90+
if (ignoreIfError) core.info("Ignore-if-error mode enabled: Will not fail if agent assignment encounters auth or availability errors");
9191
if (allowedAgents) core.info(`Allowed agents: ${allowedAgents.join(", ")}`);
9292
core.info(`Default target repo: ${defaultTargetRepo}`);
9393
if (allowedRepos.size > 0) core.info(`Allowed repos: ${[...allowedRepos].join(", ")}`);
@@ -393,15 +393,17 @@ async function main(config = {}) {
393393
let errorMessage = getErrorMessage(error);
394394

395395
const isAuthError = ["Bad credentials", "Not Authenticated", "Resource not accessible", "Insufficient permissions", "requires authentication"].some(msg => errorMessage.includes(msg));
396+
const isAvailabilityError = errorMessage.includes("coding agent is not available for this repository");
396397

397-
if (ignoreIfError && isAuthError) {
398-
core.warning(`Agent assignment failed for ${agentName} on ${type} #${number} due to authentication/permission error. Skipping due to ignore-if-error=true.`);
398+
if (ignoreIfError && (isAuthError || isAvailabilityError)) {
399+
const errorType = isAuthError ? "authentication/permission" : "agent availability";
400+
core.warning(`Agent assignment failed for ${agentName} on ${type} #${number} due to ${errorType} error. Skipping due to ignore-if-error=true.`);
399401
core.info(`Error details: ${errorMessage}`);
400402
_allResults.push({ issue_number: issueNumber, pull_number: pullNumber, agent: agentName, owner: effectiveOwner, repo: effectiveRepo, pull_request_repo: effectivePullRequestRepoSlug, success: true, skipped: true });
401403
return { success: true, skipped: true };
402404
}
403405

404-
if (errorMessage.includes("coding agent is not available for this repository")) {
406+
if (isAvailabilityError) {
405407
try {
406408
const available = await getAvailableAgentLogins(effectiveOwner, effectiveRepo, githubClient);
407409
if (available.length > 0) errorMessage += ` (available agents: ${available.join(", ")})`;

setup/js/mcp_server_core.cjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,11 @@ async function handleMessage(server, req, defaultHandler) {
984984
server.replyError(id, -32601, `Method not found: ${method}`);
985985
}
986986
} catch (e) {
987-
server.replyError(id, -32603, e instanceof Error ? e.message : String(e));
987+
// Use the error code only if it's a valid JSON-RPC error code (must be a negative integer).
988+
// Subprocess exit codes (positive integers like 1, 2, etc.) must not be used as JSON-RPC
989+
// error codes, as that would produce non-conformant responses (e.g. "code=1").
990+
const code = e && typeof e === "object" && Number.isInteger(e.code) && e.code < 0 ? e.code : -32603;
991+
server.replyError(id, code, e && e.message ? String(e.message) : "Internal error");
988992
}
989993
}
990994

0 commit comments

Comments
 (0)