Remote chats: model, mode and option picks reach the daemon in order

Merged
TE
5d ago
+30-11

What failed

RemoteAcpmuxSettingsTests.modelModeAndOptionPicksGoToThisChat failed 2 of 6 tip Swift suite runs (41282022128, 41303556638):

RemoteAcpmuxSettingsTests.swift:87: (client.calls → ["attach", "model claude-opus-5-5", "config effort=high", "mode acceptEdits"]) == ["attach", "model claude-opus-5-5", "mode acceptEdits", "config effort=high"]

Cause

RemoteAcpmuxWire.run starts a Task for each page request, so three picks sent together reach the owning machine's daemon in any order. This has been there since the picks were added (#30001). The order matters to a person, not only to the test: a model switch can reset the options picked after it.

Fix

Model, mode and option picks run one after another: each pick's call waits for the one sent before it (State.lastPick). Every other page request still runs at once, as before.

Risk

Small, one component. A pick now waits for the pick before it to answer. A daemon that never answered the earlier pick would also leave the later one unanswered, but the later one would have gone to that same stuck daemon anyway.

Observed / Not run

Read the code and the run logs. I did not run the suite; this PR's own cmux-next swift test runs RemoteAcpmuxSettingsTests. A fleet compile-check is queued.

Changelog

Fixed: a remote chat's model, mode and option picks reach that machine in the order you made them.

Agent session: agent session

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes remote chat model, mode, and option picks arriving at the owning machine's daemon out of order, which failed modelModeAndOptionPicksGoToThisChat and could reset options picked after a model switch. Each pick now waits for the pick sent before it; other page requests still run concurrently.