gut(auto-reply): partial thinking-level + model-selection sweep — Areas 1+2+4 of #2336#2463
Merged
alexey-pelykh merged 1 commit intomainfrom Apr 22, 2026
Merged
Conversation
…as 1+2+4 of #2336 Partial execution of #2336's full sweep. Covers Areas 1 (`/think` directive removal), 2 (`thinking.ts` helper deletion), and 4 (`thinkLevel` passthrough plumbing) plus an adjacent cleanup of `onModelSelected` callback and its `ModelSelectedContext` type. Areas 3, 5, 6, 7, 8 remain for follow-ups (see the end of this commit message). **Rationale**: thinking level and model selection are CLI-runtime concerns per the Middleware Boundary Principle — CLI runtimes (Claude, Gemini, Codex, OpenCode) own those decisions. Anything in the fork that resolves, gates, or stores thinking level / selected model is vestigial from upstream OpenClaw and was already no-op'd after PR #2335. `AgentRuntime.execute` (src/middleware/types.ts) accepts none of these fields — confirmed. ## Area 1: `/think` directive end-to-end removal - `src/auto-reply/reply/directive-handling.parse.ts`: removed `hasThinkDirective` and `thinkLevel` fields from `InlineDirectives`. - `src/tui/tui-command-handlers.ts`: deleted the `/think` command handler; removed `formatThinkingLevels` import; removed `opts.thinking` passthrough from `sendChat`. - `src/gateway/server-methods/chat.ts`: deleted the `injectThinking`-based `/think ${p.thinking} ${parsedMessage}` body rewrite and the `p.thinking` param. - `src/auto-reply/reply.triggers.trigger-handling.targets-active-session-native-stop.e2e.test.ts`: deleted the `thinkCases` block that asserted `/think:high` stripping (behavior replaced by no-op since directive parser is gone). - `src/cli/tui-cli.ts`: removed `--thinking <level>` CLI option. - `src/tui/gateway-chat.ts`, `src/tui/tui-types.ts`: removed `thinking` option / `ChatSendOptions.thinking` field. ## Area 2: `thinking.ts` helper deletion - `src/auto-reply/thinking.ts`: deleted `normalizeThinkLevel`, `supportsXHighThinking`, `formatXHighModelHint`, `listThinkingLevelLabels`, `formatThinkingLevels`, `resolveThinkingDefaultForModel`, `isBinaryThinkingProvider`, `XHIGH_MODEL_*` constants, `CLAUDE_46_MODEL_RE`, `ThinkingCatalogEntry` and `ThinkLevel` types. Kept and simplified `listThinkingLevels` (returns the static level list). Kept `normalizeVerboseLevel`, `normalizeNoticeLevel`, `normalizeUsageDisplay`, `normalizeElevatedLevel`, `resolveElevatedMode`, `normalizeReasoningLevel`, `normalizeFastMode` — these are RemoteClaw's own directive-normalization helpers (not thinking-specific) and are load-bearing for display/security layers. - `src/commands/agent/session.ts`: removed `normalizeThinkLevel` import, `persistedThinking` field, and its `ThinkLevel`-typed call on `sessionEntry.thinkingLevel`. ## Area 4: `thinkLevel` dead passthrough + adjacent cleanup - `src/auto-reply/reply/queue/types.ts`: removed `thinkLevel?: unknown` from `FollowupRun.run`. - `src/auto-reply/reply/agent-runner-utils.ts`: dropped `thinkLevel` from `buildEmbeddedRunBaseParams`' returned object (function itself is dead Pi-embedded plumbing — tracked for follow-up). - `src/auto-reply/reply/agent-runner-execution.ts`: deleted the `onModelSelected({provider, model, thinkLevel: undefined})` callback call and the now-unused `const model = params.followupRun.run.model` declaration. - `src/auto-reply/reply/get-reply-run.ts`: removed `resolvedThinkLevel` field from `RunPreparedReplyParams` and the `thinkLevel: resolvedThinkLevel` assignment in the `followupRun.run` builder. - `src/auto-reply/reply/get-reply.ts`, `get-reply-inline-actions.ts`, `get-reply-directives.ts`, `commands-types.ts`: dropped `resolvedThinkLevel` fields + passthrough destructures. - `src/auto-reply/types.ts`: deleted the whole `ModelSelectedContext` type and `GetReplyOptions.onModelSelected` callback (these echoed configured-value `provider`/`model`/`thinkLevel` — not actual CLI-reported selection; meaningful only when the Pi-embedded runtime owned dynamic fallback, which was gutted in #76/#77). - `src/channels/reply-prefix.ts`: replaced the mutation-based `onModelSelected` callback with a static read from `resolveAgentEffectiveModelPrimary(cfg, agentId)` at context-creation time. Response-prefix template interpolation (`{model}`, `{provider}`, `{modelFull}`) still works with configured values. `ResponsePrefixContext.thinkingLevel` dropped. - Removed `{ onModelSelected, ...rest } = createReplyPrefixOptions(...)` destructures and `onModelSelected` property spreads across ~16 channel integrations: bluebubbles, feishu, googlechat, matrix, mattermost (monitor + slash-http), msteams, twitch, zalo, zalouser, discord (agent-components + message-handler + native-command), gateway/chat, imessage, line, plugin-sdk/inbound-reply-dispatch, signal, slack (monitor/dispatch + slash), telegram (bot-message + native-commands), tui (command-handlers + gateway-chat), web (auto-reply/process-message). Plus 3 test fixtures (`get-reply-run.media-only.test.ts` — 2 stale think-hint tests deleted; `get-reply-inline-actions.skip-when-config-empty.test.ts`, `get-reply.reset-hooks-fallback.test.ts`; `agent-runner-utils.test.ts` — stale `toMatchObject` keys; `test-helpers.ts`, `agent-runner.*.test.ts` fixtures; `slack/monitor/slash.test-harness.ts` mock return value). ## Areas deferred to follow-up issues - **Area 3** (`SessionEntry.thinkingLevel` field removal + gateway schema + session.ts `persistedThinking`): still live in the session store, surfaced by TUI / status / Telegram / ACP / gateway session APIs. Mechanical but touches wire-format / session migration. - **Area 5** (directive handling model-state internals — `aliasIndex`, `allowedModelKeys`, `resetModelOverride`, `defaultProvider` / `defaultModel`, `initialModelLabel`, `formatModelSwitchEvent`): 4 files, significant refactoring. - **Area 6** (docs): `/think` references in slash-commands.md, context.md, tui.md, group-messages.md. - **Area 7** (display-layer audit): Android, iOS, macOS, web UI display references to `thinkingLevel`. Per-file judgment required (pass-through display = KEEP, state driver = REMOVE). Issue #2336 explicitly flagged: "Do NOT touch native apps without confirming". - **Area 8** (test-layer hardening): delete the global `runPreparedReply` shield mock at `get-reply.test-mocks.ts:39-40`; add regression test exercising the real resolveReplyDirectives → runPreparedReply chain. ## Additional finding (filed as follow-up) The `buildEmbeddedRunBaseParams` / `buildEmbeddedContextFromTemplate` / `buildEmbeddedRunContexts` / `buildTemplateSenderContext` / `resolveRunAuthProfile` / `resolveEnforceFinalTag` / `resolveProviderScopedAuthProfile` / `resolveModelFallbackOptions` / `buildThreadingToolContext` cluster in `src/auto-reply/reply/agent-runner-utils.ts` has zero production callers — dead Pi-embedded plumbing that threads verboseLevel / reasoningLevel / elevatedLevel / bashElevated / execOverrides for nothing. Tracked as a separate follow-up. ## Verification - `pnpm check` (format + tsgo + oxlint + project-specific lints) → exit 0. - `pnpm test` (full parallel suite) → **800 files / 7010 passed / 3 skipped** — no regression. - Rescan: `git grep "/think\|hasThinkDirective\|thinkLevel\|supportsXHighThinking\|normalizeThinkLevel\|formatXHighModelHint"` in `src/` / `extensions/` returns only: `thinkingLevel` (stored in session, Area 3 deferred), display-layer native-app references (Area 7 deferred), and docs mentions (Area 6 deferred) — all scoped to follow-ups. Refs: #2336, #2334, #2335, #2089 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 22, 2026
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
… never sent (#2336 Area 7) (#2471) Follow-up to #2336 (umbrella) / #2463 (Areas 1+2+4). Completes Area 7 for the Web UI surface only. Native apps (Android / iOS / macOS) deferred — state-drivers there require release coordination; classification report in PR description will feed that work. ## Classification Web UI `thinkingLevel` was dead display plumbing: read from `chat.history` into `state.chatThinkingLevel`, passed through `ChatProps.thinkingLevel` to `renderChat`, but the view body never read the prop. No UI code mutates or sends `thinkingLevel` — `patchSession` in `controllers/sessions.ts` only handles `label` / `verboseLevel`. ## Changes - `ui/src/ui/types.ts` — drop phantom `thinkingLevel?` from `GatewaySessionRow` and `SessionsPatchResult.entry`. - `ui/src/ui/controllers/chat.ts` — drop `chatThinkingLevel` from `ChatState`, narrow `chat.history` response type, drop the state assignment. - `ui/src/ui/app-view-state.ts`, `ui/src/ui/app.ts`, `ui/src/ui/app-render.ts` — drop `chatThinkingLevel` state plumbing. - `ui/src/ui/views/chat.ts` — drop unused `thinkingLevel` prop from `ChatProps`. `renderChat` reads `activeSession?.reasoningLevel` for its single reasoning branch — not `thinkingLevel`. - Tests: drop fixture/assertion lines that were exercising the removed display plumbing. ## Backward compat Backend still sends `thinkingLevel` in `chat.history` response (until #2464 removes `SessionEntry.thinkingLevel`). UI ignoring unknown response fields is safe — correct ordering: reader removed first (this PR), backend schema removal next (#2464). ## What was NOT touched — and why - `ui/src/ui/format.test.ts` — tests `stripThinkingTags` (XML `<think>` tag stripping from CLI assistant output). Unrelated to `thinkingLevel` state field. Keep. - `apps/shared/RemoteClawKit/Tests/OpenClawKitTests/AssistantTextParserTests.swift` — same pattern: `<think>` XML parsing. Keep. - All native-app files (Android / iOS / macOS) — state-drivers that send `thinkingLevel` via `sessions.patch` and `chat.send(thinking:)`. Deferred per issue instruction; full classification in PR description. ## Verification - `grep thinkingLevel|chatThinkingLevel|thinkLevel` in `ui/` → 0 matches. - `pnpm check` → exit 0 (format + tsgo + lint + lint:tmp:no-random-messaging + lint:no-remoteclaw-ai). - `pnpm test src/ui/controllers/chat.test.ts src/ui/views/chat.test.ts` → 35/35 passed. Other UI test failures on this branch match `origin/main` baseline (unrelated to `thinkingLevel`). Closes #2467. Unblocks #2464. Refs: #2336, #2463, #2464 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
Part of the umbrella thinking-level / model-selection sweep (#2336). Sibling PR #2463 landed Areas 1+2+4 (runtime `/think` parsing, helpers, and passthrough plumbing); this PR covers Area 6 (docs). RemoteClaw does not control thinking levels — CLI runtimes (Claude, Gemini, Codex, OpenCode) own that decision. User-facing documentation advertising `/think` as a directive was inherited from upstream OpenClaw and is now stale. ## Removals - `docs/tools/slash-commands.md`: - L17: drop `/think` from the directives list. - L114: delete the `/think <off|minimal|low|medium|high|xhigh>` command entry. - L133: drop `/think: high` from the colon-separator example (`/send: on`, `/help:` still illustrate both syntactic variants). - `docs/concepts/context.md:139`: drop `/think` from the directives list. - `docs/web/tui.md:94`: delete the `/think <off|...>` TUI entry. - `docs/channels/group-messages.md`: - L18: drop `or /think high` (kept `/verbose on` as primary example). - L70: drop `/think high` from the session-level directives list. ## Verification - `git grep "/think\b" docs/` → 0 hits (matches parent #2336 AC). - `cd docs && npm run build` → 296 pages built, no errors. - `pnpm format:docs:check` → clean. - `pnpm lint:docs` → no errors on edited files (pre-existing errors on unrelated files documented; identical on `origin/main`). ## Out of scope (tracked as informational for future #2336 waves) - `/thinking off` advice at `docs/help/faq.md:2354` — alias of the removed directive. - `/tools/thinking` URL references in `faq.md`, `messages.md`, `hubs.md` — pre-existing broken links; target page was gutted in an earlier wave. - `docs/web/tui.md:40` status-line string `model + think/fast/...` — UI indicator shorthand, not a slash command. - `src/agents/agent-helpers/errors.ts` still references `/think` in an error message — src cleanup belongs to Areas 1/2/4. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 22, 2026
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
… (#2472) Part of the umbrella thinking-level / model-selection sweep (#2336). Sibling PR #2463 landed Areas 1+2+4 (runtime `/think` parsing, helpers, and passthrough plumbing); this PR covers Area 6 (docs). RemoteClaw does not control thinking levels — CLI runtimes (Claude, Gemini, Codex, OpenCode) own that decision. User-facing documentation advertising `/think` as a directive was inherited from upstream OpenClaw and is now stale. ## Removals - `docs/tools/slash-commands.md`: - L17: drop `/think` from the directives list. - L114: delete the `/think <off|minimal|low|medium|high|xhigh>` command entry. - L133: drop `/think: high` from the colon-separator example (`/send: on`, `/help:` still illustrate both syntactic variants). - `docs/concepts/context.md:139`: drop `/think` from the directives list. - `docs/web/tui.md:94`: delete the `/think <off|...>` TUI entry. - `docs/channels/group-messages.md`: - L18: drop `or /think high` (kept `/verbose on` as primary example). - L70: drop `/think high` from the session-level directives list. ## Verification - `git grep "/think\b" docs/` → 0 hits (matches parent #2336 AC). - `cd docs && npm run build` → 296 pages built, no errors. - `pnpm format:docs:check` → clean. - `pnpm lint:docs` → no errors on edited files (pre-existing errors on unrelated files documented; identical on `origin/main`). ## Out of scope (tracked as informational for future #2336 waves) - `/thinking off` advice at `docs/help/faq.md:2354` — alias of the removed directive. - `/tools/thinking` URL references in `faq.md`, `messages.md`, `hubs.md` — pre-existing broken links; target page was gutted in an earlier wave. - `docs/web/tui.md:40` status-line string `model + think/fast/...` — UI indicator shorthand, not a slash command. - `src/agents/agent-helpers/errors.ts` still references `/think` in an error message — src cleanup belongs to Areas 1/2/4. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
2 tasks
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
…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>
4 tasks
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
…ea 5 of #2336 (#2475) 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>
12 tasks
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
CLI runtimes own reasoning depth — the thinkingLevel input pipeline has no runtime effect. Remove the remaining surface after #2463-#2471 eliminated most of it. Removals: - Delete orphan src/auto-reply/thinking.shared.ts (no importers) - Prune dead helpers in thinking.ts: ThinkingCatalogEntry, isBinaryThinkingProvider, listThinkingLevels, shadow normalizeProviderId - Drop subagents.thinking from agent-defaults types/schema and AgentEntry.subagents zod schema - Remove --thinking flag from cron add/edit + tests; strip thinking from CronPayload, normalize, store-migration, and cron jobs mergePayload/buildPayloadFromPatch - Remove thinking from gateway agent.send params, HookAgentPayload, HookAction, HookMappingResolved, server-http, server/hooks, server-node-events agent.request deep link - Remove thinking from AgentCommandOpts + thinkingOnce, agent-via-gateway, subagent-spawn _thinkingOverrideRaw / thinkingOverride, sessions_spawn tool schema - Remove thinking from protocol schemas (agent.ts, cron.ts, logs-chat.ts, sessions.ts) and ACP translator chat.send path - Remove hooks.mappings[].thinking / hooks.gmail.thinking from zod schema, types, help, labels, quality test; regenerate schema.base.generated.ts - Remove dead --thinking option + help-text example from agent CLI register; remove [--thinking] from /subagents spawn usage line; remove "thinking" from cron-tool agentTurn payload doc + JOB_KEYS - Remove dead mocks (normalizeThinkLevel, supportsXHighThinking) and dead resolvedThinkLevel param in buildStatusReply - Sweep docs: 9 files no longer teach --thinking / thinkingDefault Added: - LEGACY_CONFIG_RULES entries for agents.defaults.thinkingDefault and agents.defaults.subagents.thinking - strip-thinking-level-fields LEGACY_CONFIG_MIGRATIONS entry that strips thinkingDefault, agents.defaults.subagents.thinking, agents.list[].subagents.thinking, hooks.mappings[].thinking, and hooks.gmail.thinking so existing configs still load cleanly - 3 new tests in config-misc.test.ts covering the new migration Kept (intentional): - type === "thinking" / thinking_delta output-event rendering in middleware/runtimes, transcript truncation, ACP output blocks, TUI formatters, HTML export template - Telegram/Discord "thinking" lifecycle status emoji (different concept from thinking level) - reasoningLevel everywhere (different concept — channel-bound display behavior) remoteclaw cron add --thinking high now errors with "unknown option '--thinking'". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
alexey-pelykh
added a commit
that referenced
this pull request
Apr 22, 2026
…) (#2486) CLI runtimes own reasoning depth — the thinkingLevel input pipeline has no runtime effect. Remove the remaining surface after #2463-#2471 eliminated most of it. Removals: - Delete orphan src/auto-reply/thinking.shared.ts (no importers) - Prune dead helpers in thinking.ts: ThinkingCatalogEntry, isBinaryThinkingProvider, listThinkingLevels, shadow normalizeProviderId - Drop subagents.thinking from agent-defaults types/schema and AgentEntry.subagents zod schema - Remove --thinking flag from cron add/edit + tests; strip thinking from CronPayload, normalize, store-migration, and cron jobs mergePayload/buildPayloadFromPatch - Remove thinking from gateway agent.send params, HookAgentPayload, HookAction, HookMappingResolved, server-http, server/hooks, server-node-events agent.request deep link - Remove thinking from AgentCommandOpts + thinkingOnce, agent-via-gateway, subagent-spawn _thinkingOverrideRaw / thinkingOverride, sessions_spawn tool schema - Remove thinking from protocol schemas (agent.ts, cron.ts, logs-chat.ts, sessions.ts) and ACP translator chat.send path - Remove hooks.mappings[].thinking / hooks.gmail.thinking from zod schema, types, help, labels, quality test; regenerate schema.base.generated.ts - Remove dead --thinking option + help-text example from agent CLI register; remove [--thinking] from /subagents spawn usage line; remove "thinking" from cron-tool agentTurn payload doc + JOB_KEYS - Remove dead mocks (normalizeThinkLevel, supportsXHighThinking) and dead resolvedThinkLevel param in buildStatusReply - Sweep docs: 9 files no longer teach --thinking / thinkingDefault Added: - LEGACY_CONFIG_RULES entries for agents.defaults.thinkingDefault and agents.defaults.subagents.thinking - strip-thinking-level-fields LEGACY_CONFIG_MIGRATIONS entry that strips thinkingDefault, agents.defaults.subagents.thinking, agents.list[].subagents.thinking, hooks.mappings[].thinking, and hooks.gmail.thinking so existing configs still load cleanly - 3 new tests in config-misc.test.ts covering the new migration Kept (intentional): - type === "thinking" / thinking_delta output-event rendering in middleware/runtimes, transcript truncation, ACP output blocks, TUI formatters, HTML export template - Telegram/Discord "thinking" lifecycle status emoji (different concept from thinking level) - reasoningLevel everywhere (different concept — channel-bound display behavior) remoteclaw cron add --thinking high now errors with "unknown option '--thinking'". 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
Partial execution of umbrella #2336's full sweep. Covers Areas 1 + 2 + 4 from the issue body plus adjacent cleanup of
onModelSelected/ModelSelectedContext(which was vestigial after the Pi-embedded gut — CLI runtimes own model selection, the callback just echoed config values).Areas 3, 5, 6, 7, 8 remain — follow-up issues to be filed on merge, per issue author's own recommendation: "should probably be split into sub-PRs by area for reviewability."
Why not
verboseLevel/reasoningLevel/elevatedLevel?Traced — none of them flow to
AgentRuntime.execute(confirmed:src/middleware/types.ts:6-16). But unlike thinkingLevel (CLI-owned), these three are load-bearing for RemoteClaw's own display and security layers:verboseLevel→createShouldEmitToolResult/createShouldEmitToolOutputgates inagent-runner-helpers.ts. Controls what RemoteClaw shows the user in reply payloads. Alive.reasoningLevel→ RemoteClaw's reasoning-display toggle (reply-dispatcher.tsconsumes), plus TUI / status / Telegram / ACP surfaces. Alive.elevatedLevel→ RemoteClaw security layer (bash permission policy) — pre-CLI gate. Alive (display-only in current fork but slot is held).All three persist in the session store for display-surface consumers. They DO have dead passthrough through the Pi-embedded-era
buildEmbeddedRunBaseParamscluster (which has zero production callers), but that's a separate cleanup (see "Follow-up findings" below).Areas covered (with file counts)
/thinkdirective removal--thinkingCLI flag +opts.thinkingpassthroughthinking.tshelpersnormalizeThinkLevel,supportsXHighThinking,formatXHighModelHint,listThinkingLevelLabels,formatThinkingLevels,resolveThinkingDefaultForModel,isBinaryThinkingProvider,XHIGH_MODEL_*,CLAUDE_46_MODEL_RE,ThinkingCatalogEntry,ThinkLeveltype. SimplifiedlistThinkingLevels.thinking.ts,commands/agent/session.ts)thinkLevelpassthroughFollowupRun.run,ModelSelectedContext,ReplyDirectiveContinuation,HandleCommandsParams,handleInlineActions,get-reply-run,agent-runner-execution,get-reply.ts,get-reply-directives,get-reply-inline-actions,commands-types,agent-runner-utils; test fixtures updated; 2 stale think-hint tests deletedModelSelectedContexttype +GetReplyOptions.onModelSelectedcallback. Replaced mutation-basedcreateReplyPrefixContextwith static read fromresolveAgentEffectiveModelPrimary. RemovedonModelSelecteddestructure + spread across ~20 channel integrations (Discord, Mattermost, Matrix, Slack, Telegram, iMessage, Signal, Line, TUI, Web, msteams, feishu, googlechat, bluebubbles, zalo, zalouser, twitch) + plugin-sdk + test harnessesTotal: 49 files, +56 / -420.
Areas deferred (to be filed as follow-up issues post-merge)
SessionEntry.thinkingLevelfield removal + gateway schema +reply/session.ts::persistedThinking. Touches wire format. Separate concern.aliasIndex,allowedModelKeys,resetModelOverride,defaultProvider/defaultModel,initialModelLabel,formatModelSwitchEvent). 4 files, significant refactor./thinkreferences in 4 doc files).thinkingLevelreferences). Issue flagged "Do NOT touch native apps without confirming". Per-file judgment required.runPreparedReplyshield mock; add regression test through realresolveReplyDirectiveschain).Follow-up findings (also to be filed post-merge)
The
buildEmbeddedRunBaseParams+buildEmbeddedContextFromTemplate+buildEmbeddedRunContexts+buildTemplateSenderContext+resolveRunAuthProfile+resolveEnforceFinalTag+resolveProviderScopedAuthProfile+resolveModelFallbackOptions+buildThreadingToolContextcluster insrc/auto-reply/reply/agent-runner-utils.tshas zero production callers (confirmed viagit grepof each symbol). Dead Pi-embedded plumbing that transitively threadsverboseLevel/reasoningLevel/elevatedLevel/bashElevated/execOverridesfor nothing. Removing it would additionally trimFollowupRun.run.{verboseLevel, reasoningLevel, elevatedLevel, execOverrides, bashElevated}— none of which have real consumers beyond this dead cluster + session-store displays that read the session entry directly.Verification
pnpm check(format + tsgo + oxlint +lint:tmp:no-random-messaging+lint:no-remoteclaw-ai) → exit 0pnpm test(full parallel suite viascripts/test-parallel.mjs) → 800 files / 7010 passed / 3 skipped — no regressionTest plan
pnpm checkexit 0pnpm testfull suite greenContext
src/middleware/types.ts(AgentRuntimeinterface accepts neither thinkingLevel nor model-selection fields — confirmed)Does not close #2336 — partial delivery. Follow-up issues will track Areas 3/5/6/7/8 + the dead-cluster finding.
Refs: #2336, #2335, #2334, #2089
🤖 Generated with Claude Code