Summary
When a background stream errors while the user is on a different session, the failure is never shown. Returning to that session displays a chat that simply stopped, with no indication the background response failed.
Root cause
checkBackgroundStream(sessionId) (static/js/chat.js) begins by calling _purgeStaleBackgroundStreams(), which deletes every completed/error entry from _backgroundStreams — including the current session's. The has(sessionId) guard on the next line then early-returns, so the error branch that appends "[Background stream encountered an error]" to #chat-history is now unreachable dead code.
The error branch is original behavior (commit e5c99a5e, "Odysseus v1.0"). It was killed by fork commits: 67268d2b added the _purgeStaleBackgroundStreams primitive, and 1e8a217a placed a call to it at the top of checkBackgroundStream. Upstream has no purge, so this is a fork-introduced regression.
The error entry is intentionally left in the map by the catch handler (bgErr.status = 'error', not deleted) precisely so checkBackgroundStream can surface it later — the top-of-function purge defeats that.
Fix
Exclude the current sessionId from the purge: _purgeStaleBackgroundStreams(exceptSid) skips that entry, so other sessions' finished streams are still cleaned up while the current session's error/completed entry survives for its own branch to handle.
Classification
Fork-only regression (the purge exists only on the fork). Fix on develop.
Summary
When a background stream errors while the user is on a different session, the failure is never shown. Returning to that session displays a chat that simply stopped, with no indication the background response failed.
Root cause
checkBackgroundStream(sessionId)(static/js/chat.js) begins by calling_purgeStaleBackgroundStreams(), which deletes everycompleted/errorentry from_backgroundStreams— including the current session's. Thehas(sessionId)guard on the next line then early-returns, so theerrorbranch that appends "[Background stream encountered an error]" to#chat-historyis now unreachable dead code.The error branch is original behavior (commit
e5c99a5e, "Odysseus v1.0"). It was killed by fork commits:67268d2badded the_purgeStaleBackgroundStreamsprimitive, and1e8a217aplaced a call to it at the top ofcheckBackgroundStream. Upstream has no purge, so this is a fork-introduced regression.The error entry is intentionally left in the map by the catch handler (
bgErr.status = 'error', not deleted) precisely socheckBackgroundStreamcan surface it later — the top-of-function purge defeats that.Fix
Exclude the current
sessionIdfrom the purge:_purgeStaleBackgroundStreams(exceptSid)skips that entry, so other sessions' finished streams are still cleaned up while the current session'serror/completedentry survives for its own branch to handle.Classification
Fork-only regression (the purge exists only on the fork). Fix on develop.