fix(#726): handle broadcast Lagged + clear on SSE reconnect

Distinguish RecvError::Lagged from Closed in the build-log stream
loop: Lagged continues (next recv delivers the full accumulated delta
via saved cursors), Closed returns (shutdown path).

Clear pre.textContent and reset cursor lengths in es.onerror when
readyState is CONNECTING so auto-reconnect doesn't double-append the
replay from cursor=0.
This commit is contained in:
iris 2026-05-31 21:31:57 +02:00 committed by mara
commit 12985ade6d
2 changed files with 9 additions and 2 deletions

View file

@ -1216,7 +1216,13 @@ window.marked = marked;
}
};
es.onerror = () => {
if (es.readyState === EventSource.CLOSED) {
if (es.readyState === EventSource.CONNECTING) {
// Auto-reconnect: clear accumulated content so the
// fresh stream from cursor=0 doesn't double-append.
pre.textContent = '';
stdoutLen = 0;
stderrLen = 0;
} else if (es.readyState === EventSource.CLOSED) {
detail._es = null;
}
};