fix(chat): broadcast SSE HITL resume to thread subscribers - #1291
Open
huangcheng wants to merge 1 commit into
Open
huangcheng wants to merge 1 commit into
huangcheng wants to merge 1 commit into
Conversation
Collaborator
|
分诊:问题真实(SSE HITL resume 不 请 rebase,CHANGELOG 改成中文并放到当前 Unreleased。CI 已绿。 |
A HITL pause resolved outside a dashboard page (SSE resume from another client, IM, or API) left the page's approval/ask card visible until a manual reload: turns initiated over WebSocket broadcast their chunks to the thread's subscribers, but the SSE resume path only streamed to the HTTP caller. Mirror the ws_channel contract in iter_dashboard_hitl_resume_sse: while streaming the resumed turn, also push every chunk (plus done/error) to the thread's WebSocket subscribers and keep the hub's turn flag in sync. Delivery failures are logged and never abort the turn, and subscribers keep receiving frames even after the SSE client disconnects. Open pages now see the remote resolution live and dismiss the card without reload. Verified live against a real MiniMax turn: pending ask card on an open page dismissed in place after the pause was answered via the API. Note: committed with SKIP_PRECOMMIT=1 because make is unavailable in this Windows shell; the equivalent gates (ruff check/format, mypy --strict, full pytest) were run manually and are green. Co-authored-by: HUANG Cheng <cheng@duck.com>
cursor
Bot
force-pushed
the
fix/hitl-sse-resume-notify
branch
from
October 4, 2026 08:34
58b851a to
e59641b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A HITL pause resolved outside a dashboard page (SSE resume from another client, IM, or API) left the page's approval/ask card visible until a manual reload.
Root cause: turns initiated over WebSocket broadcast their chunks to the thread's subscribers (
ws_channel→hub.push_to_thread), but the SSE resume path (POST /agents/{agent_id}/chat/hitl/resume) only streamed to the HTTP caller — open pages never learned the pause was resolved elsewhere.Fix
Mirror the
ws_channelcontract initer_dashboard_hitl_resume_sse(src/octop/api/routers/chat/routes.py):done, anderror+doneon failure) to the thread's WebSocket subscribers.mark_turn_active/mark_turn_idle) so historyturn_activestays accurate for SSE resumes too.ws_channel).No frontend change needed: subscribed pages are already driven by WS frames, so the pending card dismisses in place.
Verification
tests/unit/api/test_chat_hitl_resume.py(realWebSocketHub+ fake subscriber):doneare broadcast in order and the turn flag returns to idle;ruff check/format,mypy --strict src/octop, fullpytest -m "not live"— green (committed withSKIP_PRECOMMIT=1becausemakeis unavailable in this Windows shell; the equivalent checks were run manually).ask_user_questioncard on an open page dismissed without reload after the pause was answered out-of-band via the API; the page continued streaming the resumed turn.