Skip to content

feat: add bidirectional model, provider, and reasoning cycles - #1247

Merged
ymichael merged 7 commits into
get-bb:mainfrom
smsunarto:feat/model-picker-directional-shortcuts
Aug 13, 2026
Merged

ymichael merged 7 commits into
get-bb:mainfrom
smsunarto:feat/model-picker-directional-shortcuts

Conversation

@smsunarto

@smsunarto smsunarto commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds fast, bidirectional cycling for the active composer's model, provider, and reasoning effort without opening the picker.

Area Forward Backward
Model Alt+M Alt+Shift+M
Provider Alt+P Alt+Shift+P
Reasoning effort Alt+T Alt+Shift+T

All three dimensions wrap in both directions. Reasoning cycles only through the current model's supported efforts in canonical reasoningLevelValues order, so provider response ordering cannot reverse the meaning of forward and backward.

The commands work with the picker open or closed and resolve to the active composer across split panes and portaled picker content. An in-scope cycle chord claims the key even when there is nowhere to rotate, preventing macOS Option-composed characters from landing in the prompt. The same physical-key matching handles Option composition for both the forward and Shift+Option variants. Unrelated editable controls do not yield the chord.

This deliberately avoids Mod+Arrow defaults, which collide with native caret and document navigation in editable controls. Native navigation and deletion keys continue to win through the central editable-control arbitration established for #1397.

The keyboard settings metadata, configuration documentation, plugin SDK declarations, and generated template copy are updated with the final command set.

Validation

  • pnpm exec turbo run typecheck test lint --filter=@bb/app --filter=@bb/server --filter=@bb/domain
    • 8/8 tasks passed
    • app: 340 files, 2,650 tests
    • server: 162 files, 1,465 tests
    • domain: 23 files, 130 tests
    • lint: 0 errors; 149 existing React Compiler warnings
  • Bundled plugin SDK declaration check passed
  • Generated template check passed
  • git diff --check passed

Original implementation by @smsunarto. Their commits and authorship are preserved; the branch was rebased and the review fixes were added by the maintainers.

@smsunarto
smsunarto marked this pull request as ready for review August 10, 2026 07:13
@SawyerHood

SawyerHood commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

🚨 SLOP COP 🚨 · review

I am the SlopCop. I started the review for PR #1247.

I will check security, code quality, architecture, duplicate code, performance, and the end-to-end behavior.

// individual picker level; `editableFocus` would reject Tab-focused buttons
// before those handlers can identify their composer. They only act on a
// closed picker, so they intentionally have no `modelPickerOpen` copies below.
binding("modelPicker.previousModel", "ArrowLeft", { mod: true }, composerWithoutModal),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — These defaults replace native prompt editing keys.

Mod+ArrowLeft/Right moves to a line boundary on macOS. Control+ArrowLeft/Right moves by word on Windows and Linux. The app dispatch runs before the editor handles the key. When multiple models exist, these bindings change the model instead of moving the caret. The browser smoke test reproduced that model change. Please use non-editor defaults or leave these commands unbound by default. Add an editor test that protects native caret movement.

): T | null {
if (options.length < 2) return null;

const currentIndex = options.findIndex((option) => option.value === current);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Direction uses provider list order instead of the canonical reasoning rank.

activeModel.supportedReasoningEfforts keeps the provider response order. This helper then uses the adjacent array item. A valid unsorted response can make Increase select a lower effort, or make Decrease select a higher effort. reasoningLevelValues defines the load-bearing rank. Please traverse supported values by that rank, or sort once at the boundary. Add a test with unsorted options.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

ELI5: This change adds keyboard controls for providers, models, and reasoning levels. The controls work, but two direction rules need correction.

I found two issues:

  1. High: The new Mod+Arrow defaults replace standard prompt editing keys. They can change execution options when a user wants to move the caret.
  2. Medium: Reasoning direction follows provider response order. An unsorted response can make Increase move down or make Decrease move up.

I left an inline comment for each issue.

The security review found no actionable issue. The performance review found no actionable issue.

The architecture scan found no duplicate model or provider cycle implementation. It found one duplicate policy: reasoning rank already exists in reasoningLevelValues.

Validation results:

  • The app and server type checks passed.
  • The 46 focused app tests passed.
  • The five focused server tests passed.
  • The browser check passed for model, provider, and reasoning controls.
  • The browser check also reproduced the native caret-key conflict.
  • A broad server run had 1,369 passes and ten unrelated timeout failures.

@ymichael ymichael self-assigned this Aug 12, 2026
@ymichael
ymichael force-pushed the feat/model-picker-directional-shortcuts branch from 45c1de1 to 044ca34 Compare August 13, 2026 03:21
@ymichael ymichael changed the title feat: add directional model and reasoning shortcuts feat: add bidirectional model, provider, and reasoning cycles Aug 13, 2026
smsunarto and others added 7 commits August 12, 2026 21:06
Cycling was the only way to move through models and reasoning efforts, so
reaching the previous entry meant wrapping all the way around. Add five
commands with explicit direction:

  modelPicker.previousModel      Mod+ArrowLeft
  modelPicker.nextModel          Mod+ArrowRight
  modelPicker.decreaseReasoning  Mod+ArrowDown
  modelPicker.increaseReasoning  Mod+ArrowUp
  modelPicker.cycleProvider      Command+Right Option (macOS)

Distinguishing the provider chord needs the physical side of the Option
key, which `key` reports as "Alt" for both; `normalizeAppShortcutInputKey`
now falls back to `code` for AltRight.

The two existing commands keep their chords and are relabelled to say what
they do: "Next model" becomes "Cycle model", "Next reasoning level" becomes
"Cycle reasoning effort". The repeated composer activation context is
extracted to `composerWithoutModal`.

Bundled SDK types and templates are regenerated for the new command ids.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The provider chord was Command+Right Option, which only macOS can produce,
so Windows and Linux had no way to reach it. Move it to Alt+P, completing
the Alt+M / Alt+P / Alt+T cycle family, and drop the right-Option handling
that existed solely for the old chord — the shortcut recorder rejects
modifier-only keys, so no user could bind it anyway.

An Option chord that reaches the browser inserts a composed character, so
the handler now claims the chord whenever it is in scope and no-ops when
there is nowhere to rotate. It also owns the chord while the popover is
open, matching the model and reasoning cycles.

Group the cycle commands ahead of the directional ones in the picker, the
default bindings, and Settings → Keyboard, and move the directional chords
from prose into the shortcut table.
Three copies of the open-picker context literal, three copies of the
cycle-chord ownership expression, and a hand-rolled reverse of
`nextCycleValue` had accumulated across the model picker keybindings.

Name the open-picker scope once as `pickerOpenOnly`, add `ownsCycleChord`
beside the existing `ownsClosedNavigationChord`, and derive
`previousCycleValue` from `nextCycleValue` over the reversed list so both
directions share one policy for wrapping and absent values.

No behavior change.
The expected-binding array spelled out all six shortcut fields six times
and repeated both `when` shapes verbatim, so the Alt chord table was
around ninety lines of near-identical literals.

Hoist the two scopes, add an `altChord` builder, and fold the navigation
`when` check into the tuple assertion beside it. Every field is still
asserted; only the spelling is shorter. The scopes stay test-local
literals rather than imports so the assertions cannot go circular.
@ymichael
ymichael force-pushed the feat/model-picker-directional-shortcuts branch from 64f5082 to 05c1d91 Compare August 13, 2026 04:08
@ymichael
ymichael merged commit 9bb0eda into get-bb:main Aug 13, 2026
9 checks passed
@smsunarto
smsunarto deleted the feat/model-picker-directional-shortcuts branch August 22, 2026 22:49
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.

3 participants