mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
fix(web-shell): stop surfacing SSE backpressure warning in transcript (#11340)
The daemon's slow_client_warning frame reports this SSE subscriber's event queue backing up — a transport diagnostic, not a user-facing failure. Rendering it as a chat status read as a broken connection mid-turn and sent users refreshing or abandoning sessions during normal tool execution. Log the queue watermarks to the console instead; client_evicted remains the real disconnect signal and keeps its own error path. Co-authored-by: 钉萁 <[email protected]>
This commit is contained in:
1 parent
272de8ace6
commit
7dedcbfd71
2 files changed
+28
-15
No files matched your search
@@ -190,13 +190,17 @@ export function normalizeDaemonEvent(
|
||||
},
|
||||
];
|
||||
case 'slow_client_warning':
|
||||
return [
|
||||
{
|
||||
...base,
|
||||
type: 'status',
|
||||
text: 'SSE stream is lagging',
|
||||
},
|
||||
];
|
||||
// The daemon reports this SSE subscriber's queue backing up — a
|
||||
// transport diagnostic, not a user-facing failure. Surfacing it as a
|
||||
// transcript status reads as a broken connection mid-turn, so log the
|
||||
// queue watermarks to the console instead; `client_evicted` remains the
|
||||
// real disconnect signal and flows through its own error path. Fires at
|
||||
// most once per overflow episode (daemon-side hysteresis).
|
||||
if (typeof console !== 'undefined') {
|
||||
// eslint-disable-next-line no-console -- intentional diagnostic for subscriber backpressure
|
||||
console.warn?.('[daemon-ui] SSE stream is lagging', event.data);
|
||||
}
|
||||
return [];
|
||||
case 'stream_error': {
|
||||
const errorKind = asDaemonErrorKind(getString(event.data, 'errorKind'));
|
||||
return [
|
||||
|
||||
@@ -2436,14 +2436,23 @@ describe('daemon UI normalizer and transcript reducer', () => {
|
||||
data: { reason: 'slow' },
|
||||
}),
|
||||
).toMatchObject([{ type: 'error', recoverable: true, text: 'slow' }]);
|
||||
expect(
|
||||
normalizeDaemonEvent({
|
||||
id: 54,
|
||||
v: 1,
|
||||
type: 'slow_client_warning',
|
||||
data: {},
|
||||
}),
|
||||
).toMatchObject([{ type: 'status', text: 'SSE stream is lagging' }]);
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
||||
try {
|
||||
expect(
|
||||
normalizeDaemonEvent({
|
||||
id: 54,
|
||||
v: 1,
|
||||
type: 'slow_client_warning',
|
||||
data: { queueSize: 200, maxQueued: 256 },
|
||||
}),
|
||||
).toEqual([]);
|
||||
expect(warn).toHaveBeenCalledWith('[daemon-ui] SSE stream is lagging', {
|
||||
queueSize: 200,
|
||||
maxQueued: 256,
|
||||
});
|
||||
} finally {
|
||||
warn.mockRestore();
|
||||
}
|
||||
expect(
|
||||
normalizeDaemonEvent({
|
||||
id: 55,
|
||||
|
||||
Reference in new issue
Block a user