Skip to content

Dynamic-models subsystem is orphaned: buildApiHandler never uses ProviderFactory / ModelRegistry / Dynamic*Handler #245

Description

@sydneyrenee

There are two parallel provider systems and the runtime only uses one.

Live path (used at runtime): buildApiHandler() (src/api/index.ts:49) → static *Handler classes (e.g. AnthropicHandler) → hardcoded model maps (anthropicModels, …). This is what TheaTask constructs (src/core/TheaTask.ts:214).

Orphaned path (built but unreachable):

  • ProviderFactory0 runtime callers (referenced only by tests).
  • 9 Dynamic*Handler classes (*-dynamic.ts) — imported only by provider-factory.ts.
  • ModelRegistry (src/api/providers/model-registry.ts) — consumed only by the unregistered webviewMessageHandler and by the dynamic handlers.
  • model-providers/*-model-provider.ts + *-model-provider.ts — feed ModelRegistry.

buildApiHandler never instantiates any Dynamic*Handler, so the dynamic model-fetching feature documented in docs/dynamic-models-*.md is not wired into the product — users only ever get the static hardcoded model lists. ~20 files form a self-referential island that the coverage inventory counts as "tested" only because the tests exercise each other.

Decision needed

Either:

  1. Wire it in — route buildApiHandler (or a new async path) through ProviderFactory/ModelRegistry so live model lists are actually used; or
  2. Delete it — remove ProviderFactory, *-dynamic.ts, model-providers/*, and the registry if dynamic fetching is out of scope.

Acceptance

  • A single, documented provider-construction path; no parallel infra that the runtime never calls.

Related: dead webview layer (separate issue), tracking issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureArchitecture / wiring / structural concernsenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions