gut(auto-reply): remove directive-handling model-state internals — Area 5 of #2336#2475
Merged
alexey-pelykh merged 1 commit intomainfrom Apr 22, 2026
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
createModelSelectionStateremoval.Per the Middleware Boundary Principle: RemoteClaw does NOT control model selection — CLI runtimes (Claude, Gemini, Codex, OpenCode) own those decisions.
handleDirectiveOnlyandapplyInlineDirectivesFastLanecarried 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 fromHandleDirectiveOnlyCoreParams; delete unusedsurface?: stringfromHandleDirectiveOnlyParams.src/auto-reply/reply/directive-handling.impl.ts: queue-validationchannelsemantic fix — switch from misusedparams.provider(AI provider, e.g.anthropic) toparams.messageProviderKey ?? ""(actual message channel, e.g.telegram). Aligns withget-reply-run.ts:382which already passessessionCtx.Providercorrectly. User-visible effect is limited to channel-specific queue config display when running/queuewithout args.src/auto-reply/reply/directive-handling.fast-lane.ts: drop model-state destructures; drop deadsessionEntry.providerOverride/modelOverridereads; simplify return type{directiveAck?; provider; model}→{directiveAck?}. Note:providerOverride/modelOverrideARE written bysrc/gateway/sessions-patch.ts:213-214andsrc/agents/tools/session-status-tool.ts:254-255, but their downstream consumption via this fast-lane path reaches onlyisReasoningTagProvideratget-reply-run.ts:453(enforceFinalTagfor 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-defaultdirectiveModelStatecompat shim (introduced in gut(auto-reply): remove dead thinking-level resolution plumbing (#2334) #2335); deletealiasIndex/initialModelLabel/formatModelSwitchEventthreading; inline single-callcreateDirectiveHandlingBasefactory; dropprovider/modelfromApplyDirectiveResult.continuevariant (pure pass-through of inputs post-gut).src/auto-reply/reply/get-reply-directives.ts(required cascade): delete deadinitialModelLabel/formatModelSwitchEventconstructions and their two param passes (orphaned by the scope reduction in apply.ts); collapselet provider/let modeltoconst(no longer reassigned).Deferred
resolveDefaultModelstub indirective-handling.tsstill returnsallowedModelKeys/allowedModelCatalog/resetModelOverride— never read by callers. Separate cleanup wave.aliasIndexstill threaded throughget-reply.ts→resolveReplyDirectives(dead throughout). Separate cleanup wave.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
pnpm check: exit 0 (format + tsgo + oxlint + project-specific lints)pnpm test: 800 files / 7010 passed / 3 skipped — matches gut(auto-reply): partial thinking-level + model-selection sweep — Areas 1+2+4 of #2336 #2463 baselinegit diff --stat: 5 files changed, 14 insertions(+), 97 deletions(-)Test plan
pnpm checkgreenpnpm testgreen (no regression vs gut(auto-reply): partial thinking-level + model-selection sweep — Areas 1+2+4 of #2336 #2463 baseline)Refs: #2465, #2336, #2335, #2463
🤖 Generated with Claude Code