Skip to content

gut(providers): re-apply provider/model cascade after v2026.3.7 sync regression#2350

Merged
alexey-pelykh merged 1 commit intomainfrom
gut/2337-provider-model-cascade
Apr 13, 2026
Merged

gut(providers): re-apply provider/model cascade after v2026.3.7 sync regression#2350
alexey-pelykh merged 1 commit intomainfrom
gut/2337-provider-model-cascade

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Closes

Partially addresses #2337 — main scope done, two documented deferrals tracked below.

Scope

Deleted (13 files)

Clean stubs (zero external consumers):

  • src/agents/pi-embedded-messaging.ts
  • src/agents/model-compat.ts
  • src/agents/test-helpers/pi-tool-stubs.ts
  • src/agents/pi-tools.before-tool-call.ts
  • src/agents/pi-tools.before-tool-call.runtime.ts
  • src/auto-reply/reply.directive.directive-behavior.model-directive-test-utils.ts
  • src/commands/openai-codex-model-default.ts

Stub deletions with rewired consumers:

  • src/agents/custom-api-registry.ts — dead ensureCustomApiRegistered call removed from tts/tts-core.ts; test mock + assertion removed from tts/tts.test.ts.
  • src/agents/pi-model-discovery.ts — vestigial ModelRegistry vi.mock + piSdkMock state removed from gateway/test-helpers.mocks.ts, test-helpers.server.ts, and server.sessions.gateway-server-sessions-a.test.ts.
  • src/agents/model-catalog.ts — Telegram vision cascade rewired (see below).
  • src/gateway/server-methods/models.ts — imports, spreads, method list, and scope entries removed.
  • src/gateway/server-methods/skills.ts — same.
  • src/auto-reply/reply/session-reset-model.ts — stub + get-reply.ts call block + test-mock + 3 session.test.ts test cases removed.

Cascade rewiring

Telegram vision (model-catalog.ts deletion): Removed loadModelCatalog→findModelInCatalog→modelSupportsVision chain from telegram/bot-message-context.body.ts, bot-message-dispatch.ts, sticker-cache.ts. Also removed catalog mocks in reply.block-streaming.test.ts, session.test.ts, commands/agent.test.ts, and cron/isolated-agent/run.test-harness.ts.

Product decision — Telegram vision: The middleware/runtimes/*.ts::mediaCapabilities field already gates media attachments in the CLI runtime layer (see middleware/media-capability.ts); the Telegram-side check was dead (stub returned false unconditionally, disabling vision even when available). Rewiring drops the capability check and unconditionally substitutes cached sticker descriptions. If a future product decision reinstates per-channel vision gating, it should source capabilities from the runtime's mediaCapabilities, not from a rebuilt catalog.

Gateway models/skills: Deleted server-methods/{models,skills}.ts stubs + their imports/spreads in server-methods.ts, method entries in server-methods-list.ts, and scope entries in method-scopes.ts. Removed models.list, skills.status, skills.bins, skills.install, skills.update from every registry.

Product decision — node-host skills: Node-host skills feature is unavailable today (empty handler returned []); the client-side SkillBinsCache fallback is preserved for a future re-implementation but no longer calls the skills.bins RPC. Removal is scoped to the gateway wiring only; the follow-up Discord/Mattermost PR will sweep the remaining references.

Product decision — TUI listModels: Removed listModels() + GatewayModelChoice type from tui/gateway-chat.ts, the openModelSelector function and /model-no-args + /models commands from tui-command-handlers.ts, and the Ctrl+L binding from tui.ts. Users can still set a model via /model <provider/model> — the interactive picker is gone until a real model catalog returns.

Schema split: Renamed gateway/protocol/schema/agents-models-skills.ts → agents-tools.ts and pruned ModelChoice, ModelsList*, SkillsStatus*, SkillsBins*, SkillsInstall*, SkillsUpdate*, SkillsSearch*, SkillsDetail* schemas, types, validators, and protocol-schemas.ts registry entries. Remaining content is live AgentSummary*, Agents*, Tools* schemas — the new filename reflects reality.

Session reset model: Removed applyResetModelOverride import + call block from auto-reply/reply/get-reply.ts (unblocks #2339 Wave 2), its vi.mock in get-reply.test-mocks.ts, and the 3 applyResetModelOverride test cases in session.test.ts.

Deferred (tracked for follow-up)

1. onboard-auth-coupled provider files (6 files)

These files are only consumed by src/commands/onboard-auth.config-core.ts, onboard-auth.credentials.ts, and onboard-auth.models.ts, which are deeply dependent (40+ symbol usages in config-core.ts alone):

  • src/agents/huggingface-models.ts
  • src/agents/synthetic-models.ts
  • src/agents/together-models.ts
  • src/agents/venice-models.ts
  • src/agents/models-config.providers.ts
  • src/secrets/provider-env-vars.ts

Blocker: #2338 (running in parallel) deletes the onboard-auth.* cluster entirely. Deleting these 6 files in the current PR would either break the onboard-auth build (leaving dangling imports) or duplicate #2338's gut work and cause merge conflicts.

Plan: After #2338 merges, a 1-PR follow-up deletes these 6 files (no consumers remain).

2. commands-models + Discord/Mattermost model-picker cascade (~2500 LoC)

  • src/auto-reply/reply/commands-models.ts (stub: handleModelsCommand, buildModelsProviderData)
  • src/discord/monitor/model-picker.{ts,test.ts,test-utils.ts,preferences.ts} — full Discord picker UI
  • src/discord/monitor/native-command.ts — ~400 LoC of picker helpers + dispatch
  • extensions/mattermost/src/mattermost/model-picker.{ts,test.ts} — full Mattermost picker
  • extensions/mattermost/src/mattermost/{monitor,slash-http}.ts — picker call sites
  • src/plugin-sdk/mattermost.ts — re-exports
  • src/auto-reply/reply/commands-core.ts — /models slash-command handler

Reason: The actual diff is ~2500 LoC of production UI code deletion + test rewiring. Combined with the current PR this would exceed ~4000 LoC, beyond the issue's own suggested sub-PR threshold.

Plan: Dedicated follow-up PR covering the full Discord/Mattermost picker gut and the commands-models.ts deletion.

Other out-of-scope items from #2337

Test plan

  • pnpm check (format + tsgo + oxlint + random-messaging gate) — 0 errors, 0 warnings
  • pnpm build — exit 0
  • pnpm canvas:a2ui:bundle — exit 0
  • pnpm test — 725 files, 6340 tests, 2 skipped, 0 failures
  • node scripts/check-no-zombie-imports.mjs — exit 0
  • bash scripts/ci/check-rebrand-leakage.sh — no files to check
  • Verification greps on deleted symbols return zero hits (except server-model-catalog.ts, a separate live stub, and KilocodeModelCatalogEntry, an unrelated type)

References

🤖 Generated with Claude Code

…regression (#2337)

Targeted audit (fork HEAD 44b4f92) confirmed 19 provider/model files
re-introduced by the v2026.3.7 upstream sync merge (#2298). Re-applies
the cascade for the files whose only live consumers are already-dead
paths or have in-tree rewire targets. Defers two groups to follow-ups
for coordination reasons documented in the PR body.

Clean stub deletions (zero external consumers):
- agents/pi-embedded-messaging.ts, model-compat.ts, test-helpers/pi-tool-stubs.ts
- agents/pi-tools.before-tool-call.{ts,runtime.ts}
- auto-reply/reply.directive.directive-behavior.model-directive-test-utils.ts
- commands/openai-codex-model-default.ts

Stub deletions with rewired consumers:
- agents/custom-api-registry.ts — drop dead ensureCustomApiRegistered call
  in tts/tts-core.ts plus test mock/assertion in tts.test.ts
- agents/pi-model-discovery.ts — drop vestigial ModelRegistry vi.mock in
  gateway/test-helpers.mocks.ts plus the unused piSdkMock state
- agents/model-catalog.ts — Telegram vision cascade: remove loadModelCatalog
  / findModelInCatalog / modelSupportsVision chain from telegram/
  bot-message-context.body.ts, bot-message-dispatch.ts, sticker-cache.ts;
  middleware/runtimes own mediaCapabilities, not the model catalog. Drop
  catalog mocks in reply.block-streaming.test.ts, session.test.ts,
  agent.test.ts, cron/isolated-agent/run.test-harness.ts

Gateway models/skills cascade:
- Delete gateway/server-methods/{models,skills}.ts plus imports, spreads,
  method list entries, and scope entries in server-methods.ts,
  server-methods-list.ts, method-scopes.ts
- Schema split: rename protocol/schema/agents-models-skills.ts to
  agents-tools.ts and prune ModelChoice, ModelsList*, SkillsStatus,
  SkillsBins, SkillsInstall, SkillsUpdate, SkillsSearch, SkillsDetail
  schemas, types, validators, and protocol-schemas registry entries

TUI listModels cascade:
- Drop listModels + GatewayModelChoice from tui/gateway-chat.ts
- Drop openModelSelector + /model-no-args + /models + Ctrl+L binding from
  tui-command-handlers.ts and tui.ts. /model <provider/model> still works

Session reset model cascade (unblocks #2339 Wave 2):
- Delete auto-reply/reply/session-reset-model.ts stub, its import and
  applyResetModelOverride call block in get-reply.ts, its vi.mock in
  get-reply.test-mocks.ts, and the 3 applyResetModelOverride test cases
  in session.test.ts

Deferred to follow-ups (documented in PR body):
- 6 provider files coupled to onboard-auth.* (huggingface/synthetic/
  together/venice/models-config.providers, provider-env-vars) — blocked
  on #2338 landing first (parallel PR deletes the onboard-auth cluster)
- commands-models.ts + Discord/Mattermost model-picker cascade
  (~2500 LoC) — defer to a dedicated follow-up PR for reviewability

Why: v2026.3.7 sync silently re-introduced gutted files; three restored
stubs (model-catalog, gateway models/skills handlers) were wired into
live call sites, silently neutering Telegram vision detection, node-host
skill bins, and TUI listModels.

How verified: pnpm check passes (format + tsgo + oxlint), pnpm build
passes, pnpm test passes (725 files, 6340 tests, 0 failures), zombie-
import gate passes, rebrand leakage check passes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit 0aa6d97 into main Apr 13, 2026
10 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/2337-provider-model-cascade branch April 13, 2026 12:20
alexey-pelykh added a commit that referenced this pull request Apr 21, 2026
…ns RPC + dangling gateway methods (#2413)

Closes the final AC grep gaps from #2337 after the provider/model cascade
landed via #2350 / #2364 / #2373. Three classes of survivors removed:

- Stale `vi.mock("../agents/model-catalog.js", ...)` block in
  `remoteclaw-tools.session-status.test.ts` — mocks a module deleted in #2350
- Dangling gateway method-list entries for handlers removed in #2350 —
  `skills.bins`, `models.list` in method-scopes.ts; `models.list`,
  `skills.status`, `skills.bins`, `skills.install`, `skills.update` in
  server-methods-list.ts
- Active runtime call to `skills.bins` RPC in `node-host/runner.ts` that
  fails at node-host startup (handler was removed in #2350). Deletes the
  `SkillBinsCache` class, `resolveSkillBinTrustEntries` + `resolveExecutablePathFromEnv`
  helpers, the RPC call, and cascades the dead `SkillBinsProvider` /
  `SkillBinTrustEntry` types from `invoke-types.ts` + `invoke.ts` handler
  signature cleanup

Also bumps `.fork-boundary-mock-baseline` 134 → 133 to lock in the
improvement from removing the dead model-catalog mock.

Verification:
- `git grep "model-catalog\|modelSupportsVision\|loadModelCatalog" src/` → zero
- `git grep "models\.list\|skills\.bins\|skillsHandlers\|modelsHandlers" src/` → zero
- `pnpm check` passes, `pnpm test` passes (7010/7010), zombie-import gate passes

Part of #2337.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
alexey-pelykh added a commit that referenced this pull request Apr 21, 2026
…ns RPC + dangling gateway methods (#2413) (#2448)

Closes the final AC grep gaps from #2337 after the provider/model cascade
landed via #2350 / #2364 / #2373. Three classes of survivors removed:

- Stale `vi.mock("../agents/model-catalog.js", ...)` block in
  `remoteclaw-tools.session-status.test.ts` — mocks a module deleted in #2350
- Dangling gateway method-list entries for handlers removed in #2350 —
  `skills.bins`, `models.list` in method-scopes.ts; `models.list`,
  `skills.status`, `skills.bins`, `skills.install`, `skills.update` in
  server-methods-list.ts
- Active runtime call to `skills.bins` RPC in `node-host/runner.ts` that
  fails at node-host startup (handler was removed in #2350). Deletes the
  `SkillBinsCache` class, `resolveSkillBinTrustEntries` + `resolveExecutablePathFromEnv`
  helpers, the RPC call, and cascades the dead `SkillBinsProvider` /
  `SkillBinTrustEntry` types from `invoke-types.ts` + `invoke.ts` handler
  signature cleanup

Also bumps `.fork-boundary-mock-baseline` 134 → 133 to lock in the
improvement from removing the dead model-catalog mock.

Verification:
- `git grep "model-catalog\|modelSupportsVision\|loadModelCatalog" src/` → zero
- `git grep "models\.list\|skills\.bins\|skillsHandlers\|modelsHandlers" src/` → zero
- `pnpm check` passes, `pnpm test` passes (7010/7010), zombie-import gate passes

Part of #2337.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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