Skip to content

fix(native): composer review follow-ups: ordered sends, worktree launches, provider icons - #28

Merged
rynfar merged 3 commits into
nativefrom
nw/w2-followup
Nov 2, 2026
Merged

rynfar merged 3 commits into
nativefrom
nw/w2-followup

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

What

Fixes the independent review's findings on the merged composer PR (#20). Refs #4, #5, #6.

# Finding Fix
1 [P1] Send prerequisites ran concurrently ClientHandle::dispatch_in_order: approval declines, then permission and mode changes, each after the one before it committed. The first failure aborts the send before the message goes out. AppState::rpc futures now start when first polled, so futures built together run in the order they are awaited.
2 [P1] New threads ignored worktree defaults core/workspace.rs ports resolveProjectSettings / resolveNewThreadEnvMode (project override, environment default, t3.json through projects.readFile, name-only projects stay local until their first thread), resolveNewDraftStartFromOrigin, and the default base branch from vcs.listRefs. A draft's first send launches with {type:"worktree", baseRef, startFromOrigin?} the way startThreadTurn encodes prepareWorktree.
3 [P2] Provider options traits::composer_options (getComposerProviderState): Fast mode is sent as off for Cursor unless the user picked it, options for OpenCode models outside the catalog are kept, and the plan agent is hidden while plan mode is off.
4 [P2] Sending during /compact steered workflows::is_compacting sets can_steer = !compacting for the send, Enter, and the button tooltip.
5 [P2] Question auto-advance timer The timer remembers its (request, question), advances only if that is still the active question, and every question change cancels it.
6 [P2] Provider switching workflows::supports_provider_handoff (threadSupportsProviderHandoff): reads the attached session's capabilities and handles detached native threads and v1 imports.
7 [P2] Exhausted default models providers::exhausted_window (per-provider quota pools for Cursor, Antigravity and OpenCode) plus with_usage_fallback (resolveNewThreadModelSelection).
8 [P2] Shift+Tab core/lists.rs ports listOutdentForTab. It runs before the plan-mode toggle.
9 [P3] Provider icons vendor-icons.ts --providers vendors the marks from Icons.tsx and each provider package's icon, with light and dark fills baked in. --check now catches drift. provider_icon.rs ports ProviderInstanceIcon: Codex is a one-color mask, the others use img(), initials are the fallback, and a badge shows the instance or its accent. Used by the composer trigger, the picker rail, and model rows.
10 [Risk] Enter during IME or key repeat EnterKey { repeat, composing } in submit_intent. A composer key-down capture records is_held, and the textarea's marked range marks composition. A repeat inserts a newline, as on the web. During composition the IME handles Enter.
11 [Risk] Re-deriving on every event requests::PendingKey (the pending request values, plus the turn-item count only while something is pending) gates pending_requests. The model picker no longer has its own config subscription. The composer refreshes it only while it is open.
12 [Risk] Stop without threadStop workflows::stop_target ports the run search in interruptThreadTurn: the live run, else the settled run that left background work (derivePendingBackgroundWork).

The send paths moved out of composer/mod.rs (now 519 lines) into composer/send.rs. The duplicate ISO parser the earlier WIP added was removed in favor of sidebar::time::parse_iso.

Verification

  • Failing tests first for the logic: a_held_or_composing_enter_never_sends, the_pending_key_changes_only_with_what_pending_requests_read, and the WIP's ordered_dispatch_waits_for_each_command_and_stops_at_a_failure, workspace/*, workflows/*, lists/*, composer_options_*, exhausted_windows_*, a_spent_default_falls_back_*.
  • cargo test --workspace ✓, cargo clippy --workspace --all-targets -- -D warnings ✓, gen-theme --check ✓, parity/sync.test.ts ✓, conformance --check ✓, vendor-icons --check ✓, pre-commit lint ✓.
  • Probe against the smoke server (devReplay only):
$ probe --launch <project> "worktree probe" --provider devReplay --model showcase --worktree <root> --dry-run
projects.readFile t3.json: ok=true defaultThreadEnvMode=None
vcs.listRefs: isRepo=Some(true) refs=Some(100)
workspaceStrategy: {"baseRef":"main","startFromOrigin":true,"type":"worktree"}
$ probe --thread <id> --compose "w2b ordered send check" --provider devReplay --model showcase --runtime-mode auto-accept-edits
ordered dispatch of 2 commands: Ok(())
thread …: event seq=1554 … seq=1569
$ probe --thread <id>
workflows: handoff=true compacting=false stop=Thread stop_without_thread_stop=Nothing

The worktree launch was a dry run only. The smoke project's root is the orchestrator's own checkout, and a real worktree launch would create a branch there.

Gaps

  • No screenshots in this environment. The provider icons, badges and key guards are verified by build and logic tests only and still need a real-window pass.
  • The env mode is resolved at send time, not when the draft opens, because there is no branch toolbar yet (CO-WORKSPACE stays partial): no base-branch picker, no existing-worktree or branch choice.
  • Stop without thread.stop and with no run does not unwatch PR watches as the web does.
  • ACP registry instances keep initials. The web draws the agent's registry icon from its URL.
  • The auto-advance timer and the Enter guards are view wiring with no GPUI test harness. Their decisions are tested in core.
  • The web also re-checks after a decline whether an approval arrived mid-decline. Not ported.

Done by Claude Opus 5.5 in Claude Code (native factory worker W2b).

… and run workflows to core

Pure ports the composer review needed:

- workspace: the project's new-thread env mode (project override, environment default,
  `t3.json`, name-only projects stay local), start-from-origin, the default base branch, and
  the `worktree` launch strategy.
- providers: exhausted usage windows per provider pool and the `fallbackModelSelection` swap
  for a spent default; accent colors and instance badges.
- traits: `getComposerProviderState` options: Fast mode dispatched off for Cursor, uncatalogued
  OpenCode options preserved, the plan agent hidden while plan mode is off.
- workflows: provider handoff from the attached session (and detached native threads), the
  `/compact` gate, and the Stop target for servers without `thread.stop`.
- lists: `listOutdentForTab`. requests: a cheap key so pending requests re-derive only when
  something they read changed. composer: Enter repeats and IME composition never send.
`ProviderInstanceIcon`: the Codex, Claude and Antigravity marks from `Icons.tsx` and each
provider package's icon, vendored by `vendor-icons.ts --providers` with light and dark fills
baked in (`--check` now also catches drift). Instances without a mark show their initials, and
a badge tells two instances of one driver apart or carries a configured accent.
… and key guards

Answers the independent review of the composer:

- Send runs its prerequisites one at a time: approval declines, then permission and mode
  changes, each after the previous one committed, and aborts on the first failure before the
  message goes out (`dispatch_in_order`). RPC futures now start when first polled.
- A draft's first send resolves the project's env mode and launches into a new worktree off the
  default branch when it asks for one.
- Turns carry `getComposerProviderState` options; a send behind a running `/compact` queues.
- Provider switching reads the attached session's capabilities, and detached native threads.
- Exhausted default models fall back to the configured fallback model.
- Shift+Tab outdents a nested list item before toggling plan mode.
- Enter during IME composition or an OS key repeat does not send.
- The question auto-advance timer is cancelled on any question change and checks it is still
  on the question it was set for.
- Pending requests re-derive only when what they read changed; the hidden model picker no
  longer rebuilds on every config change.
- Stop on servers without `thread.stop` interrupts the live run or the run left with
  background work.
- `composer/send.rs` takes the send paths out of `composer/mod.rs`. The probe gains
  `--worktree`, `--dry-run`, ordered `--compose`, and prints the workflow decisions.
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.

1 participant