Skip to content

Commit 2443db6

Browse files
author
nesquena-hermes
committed
Merge PR nesquena#3071
# Conflicts: # CHANGELOG.md
2 parents d446a6c + 0f26b99 commit 2443db6

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
- Title-language detection no longer treats common English tech/jargon text such as "session die" or DAS/DER references as German just because of shared tokens. (Refs #3040)
1414

15+
- Clarify prompt SSE fallback polling now preserves its owner session id, matching approval polling behavior so terminal events from another session cannot stop the active clarify fallback poller.
16+
1517
## [v0.51.152] — 2026-05-28 — Release DX (stage-batch34 — single-PR optional gateway-backed browser chat)
1618

1719
### Added

static/messages.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3147,7 +3147,8 @@ function startClarifyPolling(sid) {
31473147
});
31483148

31493149
_clarifyEventSource.onerror = function() {
3150-
stopClarifyPolling();
3150+
if (_clarifyEventSource) { try { _clarifyEventSource.close(); } catch(_){} _clarifyEventSource = null; }
3151+
if (_clarifyHealthTimer) { clearInterval(_clarifyHealthTimer); _clarifyHealthTimer = null; }
31513152
_startClarifyFallbackPoll(sid);
31523153
};
31533154

@@ -3177,6 +3178,7 @@ function startClarifyPolling(sid) {
31773178
}
31783179

31793180
function _startClarifyFallbackPoll(sid) {
3181+
_clarifyPollingSessionId = sid || null;
31803182
_clarifyFallbackTimer = setInterval(async () => {
31813183
if (!S.session || S.session.session_id !== sid) {
31823184
stopClarifyPolling(); _hideClarifyCardIfOwner(sid, true, 'session'); return;

tests/test_session_runtime_ownership_invariants.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,21 @@ def test_approval_and_clarify_pollers_are_stopped_by_owner_session(self):
117117
"the active pane currently owns."
118118
)
119119

120+
def test_clarify_sse_fallback_preserves_owner_session_id(self):
121+
messages = read("static/messages.js")
122+
start_clarify = _function_body(messages, "startClarifyPolling")
123+
fallback = _function_body(messages, "_startClarifyFallbackPoll")
124+
125+
assert "_clarifyPollingSessionId = sid || null" in fallback, (
126+
"Any clarify fallback poller should retain its owner session id."
127+
)
128+
onerror_idx = start_clarify.index("_clarifyEventSource.onerror")
129+
onerror_body = start_clarify[onerror_idx:start_clarify.index("};", onerror_idx)]
130+
assert "stopClarifyPolling();" not in onerror_body, (
131+
"SSE fallback must not clear _clarifyPollingSessionId before starting the fallback poller."
132+
)
133+
assert "_startClarifyFallbackPoll(sid)" in onerror_body
134+
120135
def test_live_stream_transport_and_inflight_state_remain_session_keyed(self):
121136
messages = read("static/messages.js")
122137
close_live = _function_body(messages, "closeLiveStream")

0 commit comments

Comments
 (0)