Persist and broadcast interactive poll/plan resolution#156
Open
GrigoryPervakov wants to merge 1 commit into
Open
Persist and broadcast interactive poll/plan resolution#156GrigoryPervakov wants to merge 1 commit into
GrigoryPervakov wants to merge 1 commit into
Conversation
Reloading a session re-rendered an already-answered AskUserQuestion poll as a fresh interactive form, and clicking it posted a stray chat message. The resolved state was never broadcast either, so parallel clients and mid-turn reconnects kept soliciting an already-given answer. Backend: - broadcast an interaction_resolved event when an interaction settles (answer/deny/timeout/cancel), buffered for reconnect replay Frontend: - QuestionBlock renders read-only from the persisted tool_result, re-highlights the chosen options, and drops the sendMessage fallback that posted answers as new chat messages - both poll and plan blocks lock once a seen prompt clears (parallel client / pre-reconnect-replay window) - clear pendingInteraction on interaction_resolved and skip re-restoring a resolved interaction during reconnect buffer replay - show "Closed" instead of "Answered" when an interaction ends without an answer Adds a test for the resolution broadcast. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
AskUserQuestionpolls andExitPlanMode/EnterPlanModeapprovals now persist their resolved state: reloading a session renders them read-only instead of re-prompting, and clicking a resolved poll no longer posts a stray chat message.interaction_resolvedevent (buffered for reconnect replay) when an interaction settles, so parallel clients and mid-turn reconnects clear the pending prompt instead of soliciting an already-given answer.tool_result; an interaction that ends without an answer (timeout / cancel / deny) renders "Closed".Why
AskUserQuestion/plan tools pause the agent mid-turn while the web UI collects an answer. The answered state lived only in ephemeral React state and was never broadcast, so (a) a reload re-rendered the poll as a blank interactive form whose click posted the answer as a brand-new message, and (b) other connected clients / a post-reconnect client kept showing the live prompt.Test plan
pytest tests/test_interactive.pygreen;npm run buildclean🤖 Generated with Claude Code