Repository navigation
fix(ui): an unanswered prompt in one chat no longer blocks every other chat - #5609
Conversation
…r chat A relayed flagship turn parked on a permission prompt or question kept its place on the model, so every other chat sat at "Waiting for the GPU — 1st in line" until someone answered. Relayed waits now step out of the line like in-process ones and come back at the front once the sidecar moves on, and a relayed question counts as "needs you" and is not mistaken for a stall. Turns on a cloud model no longer join the line at all: it protects the one local chat model and its prompt cache, which a cloud turn never touches; the embedder and vision model are leased from the daemon's broker. A turn that rejoins the line counts its wait from the rejoin, not from when it started.
|
Verdict: Approve with suggestions On a desktop install, one chat left on an unanswered Allow/Deny prompt or question no longer blocks every other chat: the waiting chat leaves the line and rejoins at the front once you answer. Turns on a cloud model now skip the line entirely. The logic holds up. The parked sidecar run stays alive, a Stop never retakes the model, and the stream's The one gap is proof on the real surface. This changes what users see in the Agent UI ("Waiting for the GPU", "Needs you"), and the PR's only live check, the desktop repro, is still unticked. Run it before merge and paste the result: chat 1 parked on a shell prompt, a new chat answering right away, then chat 1 finishing after Allow. A screenshot of both chats is best, and the streamed Real-world evidenceN/A: no evidence bundle was produced for this run. The Agent UI desktop repro is still pending, so this verdict rests on static review and the unit tests alone. 🔍 Technical detailsIssues 🟡 No live evidence for a UI-visible change. The test plan's "Live: repeat the repro on a desktop install" box is unchecked, and no route or CLI capture is linked. Unit tests gate the logic, but this bug only existed on the daemon-sidecar relay path. Please attach either the screenshot or the streamed event sequence from a real relayed turn. Checked and fine
Strengths
|
|
Checked live in the Agent UI (desktop-style install, relayed sidecar, Fireworks DeepSeek V4 Flash): a chat waiting on a permission prompt no longer blocks other chats. 🔍 Technical details
Built together with #5538, #5541, #5543 and #5580 (125 relay/title/queue tests pass combined). See the merge note below for the overlap. |
|
Merge note: #5538, #5541 and #5609 all change the relay loop and the relayed question/prompt state in 🔍 Technical detailsResolution tested live and in unit tests (125 relay/title/queue tests pass combined):
|
|
The live check the review asked for is in this comment, posted a minute after the review ran. Chat 2 answered in 2 s while chat 1 waited on its prompt, and Allow then finished chat 1. The test-plan box is now ticked and links to it. No code change was needed. 🔍 Technical details
|
…ase-while-waiting # Conflicts: # tests/unit/test_email_sidecar_relay.py
|
Merged current main (6cbb246) into this branch. I resolved three conflicts and kept both sides each time. The relay and turn-queue tests pass. The one failing test also fails on main. 🔍 Technical details
|
Before: on a desktop install (flagship relayed to the daemon sidecar), one chat left on an unanswered Allow once / Deny prompt blocked every other chat indefinitely. A new chat's "what is 6 times 7?" sat at "Waiting for the GPU — 1st in line" forever, even on a cloud model that never touches the GPU. After: a chat waiting on you steps out of the line, so other chats run, and comes back at the front once you answer. Chats on a cloud model don't queue at all.
Why cloud turns skip the line: the line (#5226) serializes turns on the one local chat model and protects its prompt cache. A cloud turn never touches either. What it runs locally (the RAG embedder, a vision model) is already arbitrated by the daemon broker's lease, and the tool registry has its own lock. Local turns still queue, so "Waiting for the GPU" stays accurate: only local work holds the line.
Test plan
tests/unit/chat/ui/test_turn_slot_reliability.py; all 6 fail onmainand pass here:resumed, and it no longer shows as needing youtest_turn_waiting_on_the_user_lets_other_chats_run) and still passpytest tests/unit/chat -n 4plus the relay suites (test_relay_*,test_email_sidecar_relay,test_sidecar_relay_fidelity,test_daemon_relay): 2375 passed, 11 skipped. One failure,test_issue_841_custom_python_agent_model_id_respected, came from the temporaryGAIA_HOMEthe run used (the test patchesHOME); it passes without itpython util/lint.py --black --isort --flake8 --pylint🔍 Technical details
Root cause:
relay_query(src/gaia/ui/email_sidecar/relay.py, the event loop at ~518 onmain) dispatchedneeds_confirmation/needs_input, then blocked on the sidecar's socket while still holding the turn'sTurnSlot. Only the in-process waits (SSEOutputHandler.confirm_tool_execution/request_user_input_blocking, via_away_from_model) stepped away. Path-access prompts go throughconfirm_tool_execution, so they were already covered.step_away_from_model(). The next sidecar event means the user answered or the wait ended, so it callscome_back_to_model()(acquire(front=True)) before dispatching. Afinal/errorevent ends the turn without queuing, and a Stop or stream end while stepped away never retakes the model. The sidecar run itself stays alive throughout._away_from_modelis split intostep_away_from_model/come_back_to_modelso the relay can use them across loop iterations. Behaviour is unchanged.needs_inputis now tracked (set_relay_question), sowaiting_on()reports"question"(sidebar "Needs you") andawaiting_user_input()keeps the idle timeout from stopping a turn that waits on the user.turn_takes_the_line()resolves the turn's model as_stream_chat_impldoes and classifies it with_turn_location. If it can't classify the model, the turn queues, and the turn's own model resolution reports the error.queue_waited_sused the turn's start time, so a resumed turn showed the whole prompt time as time in line. It now usesTurnSlot.waiting_since, reset on eachacquire.writing_tool_registry,_take_model_load_lock). The new-chat warm-up is skipped for sidecar and cloud turns and never takes the line. With the relay stepping away, a new chat's first turn isn't blocked; the relayed-wait test covers it.agent-ui.mdxguide and SDK page) describe the cloud skip and the rejoin, and drop a stale "non-streamed waits 60 s then 429" claim.