Ask flow fails with two distinct issues on OpenAI-compatible / Anthropic-compatible providers: hanging SSE streams and invalid tool-call arguments
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- typescript
Rechercherichtung
Start by reproducing the Ask workflow with the documented OpenAI-compatible and Anthropic-compatible provider modes, focusing on the streaming consumer and tool-call handling paths. Compare the captured SSE termination and malformed arguments with Sourcebot's diagnostics, title-generation requests, and conversation state; done means the failure boundaries and any existing safeguards are clearly identified.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
We investigated repeated Ask failures in Sourcebot and captured the real upstream model traffic with a transparent proxy. We found two separate failure modes:
-
Streaming/network failure
Some model requests return200 OKwithtext/event-stream, start streaming, but never terminate correctly. Eventually the client fails with:TypeError: terminatedTLSSocket.onHttpSocketCloseread ETIMEDOUT
-
Tool-call argument failure
In OpenAI-compatible mode, the model sometimes emits invalid function arguments JSON for tool calls, which leads to:invalid function arguments json string- upstream
400 Bad Request
These are not the same failure.
Environment
- Sourcebot: current Docker image as of 2026-04-10
- Runtime: Node 24 inside container
- Deployment: local Docker on WSL2
- Provider modes tested:
openai-compatibleanthropic
What we ruled out
We ruled out the following as the primary root cause:
- WSL general outbound connectivity
- Docker general outbound connectivity
- basic long-lived
fetch/undiciSSE streaming in both host and container - host proxy env leakage into the Sourcebot container
Using the same sourcebot container and Node fetch/undici, an independent long streaming request to the same model endpoint completed successfully:
- host:
49 chunks,23594 bytes,38.4s - container:
52 chunks,25029 bytes,43.6s
This narrowed the failures to Sourcebot's real Ask workflow rather than general WSL/Docker outbound connectivity.
Failure mode 1: hanging SSE stream
Symptom
Frontend remains stuck in generating, and backend eventually reports:
TypeError: terminatedTLSSocket.onHttpSocketClose
Captured behavior
For some Ask requests, upstream responds with:
200 OKcontent-type: text/event-stream
But the stream never ends normally. Our proxy later records:
message: "terminated"cause_code: "ETIMEDOUT"cause_message: "read ETIMEDOUT"
This happened in both Anthropic-compatible and OpenAI-compatible runs.
Example evidence
OpenAI-compatible sample:
- request body size about
45 KB - stream starts successfully
- then hangs until timeout
Anthropic-compatible sample:
- request to
/anthropic/v1/messages stream=truethinking.enabledtool_choice={"type":"auto"}tools_count=8- stream starts, then never cleanly finishes
See sanitized evidence: https://gist.github.com/leozhengliu-pixel/6252d9b8415ab65dd106d11e2bf59da0
Failure mode 2: invalid tool-call arguments
Symptom
Frontend error:
Failed after 2 attempts with non-retryable error: 'invalid params, invalid function arguments json string ...'
Captured behavior
In an OpenAI-compatible request, the assistant produced this tool call:
{
"id": "call_function_j32rtdm8f446_1",
"type": "function",
"function": {
"name": "read_file",
"arguments": "\"{\""
}
}
The arguments field is not a JSON object string like:
{"path":"...","repo":"..."}
It is just a malformed string literal.
The same request also contains the tool error returned into conversation state:
{
"role": "tool",
"tool_call_id": "call_function_j32rtdm8f446_1",
"content": "Invalid input for tool read_file: JSON parsing failed: Text: {.\nError message: Expected property name or '}' in JSON at position 1 (line 1 column 2)"
}
That request ultimately receives 400 Bad Request.
Why I believe this is relevant to Sourcebot
Even if some instability may be provider-side, Sourcebot is the shared client here, and these failures happen specifically under Sourcebot Ask orchestration:
- tool-rich multi-step interaction
- title-generation subrequests
- conversation accumulation
- streaming consumer path
At minimum, it would help if Sourcebot:
- handled hanging SSE streams more defensively
- surfaced raw upstream request/response diagnostics more clearly
- isolated title-generation failure from main answer flow
- degraded more safely on malformed tool arguments
Requested guidance
Please help clarify:
- Is this a known limitation of Ask with OpenAI-compatible / Anthropic-compatible providers?
- Are there recommended settings to disable or simplify:
- title generation
- thinking
- tool streaming
- multi-step Ask behavior
- Is there an existing safeguard for malformed
tool_calls[].function.arguments? - Is there a supported way to capture Sourcebot's exact model payloads without patching Sourcebot?
I can provide more sanitized payloads if useful.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.9k
- Forks
- 374
- Ø Merge
- 17 Std. 15 Min.
- Gemergte PRs (30 T.)
- 38
Entwicklungsumgebung
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus sourcebot-dev/sourcebot
-
bug(web): Intermediate directory nodes in buildFileTree receive child leaf paths instead of directory pathsEvtl. vergeben @riteshvish02 hat das vor 3 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
sourcebot-dev/sourcebot#1707 ·
Maintainer antworten meist innerhalb von 1 Tag
-
fix(web): multiline highlight ranges are broken / omitted in LightweightCodeHighlighterEvtl. vergeben @riteshvish02 hat das vor 6 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
sourcebot-dev/sourcebot#1698 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[bug] Search result hydration performs duplicate repository lookups within the same chunkEvtl. vergeben @dipeshbabu hat das vor 12 Tagen übernommen. Offenbug triage needed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
sourcebot-dev/sourcebot#1681 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Linux ctags build instructions in CONTRIBUTING.md are missing build dependenciesEvtl. vergeben @The-AarushiSingh hat das vor 18 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
sourcebot-dev/sourcebot#1633 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Generic Git URL configs keep percent-encoded repo namesEvtl. vergeben @Tyagiquamar hat das vor 18 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
sourcebot-dev/sourcebot#1384 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in sourcebot-dev/sourcebot
Ähnliche Issues
-
bot:ai-assisted status:untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
midnightntwrk/midnight-js#1424 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
mksglu/context-mode#1268 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
[bug] Setup fails with "Cannot find matching keyid" when an older Node's corepack is on PATHEvtl. vergeben @EyalPoly hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
MystenLabs/MemWal#1124 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Edit:Offencheck:failed streams:edit
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 60/100
iptv-org/iptv#54352 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag