* 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)
| 2068 | * @returns {string} Formatted context string, or empty string if no auth errors |
| 2069 | */ |
| 2070 | function 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. |
no test coverage detected