Repository navigation
ga: diagnose blank LLM responses; tui keeps [Warn]/[Error] labels - #819
Open
louisss1016 wants to merge 1 commit into
Open
louisss1016 wants to merge 1 commit into
louisss1016 wants to merge 1 commit into
Conversation
…define#815) Blank responses (observed with third-party relays returning whitespace-only successful payloads) now emit a redacted one-liner alongside the unchanged 3-attempt retry: kind, content/thinking sizes, response block types, model and gateway host (hostname only, never credentials). The TUI splits _ACTION_RE so [Action]/[Status]/[Info]/[Debug] still collapse to a neutral bullet while [Warn]/[Warning]/[Error] render as `· [Warn]` — severity stays visible. Adds 15 tests via the repo's ast/exec extraction pattern; full suite 287 passed (3 pre-existing Windows-env failures unrelated).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #815.
What
Blank responses — observed with third-party relays that return an HTTP-successful but whitespace-only payload — used to produce a single opaque line with nothing to attribute the failure to. This PR adds a redacted diagnostic and keeps severity visible in the TUI, without touching the retry semantics from #201.
Changes
ga.pydescribe_blank_response()— pure, module-level helper producing a compact one-liner:whitespace_onlyvsempty_payloadclassification,len(content)/len(thinking), deduped+sorted response block types (extracted fromresponse.raw), and, when a backend is reachable,model=andhost=._url_host()— hostname-only extraction (no userinfo, no port, no credentials); returnsunknownfor garbage input instead of raising, since a diagnostic must never crash the retry path.do_no_tool()— retry logic untouched (still 3 attempts, then exit). The warning line now carries the attempt counter and the diagnostic:[Warn] Empty LLM response (1/3); retrying [kind=whitespace_only len(content)=1 len(thinking)=0 blocks=text model=gpt-4o host=api.openai.com]frontends/tui_v3.py_ACTION_REsplit into_ACTION_RE(Action|Status|Info|Debug) +_SEVERITY_RE(Warn|Warning|Error). Non-severity tags still collapse to·, but severity tags now render as· [Warn] …— issue suggestion timeout to any question #3.Tests
frontends/tests/test_blank_response_diagnostics.py— 15 tests following the repo's ast/exec extraction pattern (ga.py/tui_v3.pyhave heavy import side effects): classification, credential redaction (user:s3cret@never appears), host edge cases, regex disjointness, and the exact rendering contract from the issue.Verification
python -m pytest frontends/tests -q→ 287 passed; the 3 failures (test_data_backupsymlink ×2,test_release_qualification) are pre-existing on Windows without developer mode / without a built package — identical before and after this change.f308ee7e: only the 4 hunks above plus the new test file.Scope notes
llmcore.pypath (ConnectionError("empty response")when a stream yields nothing) is already distinguishable from this agent-level guard and is intentionally left as-is.