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

Function buildCredentialAuthErrorContext

actions/setup/js/handle_agent_failure.cjs:2070–2085  ·  view source on GitHub ↗

* Build a context string when the firewall audit log shows authentication rejections * from AI provider endpoints (expired or missing API credentials). * * Reads audit.jsonl from the known path relative to GH_AW_AGENT_OUTPUT and surfaces * a remediation hint for each affected provider in the fai

(auditJsonlPathOverride)

Source from the content-addressed store, hash-verified

2068 * @returns {string} Formatted context string, or empty string if no auth errors
2069 */
2070function buildCredentialAuthErrorContext(auditJsonlPathOverride) {
2071 const auditJsonlPath = resolveFirewallAuditLogPath(auditJsonlPathOverride);
2072
2073 const authErrors = parseFirewallAuthErrors(auditJsonlPath);
2074
2075 if (authErrors.length === 0) {
2076 return "";
2077 }
2078
2079 core.info(`Firewall audit log: detected ${authErrors.length} credential auth rejection(s) for: ${authErrors.map(e => e.provider).join(", ")}`);
2080
2081 const providersList = authErrors.map(e => `- ${e.provider} (${e.credential})`).join("\n");
2082
2083 const templatePath = getPromptPath("credential_auth_error.md");
2084 return "\n" + renderTemplateFromFile(templatePath, { providers: providersList });
2085}
2086
2087/**
2088 * Build a context string when assign_to_agent reported assignment errors.

Callers 2

mainFunction · 0.85

Calls 4

parseFirewallAuthErrorsFunction · 0.85
getPromptPathFunction · 0.85
renderTemplateFromFileFunction · 0.85

Tested by

no test coverage detected