fix(desktop): replay pending approvals after reconnect - #82087
Closed
konsisumer wants to merge 1 commit into
Closed
Conversation
teknium1
added a commit
that referenced
this pull request
Aug 15, 2026
Clarify prompts share the same emitted-while-detached failure class the pending-approval replay fixed: `clarify.request` rides `_block()`'s pending registry, so a client whose transport was down when the event fired never sees the question and the agent thread stays parked until timeout. Widen the resume snapshot the same way: - tui_gateway/server.py: `_live_session_payload` now carries `pending_clarify` — a read-only snapshot of the clarify prompt still blocking the session, scoped to the owning runtime sid. The registry stays authoritative; the embedded request_id resolves via clarify.respond. - Desktop resume paths (`use-session-actions`) restore the parked clarify into the clarify store (multi_select preserved) and flag needsInput, mirroring restorePendingApproval on both the activate and resume paths. - pending_approval replay now also forwards the queue-injected request_id so the restored prompt responds with exact-request correlation. - Tests: server-side replay + scoping test; harmonized the #82087 replay test with the request_id `_ApprovalEntry` now injects.
Contributor
Author
|
Closing — this change already landed on the default branch (commit 38b9005); deferring to that. If that's incorrect, feel free to reopen. |
Contributor
|
Thank you for this fix! It was salvaged into #86596 (cherry-picked onto current main with your authorship preserved in the commit history) and is now merged. Closing this PR since the work has landed. |
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.
What changed and why
Per the reporter's clarification on 2026-08-05, a Desktop approval can remain queued after its original WebSocket delivery is lost.
session.resumeandsession.activatenow return the oldest unresolved approval using the existing session-scoped approval queue. Desktop restores that prompt only after its runtime session is bound, so the existing approval controls can respond normally without re-running the tool or extending the timeout.Addressing maintainer feedback
How to test
pytest tests/tui_gateway/test_protocol.py -q -x --timeout=60(43 passed).pytest tests/tools/test_approval.py::TestApprovalTimeoutIsNotConsent -q -x --timeout=60(4 passed).tests/tools/test_approval.py::TestDetectDangerousRm::test_nonrecursive_verification_artifact_cleanup_is_not_dangerousassertion.What platforms tested on
apps/desktop/node_modulesis unavailable in this worker environment; no manual Desktop run was performed.Refs #53839