fix(app): restore composer focus on session tab changes by opencode-agent[bot] · Pull Request #47529 · anomalyco/opencode · GitHub
Skip to content

fix(app): restore composer focus on session tab changes - #47529

Open
opencode-agent[bot] wants to merge 1 commit into
v2from
cmd-tab-focus
Open

fix(app): restore composer focus on session tab changes#47529
opencode-agent[bot] wants to merge 1 commit into
v2from
cmd-tab-focus

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #47514

Type of change

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

What does this PR do?

The active-session composer is recreated when selecting a session tab, but unlike the new-session composer it never restored focus. Restore focus once the destination draft is ready, using the existing saved-caret behavior. Skip blocked/read-only composers and active dialogs; request dismissal and cursor edits do not retrigger autofocus.

How did you verify your code works?

  • Reproduced the original failure: the destination prompt was editable but unfocused after the numbered shortcut.
  • Four regression cases cover Command and Control mappings, horizontal/vertical tabs, empty and long drafts, start/end caret restoration, repeated switches, and an 800px window. Command mapping is emulated in Linux Chromium, not a native macOS run.
  • Existing request-dock tests pass; 90 composer unit tests pass.
  • App and E2E typechecks, scoped Oxlint, Prettier, and git diff --check pass.
  • The broader browser run passed 8/9 tests. The existing command-registration.spec.ts file-opening test also fails on the unchanged base (4/10 serial runs, including the same missing file-tab assertion), so that failure is outside this patch.
  • Production benchmark baseline recorded before the change: 79/100 runs completed; 21 timed out. The warm/review-closed comparison completed 20/20 before and 16/20 after; the four after failures occur during initial fixture readiness, before the measured switch. Among completed runs, first-correct median/p95 changed from 61.95/76.40ms to 80.00/196.90ms; stable median/p95 changed from 145.10/162.80ms to 196.40/449.40ms.
  • A fresh unchanged-base comparison completed 18/20, reproducing initial markdown-readiness failures; its first-correct median/p95 was 66.35/88.40ms and stable median/p95 was 151.10/221.10ms. Fixture failures therefore also exist without this patch, but completed after-change timings remain higher. Performance parity is not established; these runs do not isolate the latency difference's cause. All benchmark runs were serial production builds with no retries.

Base: 7a4ad68af6577c5448a8395b0b95e24ceb623faf; tested head: 71ff13133df3a0fa348972f17cbaace79b966a47.

Screenshots / recordings

Real-app narrow-window screenshot (team Slack). Playwright also attaches refocused-composer screenshots to each regression result. Native GitHub attachment upload was unavailable because Browser Control timed out before creating a page.

Checklist

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

Requested by: @R44VC0RP (vogel via Slack)

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

Labels

2.0 bug Something isn't working contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant