remove(llm): retire think_enabled setting entirely

Two-in-one cleanup motivated by the chat hang in dev 2026-05-22.

The crash root cause from the guarded-task traceback:

    UnboundLocalError: cannot access local variable 'get_setting'
    where it is not associated with a value
      File generation_task.py:257, in run_generation
        think = (await get_setting(user_id, 'think_enabled', 'false'))...

generation_task.py imports get_setting at module top, but a later
'if voice_mode: from ... import get_setting' block scopes it as a
function-local. When voice_mode=False the local import never runs,
but Python had already flagged get_setting as local for the entire
body — the think_enabled read at line 257 hit UnboundLocalError.

The line itself was dead-weight anyway. With the conversation+curator
architecture: chat ships tools=[] (think on a no-tools pass is pure
latency cost; nothing for the model to reason ABOUT in tool-call
terms), and the curator hardcodes think=False already. The user
setting was a holdover from before the architecture pivot. Removing
it entirely is cleaner than fixing the scoping bug to preserve a
toggle nobody should be using:

- generation_task.py: think hardcoded False. Removed the get_setting
  call (which fixes the UnboundLocalError as a side effect).
- SettingsView.vue: dropped the Enable model thinking checkbox, the
  thinkEnabled / savingThinkEnabled refs, the saveThinkEnabled
  function, and the think_enabled load step.
- Migration 0050: DELETE FROM settings WHERE key='think_enabled'
  to clean up any stored rows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 21:03:25 -04:00
parent fdb0f10848
commit 37596ce31c
3 changed files with 41 additions and 41 deletions
@@ -246,15 +246,17 @@ async def run_generation(
# Emit context event
buf.append_event("context", {"context": context_meta})
# Think mode is per-user-setting (default off). Historically forced on for
# qwen3 because content-gated thinking (87fcaa6) exposed silent-generation
# failures on short tool-intent prompts. After moving to a model-family
# decoupled architecture, the bench data (May 2026) showed think costs
# 1-2 min/turn for unclear quality benefit; default off, opt in via
# the Settings UI. The generation_tool_log captures per-turn outcomes
# so reliability regressions surface empirically.
# Think mode is hardcoded off (2026-05-23). Historical context:
# originally forced on for qwen3's combined think+tools template;
# then made user-configurable when we decoupled the architecture;
# now removed entirely because in the chat+curator world there's no
# reason for the chat model to think. Chat has tools=[] — it just
# talks, and think on a no-tools conversational pass is pure
# latency cost (the May 2026 bench measured 1-2 min/turn for
# unclear quality benefit). The curator (services/curator.py) also
# already hardcodes think=False for its own reasons.
think_requested = think
think = (await get_setting(user_id, "think_enabled", "false")).lower() == "true"
think = False
t_start = time.monotonic()
timing: dict = {