Repository navigation
fix(tui): reconcile pending prompts with the live server - #44342
sahiljagtap08 wants to merge 1 commit into
Conversation
Sound design — treating the server's pending-prompt list as the source of truth at bootstrap (with a comment explaining why: process-local state orphaned by restarts) plus a verify-then-dismiss path on settlement failure covers both halves of the stale-prompt problem. I verified the risky bits hold together: Two suggestions:
Test coverage is genuinely good here — hydrate/drop-on-rebootstrap and double-dismiss are exactly the cases worth pinning ( |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #36585
Type of change
What does this PR do?
Pending questions and permissions live in a process local map on the server, so a managed service restart destroys them. The TUI only learns about pending prompts through live events, so after a restart it keeps rendering a form the replacement server has never heard of. Submitting fails with a not found error that was silently ignored, leaving a form that can never be answered.
Two changes:
GET /questionandGET /permission) and replaces the event fed state. Prompts that survived appear, prompts the server no longer knows are dropped.The durable fix for keeping prompts alive across restarts is tracked in #36347. This is the client side escape hatch so users are never stuck looking at an unanswerable form.
How did you verify your code works?
Added TUI tests: one mounts with pending prompts served by the mock and asserts they hydrate, then simulates a restart by emptying the server lists and re-running bootstrap and asserts the stale entries are dropped. Another covers dismissal of an event fed question.
bun test test/cli/cmd/tui/in packages/tui: 25 pass. Typecheck and oxlint are clean.Screenshots / recordings
The change removes a stuck form after a service restart. No visual change in the normal flow.
Checklist