Files
gitmost/apps
agent_coder 1e8039e029 fix(#234 review r2): close the turn-2+ Stop-latch flash + first-turn deferred stop (F4/F5/F6)
F4: the round-1 !localStreaming gate was insufficient — the PREVIOUS turn's terminal
run stays cached under AI_CHAT_RUN_RQ_KEY(chatId) and cleared the latch early on turn
2+. handleServerStop now removeQueries that key so  is null until the current
turn's run is fetched fresh; the terminal effect's  holds the latch
until the current run is observed terminal. Safety net: if that refetch ERRORS while
no longer streaming, release the latch so the view can't freeze on a transient failure.
F5: first-turn Stop (before the start chunk adopts the chat id) latches a pending stop
(stopPendingRef) fired by the onServerChatId adoption effect, so a detached run is
authoritatively stopped instead of left running by a silent local-only abort. Known
abort-ordering sub-window documented.
F6: extract the latch-clear decision to a pure, unit-tested shouldClearStoppingLatch
(run-polling.ts) — clears only when stopping, not the streamer, and the current run is
terminal; tests are non-vacuous against the round-3/4 buggy behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 23:38:15 +03:00
..