Skip to content

fix(tui): prevent session picker crash - #36774

Closed
opencode-agent[bot] wants to merge 1 commit into
v2from
session-picker-crash
Closed

fix(tui): prevent session picker crash#36774
opencode-agent[bot] wants to merge 1 commit into
v2from
session-picker-crash

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Closes#36747
Closes#36773
Supersedes #36754

Cause

#36711 made dialog action availability depend on the selected option. Footer focus still translated each rendered action back through actionItems().indexOf(item), re-entering that selection-dependent memo while the session picker registered its actions and exposing an uncomputed value.

Fix

  • Track focused footer actions by stable command name instead of positional index.
  • Initialize the option/selection graph before registering action bindings that can evaluate selection-dependent availability.
  • Clear focus when the command becomes unavailable rather than transferring it to a different action at the same index.
  • Add regression coverage for a focused action becoming disabled.

Verification

  • bun test --timeout 30000 --only-failures from packages/tui (220 pass, 1 skip)
  • bun typecheck from packages/tui
  • bun x prettier --check packages/tui/src/ui/dialog-select.tsx packages/tui/test/cli/tui/dialog-select.test.tsx
  • OpenCode Drive: while a model response is streaming, /sessions opens the Sessions dialog without hitting the error boundary

Track footer focus by stable command and initialize option state before action bindings can evaluate selection-dependent availability.
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

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:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@rekram1-node