refactor(shared): share model-selection command choice#10577
Part 1/16 of the shared-core and MCP stack. Based on t3code/codex-turn-mapping at 415ed0f73b97f1655b6282492f81d0b2bba3a9cc. Next: #10578.
The client and MCP must choose the same command when changing a thread's model. This extracts modelSelectionCommandType into the existing shared model module and makes client-runtime use it. The MCP consumer follows in its own layer.
Same provider instance uses thread.model-selection.set; a different instance uses provider.switch. The current provider instance is authoritative; changing a model name alone does not switch providers. No new provider policy or command behavior.
Validation: Existing client command and shared model suites: 25 tests passed. Client-runtime/shared typechecks passed. The client regression observes the actual command for same-provider and different-provider changes.
Layer size: 3 files, +31/-5. No MCP tools are introduced in this prerequisite.
Prepared with Codex in the OpenAI agent runtime.
Note
Extract shared modelSelectionCommandType helper for thread model selection
- Extracts the provider instance comparison logic from
updateThreadMetadatainto a sharedmodelSelectionCommandTypehelper in model.ts - The helper returns
thread.model-selection.setwhen the current and selected provider instance IDs match, andprovider.switchwhen they differ - Updates tests in commands.test.ts to verify command selection based on provider instance, adding a same-provider case
Macroscope summarized a645d4e.
Added 1 commit
- refactor: share model-selection command choicea645d4e
Approvability
Verdict: Approved at a645d4e
Macroscope's review found this PR approvable — This is a small, behavior-preserving refactor that centralizes the existing provider-instance comparison and adds coverage for both command-selection branches. The production impact is limited to calling an equivalent pure helper, with no defaults, schemas, or deployment behavior changed.
You can add or adjust custom eligibility rules. Learn more.
Thread transfer impact
⚠️ The latest CI run did not produce a thread transfer result for a645d4e.
This comment will update automatically after the next completed run.