composer: picking another provider's model keeps the typed prompt
Summary
picking a model from another provider in the composer (say gpt to claude) wiped whatever you had typed in the prompt.
that pick is a harness switch, so acpmux starts a new session. the composer keeps drafts per session, and when its sessionId changed it swapped in the new session's saved draft, which is empty for a brand new session. the old chat is also hidden while the new one starts, so the id goes old -> none -> new and each step cleared the text.
now the pane passes switching (a harness switch intent is live) to the composer. during a switch the typed prompt stays and becomes the new session's draft (the existing hydrate path then writes it durably). moving to another chat still shows that chat's own draft, same as before.
same-provider model picks never changed the session, so they weren't affected.
Testing
- added
webviews/test/composer-switch-keeps-draft.test.tsx: a switch (session a -> none -> b) keeps the prompt, and moving to another chat still shows that chat's draft. - red then green with the same command,
bun test test/composer-switch-keeps-draft.test.tsx: on the test commit9bfc08786a71 fail (prompt came back""), with the fix 2 pass. - ran every draft / composer / harness switch / model picker test file (45 files), all pass.
bun run typecheckclean, oxlint clean on the touched files. - checked live in a tagged dev build: typed a prompt, picked another provider's model, the text stayed.
Changelog
Fixed: Picking a model from another provider no longer clears the prompt you were typing
Proof
behavior fix in the composer, covered by the test above; checked live in a tagged build.
Checklist
- Behavior changes have added or updated tests, or Testing says why not
- Reviewed with a subagent before merge (cmux-review), and all bot and human review comments resolved
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the composer clearing the typed prompt when picking a model from another provider (say switching from gpt to claude).
Picking another provider's model is a harness switch that starts a new session. The composer keeps drafts per session, so when the session changed it swapped in the new session's empty draft. The pane now passes a switching flag while the harness switch is underway: the typed prompt stays and becomes the new session's draft. A chat's own saved draft wins over a carried prompt, so moving to another chat mid-switch still shows that chat's draft, as before.