Repository navigation
Share chat option writes across desktop and phone - #36624
Conversation
Held launch refusals toast again while the transport is still closed, desktop notices follow only the chat's presentation scope so a fence or status change on the same chat still reports, and the phone banner no longer depends on the read record.
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
|
Review loop status: done. Two review rounds, all findings fixed, CI green. The problem. When you changed a chat's model, effort, permissions or Fast setting, desktop and phone each ran their own copy of the write. Each copy also kept its own "a pick is pending" marker beside the shared record of in-flight picks, so the two could drift apart; on the phone the marker cleared when the latest pick finished even if an earlier pick was still in flight. This PR moves the write into one shared writer for both apps and works the phone's lock out from the shared in-flight record instead of storing it. What users get. Nothing should look or behave differently. Picks are accepted the same way, pickers lock and unlock at the same moments, and the same failure toast (desktop) or banner (phone) appears. The duplicated logic is gone, so future fixes land once for both apps. Fixed during review (33cf289):
Deferred (follow-ups, not user-visible):
What was verified.
Main was merged once before final CI (7d88dcd, no conflicts, no overlap with this PR's files); final CI on that head is green. For Brennan's review:
|
Problem. When you change a chat's model, effort, permissions or Fast setting, desktop and phone each ran their own copy of the write: checking the pick, sending it to the host, waiting for the answer, showing a failure, and refreshing. Each copy also kept its own "a pick is pending" marker beside the shared record of in-flight picks, so the two could disagree. On the phone, that separate marker was cleared when the latest pick finished even if an earlier pick was still in flight. #36582 already shared the reading side of these options; this shares the writing side, so both apps run one implementation.
What changes for users. Nothing should look or behave differently. The same picks are accepted, the same pickers lock and unlock at the same moments, and the same failure toast (desktop) or banner (phone) appears. This removes the duplicated logic behind those behaviors, so future fixes land once for both apps.
How it works. One shared writer, used by both apps, checks a pick, records it as in flight, sends it, and handles the host's answer. Nothing stores a separate "pending" marker any more. The phone works out whether its options sheet is locked from the latest pick it sent, whether that pick was made while the agent was starting or was a permission change, and whether that pick is still in flight. That keeps today's phone behavior: picks made during startup and permission picks never lock the sheet, and resetting or reconnecting clears the lock. Desktop keeps its per-row busy state, sends picks made while a new chat is still launching straight to the launch path, keeps its original connection and its extra setup steps for older paired servers, and still refreshes after every answer. Failure notices keep the same scope as before: desktop shows a toast while you are still on that chat (and always for a refused pick made during launch), the phone shows its banner for a refused pick, and an unconfirmed delivery stays silent on the phone. Model and effort values are still sent exactly as picked, whether or not they appear in the model list and whatever name the agent reports back. No saved data, wire fields, capabilities or RPCs change.
Differences from the common pattern:
Tests. The shared writer tests run picks for Claude and Codex chats against an empty model list. They cover a pick sent as typed, an older host that leaves the options out of its reply, refused and unconfirmed replies, startup ending or beginning while a pick is in flight, two quick picks finishing in either order, reset, replacement, detach, and failure-notice scope. Desktop hook tests, using the production presentation check, cover a refusal shown during launch, a refusal shown on the same chat after its runtime changes, and a refresh after a superseded answer. A phone hook test covers the latest pick finishing while an earlier one is still in flight. Phone suites run in CI.