Skip to content

fix(coding-agent): restore the /thinking interactive dispatch - #1519

Open
ndaemy wants to merge 2 commits into
code-yeongyu:mainfrom
ndaemy:fix/thinking-command-dispatch
Open

ndaemy wants to merge 2 commits into
code-yeongyu:mainfrom
ndaemy:fix/thinking-command-dispatch

Conversation

@ndaemy

@ndaemy ndaemy commented Sep 9, 2026

Copy link
Copy Markdown

Summary

/thinking and /thinking <level> were listed in autocomplete and /help but had no branch in the interactive submit handler, so the text fell through to session.prompt() and reached the model as an ordinary user message (queued as a steering message while a reply was streaming).

Upstream 496185f added the thinking entry to BUILTIN_SLASH_COMMANDS together with its dispatch; the sync merge 4632790 (#1119) kept the entry and dropped the dispatch. This restores it:

  • setupEditorSubmitHandler: /thinking opens the level selector, /thinking <level> sets the level (case-insensitive; unknown levels report the available ones).
  • createBaseAutocompleteProvider: argument completions for thinking from session.getAvailableThinkingLevels().
  • handleThinkingCommand / selectThinkingLevel / showThinkingSelector from upstream, with upstream's setThinkingLevel(level, { persist }) mapped onto the fork's split setters: /thinking <level> and Enter in the selector use setSessionThinkingLevel (session scope), Ctrl+S uses setThinkingLevel, which records the per-model remembered level (modelThinkingLevels) exactly like the /settings thinking row. Ctrl+S does not write the global defaultThinkingLevel; per-model memory is what startup consults first (feat(coding-agent): per-model reasoning memory, /reasoning + /efforts commands, persistent /fast #894).
  • getAvailableThinkingLevels() is awaited at every new call site because InteractiveSession widens it for the shared-host proxy.

docs/settings.md and docs/usage.md still described Ctrl+S as saving the global startup default (wording carried over from upstream); they now describe the per-model memory and the defaultThinkingLevel fallback.

/reasoning, /efforts, and Shift+Tab are untouched.

Fixes #1437

Verification

  • test/suite/regressions/1437-thinking-command-dispatch.test.ts: submit-handler routing (/thinking high → handler, never session.prompt; bare /thinking → selector; /thinking-… not matched) and handler behavior (session-scoped apply, case-insensitive match against a Promise-returning level list, unknown-level error text, selector path, Ctrl+S persist path).
  • bun run --cwd packages/coding-agent test test/suite/regressions/1437-thinking-command-dispatch.test.ts test/interactive-mode-exit-command.test.ts test/interactive-mode-status.test.ts test/suite/reasoning-commands.test.ts — 4 files, 94 tests passed.
  • bun run check — passed.
  • senpi-qa TUI run (tmux, isolated agent dir, local fake OpenAI-compatible model so the request body is visible), before → after:
    • idle /thinking high: user message sent to the model → no request, status Thinking level: high, footer mock-model:high
    • /thinking low while a reply streams: appended to the next request → applied immediately, no extra request
    • /thinking turbo: sent to the model → Unknown thinking level "turbo". Available levels: off, minimal, low, medium, high.
    • bare /thinking: sent to the model → thinking-level selector (Enter to select · Ctrl+S to set as default · Esc to cancel)
    • /efforts high, /reasoning, Shift+Tab: unchanged

Tracker


Summary by cubic

Restores interactive /thinking dispatch for #1437: /thinking now opens the selector and /thinking <level> changes the session level instead of sending the command to the model as user text. Ctrl+S in the selector remembers the level for the current model, while defaultThinkingLevel remains the fallback.

  • Matches levels case-insensitively and reports available levels for invalid input.
  • Adds autocomplete from the session’s supported thinking levels, including shared-host sessions.
  • Adds regression coverage and updates the usage and settings documentation.

Written for commit fbd4406. Summary will update on new commits.

Review in cubic

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.

/thinking is listed in autocomplete and /help but is sent to the model as a user message

1 participant