nextlevelbuilder / nextlevelbuilder/goclaw
Empty LLM Response Retry at Pipeline Level
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 1.1k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 24
Description
Problem Statement
When a provider returns empty content (resp.Content == "") with no tool calls and finish_reason: "stop", the pipeline treats it as a valid
final answer. The finalize stage substitutes "..." as a placeholder — user sees literal dots with no explanation. This is a silent failure
that degrades trust.
Root Cause Chain
Provider returns empty/malformed response
→ ThinkStage: resp.ToolCalls == 0 → BreakLoop (treats as final answer)
→ ObserveStage: FinalContent = "" (empty)
→ FinalizeStage: FinalContent == "" → "..." fallback
→ User sees "..."
Proposed Approach: Pipeline-Level Silent Retry
Core idea: Detect "empty response" as a distinct failure class in ThinkStage (like truncation is today), retry up to 2 times with a system
hint, and only fall through to a user-friendly error message if all retries fail.
Detection Criteria (all must be true)
An LLM response is classified as "empty" when:
- resp.Usage == nil or resp.Usage.TotalTokens == 0
- len(resp.ToolCalls) == 0 (no actions)
- resp.Thinking == "" (no reasoning output)
- NOT a deliberate NO_REPLY (that's a valid empty response for group chats — but NO_REPLY is detected by content matching, so empty string
won't match)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the ThinkStage, ObserveStage, and FinalizeStage flow described in the issue, then inspect how truncation retries and NO_REPLY detection are handled. Add empty-response detection and bounded retries with a system hint, and verify that repeated empty responses produce a user-friendly error instead of the "..." fallback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- ai, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100