fix(tui): hydrate pending prompts - #38840
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate PRs found:
These two PRs appear to be addressing the same or very similar issues as the current PR #38840. You should review them to determine if they are:
|
|
Closing as a duplicate of #36603, which already addresses the same detached/reconnect pending permission and question hydration issue and is linked to #36604. This PR independently reproduced the issue and validated the same resolution, including the stale hydration/live event race, but it should not compete with the existing implementation. |
|
Closed in favor of #36603 to keep the discussion and implementation in one place. |
Summary
When a question or permission request is created while the TUI is detached, the request is retained by the server but its SSE event is missed. Re-entering the session then displays the persisted tool part (for example,
Asked 1 question) without the interactive prompt becausesync.session.sync()did not hydrate pending prompt queues.This fetches pending permissions and questions during session hydration, filters them to the selected session, and preserves live ask/reply/reject events when a stale hydration response arrives. Existing prompts are retained if either list request fails.
Testing
bun test --timeout 30000 test/cli/cmd/tui/sync-live-hydration.test.tsxbun turbo typecheck