Repository navigation
fix(backend): use accumulated responseBody for provider payload to avoid stale dashboard log viewer data (#9315) - #9405
Conversation
…oid stale dashboard log viewer data (#9315)
|
Thanks for the fix! We hit the same root cause independently while live-testing #9439 and already closed it there (commit #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. |
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: