Skip to content

gut(auto-reply): remove directive-handling model-state internals — Area 5 of #2336#2475

Merged
alexey-pelykh merged 1 commit intomainfrom
gut/2465-directive-handling-model-state
Apr 22, 2026
Merged

gut(auto-reply): remove directive-handling model-state internals — Area 5 of #2336#2475
alexey-pelykh merged 1 commit intomainfrom
gut/2465-directive-handling-model-state

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Follow-up to PR #2463 (Areas 1+2+4 of #2336). Completes the directive-handling portion of the sweep by removing model-state plumbing that was already empty/trivial after #2335's createModelSelectionState removal.

Per the Middleware Boundary Principle: RemoteClaw does NOT control model selection — CLI runtimes (Claude, Gemini, Codex, OpenCode) own those decisions. handleDirectiveOnly and applyInlineDirectivesFastLane carried 10 fields (aliasIndex, allowedModelKeys, allowedModelCatalog, resetModelOverride, defaultProvider, defaultModel, initialModelLabel, formatModelSwitchEvent, provider, model) that are now fully dead.

Closes #2465.

Changes

  • src/auto-reply/reply/directive-handling.params.ts: delete all 10 model-state fields from HandleDirectiveOnlyCoreParams; delete unused surface?: string from HandleDirectiveOnlyParams.
  • src/auto-reply/reply/directive-handling.impl.ts: queue-validation channel semantic fix — switch from misused params.provider (AI provider, e.g. anthropic) to params.messageProviderKey ?? "" (actual message channel, e.g. telegram). Aligns with get-reply-run.ts:382 which already passes sessionCtx.Provider correctly. User-visible effect is limited to channel-specific queue config display when running /queue without args.
  • src/auto-reply/reply/directive-handling.fast-lane.ts: drop model-state destructures; drop dead sessionEntry.providerOverride/modelOverride reads; simplify return type {directiveAck?; provider; model}{directiveAck?}. Note: providerOverride/modelOverride ARE written by src/gateway/sessions-patch.ts:213-214 and src/agents/tools/session-status-tool.ts:254-255, but their downstream consumption via this fast-lane path reaches only isReasoningTagProvider at get-reply-run.ts:453 (enforceFinalTag for google/google-gemini-cli/minimax) — vestigial Pi-era plumbing per gut(auto-reply): finish thinking-level and model-selection sweep — follow-up to #2335 #2336's gut thesis.
  • src/auto-reply/reply/get-reply-directives-apply.ts: delete inline empty-default directiveModelState compat shim (introduced in gut(auto-reply): remove dead thinking-level resolution plumbing (#2334) #2335); delete aliasIndex/initialModelLabel/formatModelSwitchEvent threading; inline single-call createDirectiveHandlingBase factory; drop provider/model from ApplyDirectiveResult.continue variant (pure pass-through of inputs post-gut).
  • src/auto-reply/reply/get-reply-directives.ts (required cascade): delete dead initialModelLabel/formatModelSwitchEvent constructions and their two param passes (orphaned by the scope reduction in apply.ts); collapse let provider/let model to const (no longer reassigned).

Deferred

  • resolveDefaultModel stub in directive-handling.ts still returns allowedModelKeys/allowedModelCatalog/resetModelOverride — never read by callers. Separate cleanup wave.
  • aliasIndex still threaded through get-reply.tsresolveReplyDirectives (dead throughout). Separate cleanup wave.
  • Adjacent Areas 3 (SessionEntry.thinkingLevel), 6 (docs), 7 (display audit), 8 (test-layer hardening) of gut(auto-reply): finish thinking-level and model-selection sweep — follow-up to #2335 #2336 remain as separate follow-ups.

Verification

Test plan

Refs: #2465, #2336, #2335, #2463

🤖 Generated with Claude Code

…ea 5 of #2336

Follow-up to PR #2463 (Areas 1+2+4 of #2336). Completes the directive-handling
portion of the sweep by removing model-state plumbing that was already empty/
trivial after #2335's `createModelSelectionState` removal.

Per the Middleware Boundary Principle: RemoteClaw does NOT control model
selection — CLI runtimes (Claude, Gemini, Codex, OpenCode) own those decisions.
`handleDirectiveOnly` and `applyInlineDirectivesFastLane` carried 10 fields
(`aliasIndex`, `allowedModelKeys`, `allowedModelCatalog`, `resetModelOverride`,
`defaultProvider`, `defaultModel`, `initialModelLabel`, `formatModelSwitchEvent`,
`provider`, `model`) that are now fully dead.

## Changes

- `src/auto-reply/reply/directive-handling.params.ts`: delete all 10 model-state
  fields from `HandleDirectiveOnlyCoreParams`; delete unused `surface?: string`
  from `HandleDirectiveOnlyParams`.
- `src/auto-reply/reply/directive-handling.impl.ts`: queue-validation `channel`
  semantic fix — switch from misused `params.provider` (AI provider, e.g.
  "anthropic") to `params.messageProviderKey ?? ""` (actual message channel,
  e.g. "telegram"). Aligns with `get-reply-run.ts:382` which already passes
  `sessionCtx.Provider` correctly. User-visible effect is limited to
  channel-specific queue config display when running `/queue` without args.
- `src/auto-reply/reply/directive-handling.fast-lane.ts`: drop model-state
  destructures; drop dead `sessionEntry.providerOverride`/`modelOverride`
  reads; simplify return type `{directiveAck?; provider; model}` →
  `{directiveAck?}`. *Note*: `providerOverride`/`modelOverride` ARE written
  by `src/gateway/sessions-patch.ts:213-214` and
  `src/agents/tools/session-status-tool.ts:254-255`, but their downstream
  consumption via this fast-lane path reaches only `isReasoningTagProvider`
  at `get-reply-run.ts:453` (`enforceFinalTag` for google/google-gemini-cli/
  minimax) — vestigial Pi-era plumbing per #2336's gut thesis.
- `src/auto-reply/reply/get-reply-directives-apply.ts`: delete inline empty-
  default `directiveModelState` compat shim (introduced in #2335); delete
  `aliasIndex`/`initialModelLabel`/`formatModelSwitchEvent` threading; inline
  single-call `createDirectiveHandlingBase` factory; drop `provider`/`model`
  from `ApplyDirectiveResult.continue` variant (pure pass-through of inputs
  post-gut).
- `src/auto-reply/reply/get-reply-directives.ts` (required cascade): delete
  dead `initialModelLabel`/`formatModelSwitchEvent` constructions and their
  two param passes (orphaned by the scope reduction in apply.ts); collapse
  `let provider`/`let model` to `const` (no longer reassigned).

## Deferred

- `resolveDefaultModel` stub in `directive-handling.ts` still returns
  `allowedModelKeys`/`allowedModelCatalog`/`resetModelOverride` — never read
  by callers. Separate cleanup wave.
- `aliasIndex` still threaded through `get-reply.ts` → `resolveReplyDirectives`
  (dead throughout). Separate cleanup wave.
- Adjacent Areas 3 (`SessionEntry.thinkingLevel`), 6 (docs), 7 (display audit),
  8 (test-layer hardening) of #2336 remain as separate follow-ups.

## Verification

- `pnpm check`: exit 0 (format + tsgo + oxlint + project-specific lints)
- `pnpm test`: 800 files / 7010 passed / 3 skipped — matches #2463 baseline
- Grep across the 4 target files: zero hits for all 10 gutted symbols

Refs: #2465, #2336, #2335, #2463

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh enabled auto-merge (squash) April 22, 2026 15:17
@alexey-pelykh alexey-pelykh merged commit e33220c into main Apr 22, 2026
15 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/2465-directive-handling-model-state branch April 22, 2026 15:23
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.

gut(auto-reply): remove directive-handling model-state internals (#2336 Area 5)

1 participant