Skip to content

gut(middleware): remove dead thinkingLevel configuration surface (#2480)#2486

Merged
alexey-pelykh merged 1 commit intomainfrom
gut/2480-thinking-level-surface
Apr 22, 2026
Merged

gut(middleware): remove dead thinkingLevel configuration surface (#2480)#2486
alexey-pelykh merged 1 commit intomainfrom
gut/2480-thinking-level-surface

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Closes #2480. CLI runtimes own reasoning depth — the thinkingLevel input pipeline has no runtime effect. This PR removes the remaining surface after prior PRs (#2463, #2464, #2465, #2466, #2467, #2471, #2475, #2476) eliminated most of it.

Net: 52 files changed, 185 insertions(+), 502 deletions(−). Deletes src/auto-reply/thinking.shared.ts entirely.

Removed (input pipeline — had no runtime effect)

  • Orphan helper file: src/auto-reply/thinking.shared.ts (no importers)
  • Dead helpers in thinking.ts: ThinkingCatalogEntry, isBinaryThinkingProvider, listThinkingLevels, shadow normalizeProviderId
  • Config surface: subagents.thinking (agent-defaults + per-agent entries), hooks.mappings[].thinking, hooks.gmail.thinking — types, zod schemas, help, labels, quality test; regenerated schema.base.generated.ts
  • CLI: --thinking flag from cron add/edit and agent command + help-text examples; [--thinking <level>] from /subagents spawn usage line
  • Cron: thinking field from CronPayload, cron/normalize.ts, cron/normalize.test.ts, cron/service/jobs.ts (mergeCronPayload, buildPayloadFromPatch), cron/store-migration.ts, cron-cli tests
  • Gateway: thinking from agent.send params, HookAgentPayload, HookAction, HookMappingResolved, server-http hook dispatch, server/hooks agentTurn payload, server-node-events voice + agent.request deep link
  • Agent/subagent: thinking / thinkingOnce from AgentCommandOpts, agent-via-gateway payload, subagent-spawn (_thinkingOverrideRaw, thinkingOverride), sessions_spawn tool schema, cron-tool agentTurn payload doc + flat-params JOB_KEYS
  • Protocol schemas: thinking from agent.ts, cron.ts, logs-chat.ts, sessions.ts
  • ACP translator: thinking: readString(params._meta, [\"thinking\"]) removed from chat.send path; unused readString import removed
  • Dead mocks: normalizeThinkLevel, supportsXHighThinking in run.test-harness.ts
  • Dead param: resolvedThinkLevel?: unknown in buildStatusReply
  • Docs: 9 files no longer teach --thinking / thinkingDefault (agent CLI, cron, TUI, subagents, platforms, gateway config-reference)

Added

  • LEGACY_CONFIG_RULES entries for agents.defaults.thinkingDefault and agents.defaults.subagents.thinking
  • strip-thinking-level-fields migration in LEGACY_CONFIG_MIGRATIONS — strips thinkingDefault, agents.defaults.subagents.thinking, agents.list[].subagents.thinking, hooks.mappings[].thinking, and hooks.gmail.thinking so existing configs still load cleanly (.strict() zod schemas would otherwise reject unknown keys)
  • 3 new migration tests in src/config/config-misc.test.ts

Kept (intentional — different concepts)

  • Output-event rendering: type === \"thinking\" content-block processing in middleware/runtimes/*.ts, gateway/server-methods/chat.ts transcript truncation, gateway/server/hooks.ts, sessions-history-tool.ts, acp/translator.ts output block rendering, tui/tui-formatters.ts, auto-reply/reply/export-html/template.{js,css}
  • Telegram/Discord status-reaction emoji: thinking as lifecycle state (queued → thinking → tool → done) — distinct from thinking level
  • Typing mode enum \"thinking\" state — UX indicator
  • reasoningLevel: channel-bound middleware concern (Telegram draft streaming) — unchanged

CLI flag behavior after PR

remoteclaw cron add --thinking high now errors with error: unknown option '--thinking' (commander default). Same for cron edit, agent, and /subagents spawn --thinking.

Validation

  • pnpm tsgo: clean
  • pnpm lint: 0 warnings, 0 errors
  • pnpm format:check: all files correctly formatted
  • pnpm test: 7011 passed, 3 pre-existing skips (no new skips); includes 3 new migration tests for the strip-thinking-level-fields migration
  • rg "thinkingLevel|thinkingDefault|ThinkLevel" src/: only migration/rule message text + two historical comments in acp/translator.ts referencing prior gut(session): drop SessionEntry.thinkingLevel field + gateway schema (#2336 Area 3) #2464 removal (intentional)
  • rg "\.thinking\b|params\.thinking" src/: only output-event rendering, emoji lifecycle state, and migration strip code — all intentional
  • rg "reasoningLevel" src/: 36 live hits across 22 files (intentional — separate concept, kept)

Test plan

  • pnpm build (canvas bundle + build pipeline)
  • pnpm test (7011 passed, 3 pre-existing skips)
  • pnpm check (format + typecheck + lint)
  • Manually verified existing configs with thinkingDefault or subagents.thinking trigger migration warning and auto-strip via new tests
  • CI green on PR

Generated as part of /do-all batch 20260422-1c78, Wave 3, Track 4.

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>
@alexey-pelykh alexey-pelykh merged commit 8f07f67 into main Apr 22, 2026
15 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/2480-thinking-level-surface branch April 22, 2026 20:55
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.

refactor(middleware): gut dead thinkingLevel configuration surface

1 participant