Skip to content

Convert cross-provider model switches into thread forks and expose generic provider catalog - #5283

Merged
trissim merged 1 commit into
mainfrom
comms-domain/unified-inbox-model-fork
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
comms-domain/unified-inbox-model-fork

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

PR 4a of the #comms 12554 architectural & UX overhaul: declares provider identity and cross-provider switch detection on ModelSelection, adds a generic provider-driven model catalog across every ModelProvider, and automatically converts cross-provider model switches into forked child threads instead of mutating/wiping the parent thread in place.

Mechanisms

  • ModelSelection & ProviderCatalogChoice (src/agent_comms/registry/thread_model.py):
    • provider_name(), crosses_provider_from(current), and crosses_provider_values(current_wire, target_wire) own provider identity and cross-provider detection once in Core.
    • ModelSelection.provider_catalog_choices() builds a generic provider-driven model list across every ModelProvider.members_with(ModelProvider) plus registered dynamic sources and CliInboxSelection.
  • Automatic cross-provider switch -> fork (src/agent_comms/registry/threads.py, src/agent_comms/registry/thread_management.py):
    • Thread.apply_chosen_model and ExternalThread.apply_chosen_model route cross-provider switches to ThreadManagement.fork_for_model_switch(...).
    • fork_for_model_switch preserves the parent thread (original provider, model, and session file) completely intact, allocates a collision-free child name (<parent>-<provider>[-N]), sets ForkedParent(original.name) and child tags, selects the target provider's AgentBackend, and allocates a fresh session location.
  • ModelChanged.forked_from (src/agent_comms/transport/tools/commands.py, src/agent_comms/transport/served_tools/served.py):
    • Annotated with WireOmitDefault(), so in-place switches keep the exact 4-field wire dict while cross-provider forks report forked_from=<parent> and thread=<child>.

Verification

  • pytest -p no:xdist tests/test_cross_provider_model_fork.py tests/test_cli_inbox_switch.py tests/test_mentions.py tests/test_thread_status.py tests/test_agent_settings.py -q: 76 passed (including ZMQ CommsZMQClient.call(CommsModelTool(...)) round-trip).
  • ruff check tests/test_cross_provider_model_fork.py: 0 errors, 0 relative imports.

@trissim
trissim merged commit 3dd8c02 into main Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant