Skip to content

fix(tui): clear question edit state on tab change#28655

Open
MingyooLee wants to merge 1 commit into
anomalyco:devfrom
MingyooLee:fix/tui-question-confirm-editing
Open

fix(tui): clear question edit state on tab change#28655
MingyooLee wants to merge 1 commit into
anomalyco:devfrom
MingyooLee:fix/tui-question-confirm-editing

Conversation

@MingyooLee
Copy link
Copy Markdown

@MingyooLee MingyooLee commented May 21, 2026

Issue for this PR

Fixes #27302
Related to #27875

This PR addresses the narrowed TUI interactive Q&A reproduction described in #27302 (comment), where stale custom-answer edit state can leave the final Confirm tab unable to submit.

This PR is separate from the Web/Desktop permission prompt PR #28651 and does not address TUI permission mouse interaction support such as #7966.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

In the TUI multi-step question prompt, opening the custom-answer editor can leave store.editing set to true. If the user then moves to another tab, especially the final Confirm tab, the prompt can become stuck:

  • edit bindings are disabled because confirm() is true
  • normal/confirm bindings are disabled because store.editing is still true
  • the Confirm screen is visible, but Enter submit does not run

This PR clears the custom-answer editing state whenever the question prompt moves to a different tab. Reselecting the same tab preserves the current editing state, so the fix only affects actual tab changes.

A small unit test covers both cases:

  • moving to another tab clears stale editing state
  • reselecting the current tab keeps editing state

Relationship to related PRs

How did you verify your code works?

From packages/opencode:

  • bun test test/cli/cmd/tui/question-prompt.test.ts — 2 pass
  • bun typecheck
  • bunx oxlint packages/opencode/src/cli/cmd/tui/routes/session/question.tsx packages/opencode/test/cli/cmd/tui/question-prompt.test.ts — 0 warnings, 0 errors
  • bun test test/cli/run/question.shared.test.ts — 5 pass
  • bun test test/question/question.test.ts — 14 pass
  • bun test test/tool/question.test.ts — 2 pass
  • pre-push hook: bun turbo typecheck

Screenshots / recordings

No visual change. This is a TUI keybinding-state fix for the existing question prompt.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Clear stale custom-answer editing state when the TUI question prompt moves to another tab so the Confirm tab can register submit bindings.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warp mode + interactive Q&A: all input captured (mouse clicks, Enter, Ctrl+C) — user must force-close terminal

1 participant