Skip to content

fix(tui): hydrate pending prompts - #38840

Closed
Mickael-Roger wants to merge 3 commits into
anomalyco:devfrom
Mickael-Roger:sync-hydration
Closed

fix(tui): hydrate pending prompts#38840
Mickael-Roger wants to merge 3 commits into
anomalyco:devfrom
Mickael-Roger:sync-hydration

Conversation

@Mickael-Roger

Copy link
Copy Markdown

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 because sync.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.tsx
  • Pre-push bun turbo typecheck
  • Manually reproduced the detached question flow and verified the prompt appears after reattaching.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential duplicate PRs found:

  1. fix(tui): preserve prompts during session hydration #36433 - fix(tui): preserve prompts during session hydration

  2. fix(tui): rehydrate pending permissions & questions on reconnect #36603 - fix(tui): rehydrate pending permissions & questions on reconnect

    • Addresses the same problem: rehydrating pending permissions and questions when reconnecting to a session, which matches the exact scope of fetching pending permissions/questions during session hydration in the current PR

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:

  • Already closed/merged with the issue resolved
  • Still open and truly duplicate
  • Addressing a different aspect that could be complementary

@Mickael-Roger

Copy link
Copy Markdown
Author

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.

@Mickael-Roger

Copy link
Copy Markdown
Author

Closed in favor of #36603 to keep the discussion and implementation in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant