Skip to content

refactor(config): remove obsolete LLM model feature catalog types #2478

@alexey-pelykh

Description

@alexey-pelykh

Context

RemoteClaw is middleware that delegates LLM execution to CLI agents (Claude Code, Gemini, Codex, OpenCode). The CLI agents handle provider/model selection and auto-detect model capabilities (tool support, reasoning-effort support, thinking-format dialect, etc.) at runtime.

Caching model-feature flags in middleware config violates the middleware boundary: middleware becomes authoritative on model capabilities it doesn't control, and cached flags drift out of sync with real model behavior. Three related dead types in src/config/ remain from the pre-fork embedded execution path.

Problem

MODEL_APIS constant (src/config/types.models.ts:3-12)

Enum listing LLM API protocols (openai-completions, anthropic-messages, google-generative-ai, etc). Stored on model definitions as an optional api field. No production code reads this field for routing — it's metadata that's never inspected.

ModelCompatConfig type (src/config/types.models.ts:16-30)

Feature-flag record: supportsReasoningEffort, supportsTools, supportsStrictMode, thinkingFormat. Referenced only by:

  • src/config/zod-schema.core.ts:181-194 — the Zod validator that enforces its shape in loaded config
  • src/config/schema.base.generated.ts:1203+ — generated JSON schema (regenerates from Zod)
  • src/config/config-misc.test.ts:319-320 — test fixture

Verification:

rg "ModelCompatConfig|supportsReasoningEffort|supportsStrictMode|thinkingFormat" src/ --type ts
# All hits are in: types.models.ts (declaration), zod-schema.core.ts (validator),
# schema.base.generated.ts (generated), config-misc.test.ts (fixture).
# No production reader of any compat field.

ModelApiSchema Zod validator (src/config/zod-schema.core.ts:181)

Zod validator for MODEL_APIS. Becomes orphan once MODEL_APIS is removed.

Tasks

  • Remove MODEL_APIS constant and ModelApi type from src/config/types.models.ts
  • Remove ModelCompatConfig type and the compat?: ModelCompatConfig field reference in ModelDefinitionConfig
  • Remove the optional api field from ModelDefinitionConfig if present
  • Remove ModelApiSchema and ModelCompatConfigSchema from src/config/zod-schema.core.ts
  • Update the model definition schema in src/config/zod-schema.agent-defaults.ts to drop compat, api optional fields
  • Regenerate src/config/schema.base.generated.ts from the updated Zod sources
  • Remove test-fixture fields in src/config/config-misc.test.ts referencing the removed fields
  • Decide on migration behavior for existing user configs containing these fields:
    • Option A: silent passthrough (use z.object(...).passthrough() on the model definition) — tolerant but hides drift
    • Option B: migration warning via the same channel used for other legacy-field warnings — explicit signal
    • State the choice in the PR description
  • Run tsc --noEmit and full test suite

Acceptance Criteria

  • rg "MODEL_APIS|ModelCompatConfig|ModelApiSchema|supportsReasoningEffort|supportsStrictMode|thinkingFormat" src/ returns no hits outside the migration shim (if Option B)
  • Existing user configs containing these fields still parse successfully
  • tsc --noEmit clean
  • Test suite passes

Metadata

Metadata

Assignees

Labels

gutRemoving dead upstream subsystems

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions