Vendor lane tools: response body parsed before status; CrossVendorAudit keeps the codex stderr banner instead of the error
Thanks for these tools. They carry every cross-vendor lane here, and I know how fast the project moves. Two small error-path issues turned up while we added retry and credit-stop handling locally. Both are still present on main as of 2026-11-11.
1. Body parsed before status. LIFEOS/TOOLS/GeminiSearch.ts:132, GrokQuery.ts:131 and PerplexitySearch.ts:119 all do const data = await res.json() and only then test res.ok. When a vendor or a proxy returns a non-JSON error page (a 502/503 HTML page, a gateway timeout, some 429s), res.json() throws a SyntaxError and the real HTTP status and body are lost. The caller sees "Unexpected token <", not "503" or "quota exceeded", so it can't tell a transient failure from an exhausted balance.
Suggested fix: read await res.text() first, keep res.status, then JSON.parse inside a try; on failure, throw with both the status and the first part of the raw body.
2. CrossVendorAudit records the head of codex stderr. CrossVendorAudit.ts:376 and :963 store stderr.slice(0, 200) as the skip reason. The head of codex exec stderr is its banner (version, workdir, model), so the actual error, e.g. ERROR: Quota exceeded, falls outside the first 200 characters and never reaches the findings log.
Suggested fix: stderr.slice(-300).trim(), or the last non-empty lines.
A note for #2731 (Perplexity endpoint), not a separate bug. The migration table's mapping sonar → effort: "fast" is served by another vendor's model: the /v1/agent response's model field read openai/gpt-6-luna on our run. Sending model: "perplexity/sonar" instead keeps Perplexity's own model, at $0.25/$2.50 per million tokens on their pricing page. Worth deciding on purpose, since a Perplexity lane that answers with an OpenAI model is no longer a separate vendor's view.
Our local bridge does all of this plus credit/transient classification that is more opinionated than upstream may want, so I'm only reporting these. Happy to test a change.
[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler
Thanks @christauff, you found that the vendor lane tools parsed the response body before checking the status. GeminiSearch, GrokQuery and PerplexitySearch now read the body as text first and, if it is not JSON, fail with 'HTTP LIFEOS/TOOLS/GeminiSearch.ts. It ships in the next public release after 8.761.0, but the CrossVendorAudit stderr half is still open, so this issue stays open.
[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler
You were right that the audit tool kept the start of the codex error output, which is only the banner, so the real error never reached the findings log. It now keeps the last 300 characters, where the error is, and a test covers it. The first half (the body was read before the status was checked) had already been fixed. The Perplexity model note is tracked separately under #2731.
This fix lands in the next LifeOS release, so I'm closing this now.