Skip to content

fix(backend): use accumulated responseBody for provider payload to avoid stale dashboard log viewer data (#9315) - #9405

Merged
diegosouzapw merged 3 commits into
release/v3.8.50from
fix/9315-dashboard-log-viewer-shows-s
Aug 7, 2026
Merged

diegosouzapw merged 3 commits into
release/v3.8.50from
fix/9315-dashboard-log-viewer-shows-s

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Closes #9315

Root cause: In stream.ts, the providerPayload for the dashboard log was built via buildStreamSummaryFromEvents(providerPayloadCollector.getEvents(), ...), which reconstructs the response from raw captured SSE events. The StructuredSSECollector is head-retaining/tail-dropping with default caps (maxEvents=200/maxBytes=48KB). Once those caps are exceeded, every subsequent event is silently dropped. For reasoning + tool-calling models, a stream easily exceeds these caps, so the "Provider Response" panel in the dashboard was built from only the early chunks — missing final content, reasoning_content, tool_calls, and the real finish_reason.

Fix: Use the same accumulated responseBody for providerPayload that the clientPayload already uses — pass responseBody directly to providerPayloadCollector.build() instead of buildStreamSummaryFromEvents(providerPayloadCollector.getEvents(), ...). This matches the client path and ensures the dashboard shows correct data regardless of stream length.

Two sites changed in stream.ts:

  1. Passthrough flush onComplete (line ~2510)
  2. Translate flush onComplete (line ~2785)

@hartmark

hartmark commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for the fix! We hit the same root cause independently while live-testing #9439 and already closed it there (commit 52671130a) with a slightly broader version: streamPayloadCollector.ts's per-format summary builders were turned into incremental reducers that ingest every chunk as it streams (collector.getSummary()), applied at all 3 onComplete call sites in stream.ts — including the mid-stream failure/error path (~line 2611), which still uses the old buildStreamSummaryFromEvents(getEvents(), ...) reconstruction here and would still show a truncated/stale Provider Response panel for a response that reasons/tool-calls and then errors out mid-stream.

#9315 will close via #9439 instead, so no action needed here — leaving this open for you to close since it's your PR, not mine to close.

@diegosouzapw
diegosouzapw merged commit a651ffa into release/v3.8.50 Aug 7, 2026
9 of 10 checks passed
@diegosouzapw
diegosouzapw deleted the fix/9315-dashboard-log-viewer-shows-s branch August 8, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(backend): dashboard log viewer shows stale provider response for long streamed responses

2 participants