Skip to content

gut(session): drop SessionEntry.thinkingLevel field + gateway schema — Area 3 of #2336#2476

Merged
alexey-pelykh merged 1 commit intomainfrom
gut/2464-session-entry-thinkinglevel
Apr 22, 2026
Merged

gut(session): drop SessionEntry.thinkingLevel field + gateway schema — Area 3 of #2336#2476
alexey-pelykh merged 1 commit intomainfrom
gut/2464-session-entry-thinkinglevel

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Closes #2464 / Area 3 of umbrella #2336.

Removes SessionEntry.thinkingLevel and the gateway protocol schema field, plus every consumer across gateway, auto-reply, agents, status/TUI, ACP translator, HTML export, Mattermost extension, and tests. RemoteClaw does not control reasoning depth — CLI runtimes own it.

Also removes agents.defaults.thinkingDefault (dead after /think directive was gutted in #2466).

Why this is safe

Reader-before-writer ordering:

  1. gut(ui): remove dead thinkingLevel display plumbing (#2336 Area 7) #2471 (PR audit(apps+ui): thinkingLevel display-layer classification (#2336 Area 7) #2467) already removed the Web UI reader of chat.history.thinkingLevel and SessionsPatchResult.entry.thinkingLevel. Web UI stopped reading before this PR stops sending.
  2. Native apps (Android, iOS/macOS/shared) still reference thinkingLevel as display-only state-drivers per gut(ui): remove dead thinkingLevel display plumbing (#2336 Area 7) #2471's audit. After this PR, the field is absent from gateway responses — apps see it as undefined and degrade gracefully. Full native-app rewrite deferred per umbrella guidance.
  3. ACP clients: sessions.patch({thinkingLevel}) now fails schema validation (additionalProperties: false). ACP bridge's own setSessionMode and setSessionConfigOption("thought_level", ...) flows were gutted in the same PR.

Changes

Core type + schema (10 files)

File Change
src/config/sessions/types.ts Drop thinkingLevel?: string from SessionEntry
src/gateway/protocol/schema/sessions.ts Drop thinkingLevel from SessionsPatchParamsSchema
src/config/types.agent-defaults.ts Drop thinkingDefault + /think comment
src/config/zod-schema.agent-defaults.ts Drop zod thinkingDefault entry
src/config/schema.base.generated.ts Regenerated
src/config/types.messages.ts Drop {thinkingLevel}/{think} from responsePrefix template docstring
src/gateway/session-utils.types.ts Drop from GatewaySessionRow
src/gateway/session-utils.ts Drop propagation
src/gateway/server-node-events.ts Drop from node events payload
src/gateway/server-methods/{chat,sessions,agent}.ts Drop from response payloads

ACP bridge surgery (src/acp/translator.ts)

Thought-level mode presentation gutted entirely:

  • thinkingLevel removed from GatewaySessionPresentationRow Pick and GatewaySessionRow union
  • formatThinkingLevelName, buildThinkingModeDescription, and the xhigh case in formatConfigValueName removed (all dead after mode removal)
  • buildSessionPresentation returns modes: { currentModeId: "", availableModes: [] } — ACP bridge exposes no modes
  • setSessionMode is a silent no-op (returns {}, never calls gateway)
  • setSessionConfigOption("thought_level", ...) case removed — now rejects with "does not support"
  • chat.send _meta simplified to readString(params._meta, ["thinking"]) (single key, no thinkingLevel fallback)
  • getGatewaySessionRow no longer reads thinkingLevel
  • listThinkingLevels import dropped (no remaining callers in translator)

Auto-reply + agents + status + TUI (9 files)

File Change
src/auto-reply/reply/session.ts Remove persistedThinking local + carry-over (verbose/reasoning/tts/model-override preserved)
src/auto-reply/reply/response-prefix-template.ts Drop thinkingLevel context field + {thinkingLevel}/{think} interpolation
src/auto-reply/reply/export-html/template.js Drop thinking_level_change entry type display (CLIs no longer emit)
src/agents/tools/{sessions-helpers,sessions-list-tool}.ts Drop from session row type + projection
src/agents/subagent-spawn.ts Drop sessions.patch({thinkingLevel}) call (schema would reject anyway)
src/commands/status.{summary,types}.ts Drop think flag + status row field
src/tui/{tui,tui-types,tui-session-actions,gateway-chat}.ts Drop display + session info field + persist/apply

Extensions + docs

  • extensions/mattermost/src/mattermost/monitor-helpers.ts — drop from ResponsePrefixContext
  • docs/concepts/session-tool.md, docs/reference/session-management-compaction.md, docs/gateway/configuration-reference.md, docs/gateway/configuration-examples.md — drop stale references
  • docs/.generated/config-baseline.json — regenerated

Tests (13 files)

  • Where tests used thinkingLevel as a generic field for store-update behavior, swapped to verboseLevel (still schema-valid): src/config/sessions.test.ts, src/gateway/server.config-patch.test.ts, src/gateway/server.sessions.gateway-server-sessions-a.test.ts
  • Where tests exercised gutted features, rewrote or removed stale cases:
    • src/acp/translator.set-session-mode.test.ts — rewritten for no-op contract
    • src/acp/translator.session-rate-limit.test.ts — thought-level mode tests replaced with no-op assertions
    • src/commands/agent.test.tsthinkingDefault / /think-related tests removed
  • Fixture cleanups in remaining test files

Fork baseline

.fork-boundary-mock-baseline: 133 → 132 (decrease locked in)

Verification

  • git grep "thinkingLevel" in src/ → 2 hits, both in migration-only comments (AC-allowed per issue body)
  • git grep "thinkingDefault" in src/ → 0 hits
  • pnpm check → PASS (format + tsgo + lint + 2 project-specific linters)
  • Fork-integrity gates: zombie-import ✓, stub-debt ✓ (132==132), throwing-stub-callers ✓, obsolescence ✓ (49==49)
  • Unit tests on directly-affected files → PASS (69/69 in 4 core files; edited tests pass)
  • Broader affected suite → 27 pre-existing failures identical to origin/main baseline (30→27 — my changes fix 3 previously-broken thinking tests). No new regressions.
  • CI: build, test, lint, docs, rebrand-gate, zombie-import-gate, stub-debt-gate, throwing-stub-callers-gate, obsolescence-audit-gate (pending this PR's run)

Test plan

  • pnpm check locally
  • Targeted vitest on each modified test file
  • Fork-integrity gates
  • LIVE=1 pnpm test:live attempted — middleware smoke tests require local CLI credentials (pre-existing, unrelated to thinkingLevel)
  • CI green on all required checks

Context

🤖 Generated with Claude Code

…— Area 3 of #2336 (#2464)

Completes Area 3 of the vestigial thinking-level sweep. Removes the
SessionEntry.thinkingLevel field, its gateway protocol schema entry, the
`agents.defaults.thinkingDefault` config entry, and every consumer across
gateway, auto-reply, agents, status/TUI, ACP translator, HTML export,
extensions, and tests. RemoteClaw does not control reasoning depth — CLI
runtimes (Claude, Gemini, Codex, OpenCode) own it.

Reader-before-writer ordering satisfied:
- #2471 (PR #2467) removed the Web UI reader first — safe to stop sending.
- Native apps still reference thinkingLevel as display-only; they now see
  the field absent and degrade gracefully per the umbrella's audit.

ACP bridge surgery:
- thought_level mode presentation removed (modes = empty).
- setSessionMode is a silent no-op.
- thought_level config option removed from setSessionConfigOption.
- chat.send _meta fallback simplified to single "thinking" key.

Test surface updated in 13 test files. Where tests used thinkingLevel as a
generic test field for store-update behavior, swapped to verboseLevel
(still schema-valid). Where tests specifically exercised the gutted feature,
rewrote (translator.set-session-mode.test.ts) or removed the stale cases.

Schema regenerated via scripts/generate-base-config-schema.ts.
Docs config baseline regenerated. Docs updated to drop stale references.

Fork-boundary-mock baseline 133→132 (decrease locked in).

AC verification:
- `git grep "thinkingLevel" src/` → 2 hits, both in migration comments
- `pnpm check` → PASS
- All fork-integrity gates → PASS

Closes #2464.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh enabled auto-merge (squash) April 22, 2026 16:05
@alexey-pelykh alexey-pelykh merged commit 414a09e into main Apr 22, 2026
15 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/2464-session-entry-thinkinglevel branch April 22, 2026 16:11
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(session): drop SessionEntry.thinkingLevel field + gateway schema (#2336 Area 3)

1 participant