refactor(shared): share model-selection command choice#10577

merged1
t3code/codex-turn-mapping
agents/mcp-shared/model-selection
openedSep 7, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago

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 updateThreadMetadata into a shared modelSelectionCommandType helper in model.ts
  • The helper returns thread.model-selection.set when the current and selected provider instance IDs match, and provider.switch when 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
Synced from GitHub

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.

Synced from GitHub

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.