feat(agent-adapters): add diagnostic logging for raw error detection#467
Conversation
|
The actual new change here — a But the branch can't be reviewed as-is. It shares the same 12 contaminating commits as #466 (copies of #462/#463/#464, three Could you rebase onto fresh Minor nit once rebased: consider downgrading |
|
will do. thanks |
Add console.warn logging when agent adapters detect raw text errors (authentication failures, API key issues, etc.) in non-JSON output. This improves debuggability by surfacing the actual error message in worker logs, making it easier to diagnose configuration issues like invalid/corrupted API keys. Affected adapters: Gemini, Codex, Copilot, OpenCode, OpenClaw Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
13bdf45 to
c772eea
Compare
…onwiggins#467) Add console.warn logging when agent adapters detect raw text errors (authentication failures, API key issues, etc.) in non-JSON output. This improves debuggability by surfacing the actual error message in worker logs, making it easier to diagnose configuration issues like invalid/corrupted API keys. Affected adapters: Gemini, Codex, Copilot, OpenCode, OpenClaw Co-authored-by: Ramesh Nethi <r.nethi@gogatewayai.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary
Add
console.warnlogging when agent adapters detect raw text errors (authentication failures, API key issues, etc.) in non-JSON output. This improves debuggability by surfacing the actual error message in worker logs.Motivation
During debugging of a Gemini agent failure, we discovered the actual error message "API key not valid" was being detected and stored but never logged. The root cause turned out to be a duplicated/corrupted API key in the secrets store. With this change, such errors are immediately visible in the worker logs, making diagnosis much faster.
Changes
Added diagnostic
console.warnlogging in the error detection path for all agent adapters that parse raw text errors:The logs use a consistent format:
[adapter-name] Raw error: <error message>Only triggered when
isRawTextError()detects an authentication/API key/config error patternTesting
Example
Before this change, a corrupted GEMINI_API_KEY would result in:
After this change, worker logs show:
This makes it immediately clear that the issue is with the API key itself, not network/quota/other issues.
Note on Test Failures
The CI shows 2 failing tests in
apps/api(server.test.tsandopenapi.test.ts). These are pre-existing failures on main branch (unrelated to this PR) - verified by running tests on main which shows the same 2 failures.