The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Hiding reasoning no longer hides tool rows, and tool_progress: off no longer hides reasoning (salvage #125948) (#126479)
Siddharth Balyan8f21606116c3
diff --git a/apps/desktop/src/app/session/hooks/use-hermes-config.test.ts b/apps/desktop/src/app/session/hooks/use-hermes-config.test.tsindex 471841b933a..d8267cca433 100644--- a/apps/desktop/src/app/session/hooks/use-hermes-config.test.ts+++ b/apps/desktop/src/app/session/hooks/use-hermes-config.test.ts@@ -18,6 +18,7 @@ import {setCurrentReasoningEffort,setDefaultReasoningEffort} from '@/store/session'+import { $showToolActivity, setShowToolActivityFromConfig } from '@/store/tool-activity'import { deferred } from '../../../test/deferred'@@ -37,6 +38,7 @@ describe('useHermesConfig refreshHermesConfig', () => {beforeEach(() => {// Reset atoms and localStorage between testssetShowReasoningFromConfig(undefined)+ setShowToolActivityFromConfig(undefined)setCurrentCwd('')setCurrentFastMode(false)setCurrentModelSource('')@@ -65,6 +67,22 @@ describe('useHermesConfig refreshHermesConfig', () => {expect($showReasoning.get()).toBe(true)})+ it('mirrors display.tool_progress independently of show_reasoning', async () => {+ mockConfig({ display: { show_reasoning: false, tool_progress: 'off' } })+ const { result } = renderHook(() => useHermesConfig({ activeSessionIdRef: { current: null } }))++ await act(async () => {+ await result.current.refreshHermesConfig()+ })+ expect($showToolActivity.get()).toBe(false)++ mockConfig({ display: { show_reasoning: false } })+ await act(async () => {+ await result.current.refreshHermesConfig()+ })+ expect($showToolActivity.get()).toBe(true)+ })+// Regression: the composer keeps a manual model pick sticky, which skips the// composer reseed. The profile default must still be published, because the// model picker resolves "the default effort" from it when applying a model'sdiff --git a/apps/desktop/src/app/session/hooks/use-hermes-config.ts b/apps/desktop/src/app/session/hooks/use-hermes-config.tsindex d1c7aa5f711..a663a2c44c4 100644--- a/apps/desktop/src/app/session/hooks/use-hermes-config.ts+++ b/apps/desktop/src/app/session/hooks/use-hermes-config.ts@@ -17,6 +17,7 @@ import {setDefaultReasoningEffort,setIntroPersonality} from '@/store/session'+import { setShowToolActivityFromConfig } from '@/store/tool-activity'import { refreshVoiceLiveStatus } from '@/store/voice-live'import {applyAutoSpeakFromConfig,@@ -144,6 +145,7 @@ export function useHermesConfig({ activeSessionIdRef }: HermesConfigOptions) {setDisplayTimestampsFromConfig(config.display?.timestamps)setShowReasoningFromConfig(config.display?.show_reasoning)+ setShowToolActivityFromConfig(config.display?.tool_progress)setTerminalFontFamilyFromConfig(config.terminal?.font_family)setChatFontFamilyFromConfig(config.desktop?.font_family)diff --git a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsxindex 86c8af26a16..4627243d3b0 100644--- a/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/message-parts.tsx@@ -34,6 +34,7 @@ import { useEnterAnimation } from '@/lib/use-enter-animation'import { cn } from '@/lib/utils'import { $reasoningCollapsedByDefault, $showReasoning } from '@/store/reasoning-disclosure'import { useForcedTextDirection } from '@/store/text-direction'+import { $showToolActivity } from '@/store/tool-activity'type TimelineToolCallProps = ToolCallMessagePartProps & { completedAt?: number; timestamp?: number }@@ -80,7 +81,7 @@ const DelegateToolPart: FC<TimelineToolCallProps> = props => {// failure inside `result`, never as the top-level error that sets isError, so// this reads the body like the run summary does. A non-zero exit_code counts// too, matching the gateway's _tool_result_needs_user, which forwards terminal-// {output, exit_code: 1, error: null} in answer-only mode.+// {output, exit_code: 1, error: null} even with display.tool_progress off.const failedCallNeedsUser = (part: TimelineToolCallProps): boolean => {const exitCode = parseMaybeObject(part.result).exit_code@@ -88,7 +89,7 @@ const failedCallNeedsUser = (part: TimelineToolCallProps): boolean => {}const ChainToolFallback: FC<TimelineToolCallProps> = props => {- const showReasoning = useStore($showReasoning)+ const showToolActivity = useStore($showToolActivity)// todo parts are hoisted to a dedicated panel above the message content.if (isTodoToolName(props.toolName)) {@@ -154,10 +155,10 @@ const ChainToolFallback: FC<TimelineToolCallProps> = props => {return <ConnectorExecution {...props} />}- // Answer-only: process chrome (reads, searches, commands) stays off the- // transcript. Cards, approvals, and failed calls the user must act on remain.- // reasoning_effort is not a display switch.- if (!showReasoning && !failedCallNeedsUser(props) && !isCardTool(props.toolName)) {+ // The tool feed (reads, searches, commands) follows display.tool_progress,+ // never show_reasoning. Cards, approvals, and failed calls the user must act+ // on remain regardless.+ if (!showToolActivity && !failedCallNeedsUser(props) && !isCardTool(props.toolName)) {return null}diff --git a/apps/desktop/src/components/assistant-ui/tool/approval.tsx b/apps/desktop/src/components/assistant-ui/tool/approval.tsxindex 5fafa4af148..51b053f1b3a 100644--- a/apps/desktop/src/components/assistant-ui/tool/approval.tsx+++ b/apps/desktop/src/components/assistant-ui/tool/approval.tsx@@ -35,7 +35,7 @@ import {sessionApprovalRequests,sessionApprovalStackSize} from '@/store/prompts'-import { $showReasoning } from '@/store/reasoning-disclosure'+import { $showToolActivity } from '@/store/tool-activity'import { setToolDisclosureOpen } from '@/store/tool-view'import { isApprovalActivity } from './approval-activity'@@ -79,7 +79,7 @@ export const PendingApprovalStack: FC = () => {function ApprovalActivity({ floating, visible }: { floating: boolean; visible: boolean }) {const { t } = useI18n()const reduced = useReducedMotion()- const showReasoning = useStore($showReasoning)+ const showToolActivity = useStore($showToolActivity)const summary = useAuiState(state => {if (!visible) {@@ -120,9 +120,9 @@ function ApprovalActivity({ floating, visible }: { floating: boolean; visible: b.join('\n')})- // The pending approval stays. The run summary beside it is process chrome- // and follows the same display flag as reasoning blocks.- if (!showReasoning) {+ // The pending approval stays. The run summary beside it is tool feed and+ // follows display.tool_progress alongside the other process rows.+ if (!showToolActivity) {return null}diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback.tsx b/apps/desktop/src/components/assistant-ui/tool/fallback.tsxindex ab30d1a7a92..988c4a6555d 100644--- a/apps/desktop/src/components/assistant-ui/tool/fallback.tsx+++ b/apps/desktop/src/components/assistant-ui/tool/fallback.tsx@@ -50,7 +50,7 @@ import { useEnterAnimation } from '@/lib/use-enter-animation'import { cn } from '@/lib/utils'import { recordPreviewArtifact } from '@/store/preview-status'import { sessionApprovalRequest } from '@/store/prompts'-import { $showReasoning } from '@/store/reasoning-disclosure'+import { $showToolActivity } from '@/store/tool-activity'import { $toolInlineDiff } from '@/store/tool-diffs'import { $toolRowDismissed, dismissToolRow } from '@/store/tool-dismiss'import {@@ -1045,7 +1045,7 @@ export const ToolGroupSlot: FC<PropsWithChildren<{ endIndex: number; startIndex:endIndex,startIndex}) => {- const showReasoning = useStore($showReasoning)+ const showToolActivity = useStore($showToolActivity)// Joined rather than returned as an array: assistant-ui compares selector// results with `Object.is` and re-runs them on every store update, so a@@ -1067,10 +1067,10 @@ export const ToolGroupSlot: FC<PropsWithChildren<{ endIndex: number; startIndex:const items = useMemo(() => splitRunItems(toolNameKey.split('\u0000')), [toolNameKey])const rows = Children.toArray(children)- // Answer-only skips the run scaffold ("Explored N files"). Children still- // mount so clarify, diffs, and failed calls can render on their own.- // reasoning_effort is not a display switch.- if (!showReasoning) {+ // The run scaffold ("Explored N files") is part of the tool feed and follows+ // display.tool_progress. Children still mount so clarify, diffs, and failed+ // calls can render on their own.+ if (!showToolActivity) {return children}diff --git a/apps/desktop/src/components/assistant-ui/tool/answer-only-chrome.test.tsx b/apps/desktop/src/components/assistant-ui/tool/tool-feed-chrome.test.tsxsimilarity index 72%rename from apps/desktop/src/components/assistant-ui/tool/answer-only-chrome.test.tsxrename to apps/desktop/src/components/assistant-ui/tool/tool-feed-chrome.test.tsxindex ae2570ca448..6adda3de6b5 100644--- a/apps/desktop/src/components/assistant-ui/tool/answer-only-chrome.test.tsx+++ b/apps/desktop/src/components/assistant-ui/tool/tool-feed-chrome.test.tsx@@ -8,8 +8,9 @@ import { stubThreadEnvironment, stubThreadViewportSize, ThreadRuntime } from '@/import { Thread } from '@/components/assistant-ui/thread'import { toRuntimeMessage } from '@/lib/chat-runtime'import { clearAllPrompts, setApprovalRequest } from '@/store/prompts'-import { $showReasoning } from '@/store/reasoning-disclosure'+import { setShowReasoningFromConfig } from '@/store/reasoning-disclosure'import { $activeSessionId } from '@/store/session'+import { setShowToolActivityFromConfig } from '@/store/tool-activity'stubThreadEnvironment()stubThreadViewportSize()@@ -79,8 +80,8 @@ function Harness() {}// Drive the gateway's own tool.complete event through the message stream (the-// store Desktop renders from), then render what it produced. Answer-only-// suppresses tool.start, so the completion arrives on its own, and its failure+// store Desktop renders from), then render what it produced. With+// display.tool_progress off the gateway suppresses tool.start, so the completion arrives on its own, and its failure// sits inside `result`: nothing hand-sets isError on the part.function completionHarness(payload: Record<string, unknown>) {const stream = renderMessageStream(SID)@@ -102,19 +103,22 @@ function completionHarness(payload: Record<string, unknown>) {beforeEach(() => {clearAllPrompts()$activeSessionId.set(SID)- $showReasoning.set(true)+ setShowReasoningFromConfig(true)+ setShowToolActivityFromConfig(undefined)})afterEach(() => {cleanup()clearAllPrompts()$activeSessionId.set(null)- $showReasoning.set(true)+ setShowReasoningFromConfig(true)+ setShowToolActivityFromConfig(undefined)})-describe('answer-only display policy', () => {- it('hides reasoning and non-essential tool chrome without requiring reasoning_effort none', async () => {- $showReasoning.set(false)+describe('tool feed visibility policy', () => {+ it('answer-only (both switches off) hides reasoning and non-essential tool chrome', async () => {+ setShowReasoningFromConfig(false)+ setShowToolActivityFromConfig('off')setApprovalRequest({ command: 'rm -rf /tmp/x', description: 'dangerous command', sessionId: SID })const { container } = render(<Harness />)@@ -126,6 +130,21 @@ describe('answer-only display policy', () => {expect(container.querySelectorAll('[data-tool-row]')).toHaveLength(1)})+ it('keeps the execution flow while reasoning stays hidden', async () => {+ // Regression for #121524: hiding reasoning hid every tool row. A missing+ // display.tool_progress means on, whatever show_reasoning says.+ setShowReasoningFromConfig(false)++ const { container } = render(<Harness />)++ expect(await screen.findByText('final answer only')).toBeTruthy()+ expect(container.querySelector('[data-slot="aui_thinking-disclosure"]')).toBeNull()+ expect(await screen.findByText(/Explored 2 files/)).toBeTruthy()+ // The run scaffold is the visible flow here; the suppressed case above pins+ // its absence via the same marker.+ expect(container.querySelector('[data-tool-summary]')).not.toBeNull()+ })+it('still shows tool chrome when reasoning blocks are on', async () => {const { container } = render(<Harness />)@@ -133,10 +152,21 @@ describe('answer-only display policy', () => {expect(container.querySelector('[data-slot="aui_thinking-disclosure"]')).not.toBeNull()})+ it('silences the feed on an explicit off while reasoning blocks stay on', async () => {+ setShowToolActivityFromConfig('off')++ const { container } = render(<Harness />)++ expect(await screen.findByText('final answer only')).toBeTruthy()+ expect(container.querySelector('[data-slot="aui_thinking-disclosure"]')).not.toBeNull()+ expect(container.querySelectorAll('[data-tool-row]')).toHaveLength(1)+ })+it('keeps a failed call whose error sits inside result, from a real tool.complete payload', async () => {// The gateway's tool.complete never sets a top-level error: a read_file- // failure rides inside result. The answer-only gate must still show it.- $showReasoning.set(false)+ // failure rides inside result. The tool-feed gate must still show it.+ setShowReasoningFromConfig(false)+ setShowToolActivityFromConfig('off')const { container } = render(completionHarness({@@ -153,7 +183,8 @@ describe('answer-only display policy', () => {})it('keeps a failed terminal call with a non-zero exit_code, from a real tool.complete payload', async () => {- $showReasoning.set(false)+ setShowReasoningFromConfig(false)+ setShowToolActivityFromConfig('off')const { container } = render(completionHarness({@@ -169,7 +200,8 @@ describe('answer-only display policy', () => {})it('keeps a call that reports success: false, from a real tool.complete payload', async () => {- $showReasoning.set(false)+ setShowReasoningFromConfig(false)+ setShowToolActivityFromConfig('off')const { container } = render(completionHarness({@@ -186,7 +218,8 @@ describe('answer-only display policy', () => {})it('still hides a successful call driven through the same tool.complete mapping', async () => {- $showReasoning.set(false)+ setShowReasoningFromConfig(false)+ setShowToolActivityFromConfig('off')const { container } = render(completionHarness({diff --git a/apps/desktop/src/store/tool-activity.test.ts b/apps/desktop/src/store/tool-activity.test.tsnew file mode 100644index 00000000000..1b32299bb0d--- /dev/null+++ b/apps/desktop/src/store/tool-activity.test.ts@@ -0,0 +1,31 @@+import { beforeEach, describe, expect, it } from 'vitest'++import { setShowReasoningFromConfig } from '@/store/reasoning-disclosure'+import { $showToolActivity, setShowToolActivityFromConfig, toolProgressVisible } from '@/store/tool-activity'++describe('tool feed visibility follows display.tool_progress only', () => {+ beforeEach(() => {+ setShowReasoningFromConfig(true)+ setShowToolActivityFromConfig(undefined)+ })++ it('silences the feed only for false or "off"', () => {+ for (const off of [false, 'off', ' OFF ']) {+ expect(toolProgressVisible(off)).toBe(false)+ }++ for (const on of [true, 'all', 'new', 'verbose', 'unknown', undefined, null]) {+ expect(toolProgressVisible(on)).toBe(true)+ }+ })++ it('does not follow show_reasoning', () => {+ setShowReasoningFromConfig(false)+ setShowToolActivityFromConfig(undefined)+ expect($showToolActivity.get()).toBe(true)++ setShowReasoningFromConfig(true)+ setShowToolActivityFromConfig('off')+ expect($showToolActivity.get()).toBe(false)+ })+})diff --git a/apps/desktop/src/store/tool-activity.ts b/apps/desktop/src/store/tool-activity.tsnew file mode 100644index 00000000000..6da0836bda4--- /dev/null+++ b/apps/desktop/src/store/tool-activity.ts@@ -0,0 +1,20 @@+import { atom } from 'nanostores'++// Mirrors `display.tool_progress`, independent of `display.show_reasoning`:+// hiding thinking must not hide the work. Answer-only is both keys off.+// Parsing matches the gateway's `_load_tool_progress_mode` so the renderer and+// the event stream agree: only false / "off" silence tool rows; every other+// mode (all, new, verbose, unknown, missing) keeps them on.+export const $showToolActivity = atom(true)++export function toolProgressVisible(value: unknown): boolean {+ if (typeof value === 'boolean') {+ return value+ }++ return !(typeof value === 'string' && value.trim().toLowerCase() === 'off')+}++export function setShowToolActivityFromConfig(value: unknown): void {+ $showToolActivity.set(toolProgressVisible(value))+}diff --git a/apps/desktop/src/types/hermes.ts b/apps/desktop/src/types/hermes.tsindex f90a74b9208..e09062dd390 100644--- a/apps/desktop/src/types/hermes.ts+++ b/apps/desktop/src/types/hermes.ts@@ -467,6 +467,7 @@ export interface HermesConfig {skin?: stringinterim_assistant_messages?: booleantimestamps?: boolean+ tool_progress?: boolean | string}desktop?: {font_family?: stringdiff --git a/cli-config.yaml.example b/cli-config.yaml.exampleindex bf4ea78b9b9..d1a94ae27ce 100644--- a/cli-config.yaml.example+++ b/cli-config.yaml.example@@ -1824,13 +1824,16 @@ display:# false: Full ASCII banner with tool/skill summary (default)compact: false- # Tool progress display level (CLI and gateway)+ # Tool progress display level (CLI, gateway, and the TUI/Desktop tool feed)# off: Silent — no tool activity shown, just the final response# new: Show a tool indicator only when the tool changes (skip repeats)# all: Show every tool call with a short preview (default)# verbose: Full args, results, and debug logs (same as /verbose)# log: Silent in chat; append every tool call to ~/.hermes/logs/tool_calls.log (gateway only)# Toggle at runtime with /verbose in the CLI+ # Independent of show_reasoning: hiding reasoning never hides tool rows.+ # Answer-only (just the final response) is show_reasoning: false plus+ # tool_progress: off.# tool_progress: all# tool_progress, interim_assistant_messages, long_running_notifications,diff --git a/contributors/emails/[email protected] b/contributors/emails/[email protected]new file mode 100644index 00000000000..8e13d8f35fd--- /dev/null+++ b/contributors/emails/[email protected]@@ -0,0 +1,2 @@+wyf9661+# PR #125948 salvagediff --git a/tests/tui_gateway/test_show_reasoning_display_gate.py b/tests/tui_gateway/test_show_reasoning_display_gate.pyindex 8c7b635f84c..de0a706fe83 100644--- a/tests/tui_gateway/test_show_reasoning_display_gate.py+++ b/tests/tui_gateway/test_show_reasoning_display_gate.py@@ -1,7 +1,9 @@-"""display.show_reasoning false is answer-only on the live callback path.+"""Display gates on the live callback path.-The session flag, not reasoning_effort, decides whether reasoning/thinking-deltas and non-essential tool chrome leave the gateway.+display.show_reasoning decides whether reasoning leaves the gateway.+display.tool_progress decides whether non-essential tool rows leave it.+The two are independent; answer-only is both off. reasoning_effort is not a+display switch. Regression for #121524, which tied tool rows to show_reasoning."""import json@@ -9,6 +11,8 @@ import refrom pathlib import Pathfrom types import SimpleNamespace+import pytest+from tui_gateway import server@@ -20,13 +24,13 @@ def _capture(monkeypatch):return events-def _session(monkeypatch, sid, *, show_reasoning, effort="high"):+def _session(monkeypatch, sid, *, show_reasoning, effort="high", tool_progress="all"):monkeypatch.setitem(server._sessions,sid,{"show_reasoning": show_reasoning,- "tool_progress_mode": "all",+ "tool_progress_mode": tool_progress,"tool_started_at": {},"edit_snapshots": {},"agent": SimpleNamespace(reasoning_config={"enabled": True, "effort": effort}),@@ -34,9 +38,10 @@ def _session(monkeypatch, sid, *, show_reasoning, effort="high"):)-def test_hidden_reasoning_does_not_emit_reasoning_deltas(monkeypatch):[email protected]("tool_progress", ["all", "off"])+def test_hidden_reasoning_does_not_emit_reasoning_deltas(monkeypatch, tool_progress):events = _capture(monkeypatch)- _session(monkeypatch, "hide-deltas", show_reasoning=False, effort="high")+ _session(monkeypatch, "hide-deltas", show_reasoning=False, effort="high", tool_progress=tool_progress)callbacks = server._agent_cbs("hide-deltas")callbacks["reasoning_callback"]("chain of thought from any provider")@@ -80,40 +85,82 @@ def test_hidden_reasoning_drops_completed_reasoning_block(monkeypatch):assert events == []-def test_hidden_reasoning_suppresses_nonessential_tool_chrome_without_effort_none(monkeypatch):- events = _capture(monkeypatch)- _session(monkeypatch, "hide-tools", show_reasoning=False, effort="high")-- server._on_tool_start("hide-tools", "tool-read", "read_file", {"path": "README.md"})- server._on_tool_complete("hide-tools", "tool-read", "read_file", {"path": "README.md"}, "contents")- server._agent_cbs("hide-tools")["tool_gen_callback"]("terminal")+def _emit_ordinary_and_essential_tools(sid):+ server._on_tool_start(sid, "tool-read", "read_file", {"path": "README.md"})+ server._on_tool_complete(sid, "tool-read", "read_file", {"path": "README.md"}, "contents")+ server._agent_cbs(sid)["tool_gen_callback"]("terminal")clarify_args = {"question": "Pick one", "choices": ["A", "B"]}- server._on_tool_start("hide-tools", "tool-clarify", "clarify", clarify_args)- server._on_tool_complete(- "hide-tools",- "tool-clarify",- "clarify",- clarify_args,- json.dumps({"question": "Pick one", "user_response": "A"}),- )+ server._on_tool_start(sid, "tool-clarify", "clarify", clarify_args)server._on_tool_complete(- "hide-tools",- "tool-fail",- "terminal",- {"command": "deploy"},- json.dumps({"error": "disk full"}),+ sid, "tool-clarify", "clarify", clarify_args, json.dumps({"question": "Pick one", "user_response": "A"}))+ server._on_tool_complete(sid, "tool-fail", "terminal", {"command": "deploy"}, json.dumps({"error": "disk full"}))+- kinds = [event[0] for event in events]- assert "tool.generating" not in kinds- assert not any(event[2].get("name") == "read_file" for event in events)- assert [event[0] for event in events if event[2].get("name") == "clarify"] == ["tool.start", "tool.complete"]+def _lifecycle(events, tool_id):+ return [event[0] for event in events if (event[2] or {}).get("tool_id") == tool_id]+++def test_hidden_reasoning_keeps_tool_rows_when_tool_progress_is_on(monkeypatch):+ events = _capture(monkeypatch)+ _session(monkeypatch, "hide-reasoning", show_reasoning=False, tool_progress="all")++ _emit_ordinary_and_essential_tools("hide-reasoning")++ assert _lifecycle(events, "tool-read") == ["tool.start", "tool.complete"]+ assert "tool.generating" in [event[0] for event in events]+++def test_tool_progress_off_keeps_only_essential_tool_rows(monkeypatch):+ events = _capture(monkeypatch)+ _session(monkeypatch, "tools-off", show_reasoning=True, tool_progress="off")++ _emit_ordinary_and_essential_tools("tools-off")++ assert _lifecycle(events, "tool-read") == []+ assert "tool.generating" not in [event[0] for event in events]+ assert _lifecycle(events, "tool-clarify") == ["tool.start", "tool.complete"]failed = [event for event in events if event[2].get("tool_id") == "tool-fail"]assert [event[0] for event in failed] == ["tool.complete"]assert failed[0][2]["result"]["error"] == "disk full"+def test_subagent_tool_mirror_follows_tool_progress_not_reasoning(monkeypatch):+ for sid, show_reasoning, tool_progress, expected in (+ ("child-reasoning-off", False, "all", ["tool.start", "tool.complete"]),+ ("child-tools-off", True, "off", []),+ ):+ events = _capture(monkeypatch)+ _session(monkeypatch, sid, show_reasoning=show_reasoning, tool_progress=tool_progress)+ session = server._sessions[sid]+ session["agent"] = None # a watch window, not a full agent: the mirror only feeds those+ monkeypatch.setattr(server, "_find_live_session_by_key", lambda key, _home, sid=sid, session=session: (sid, session))++ server._mirror_subagent_to_child(+ "subagent.tool", {"child_session_id": f"key-{sid}", "tool_name": "read_file", "tool_preview": "x"}, None+ )+ server._mirror_subagent_to_child("subagent.complete", {"child_session_id": f"key-{sid}"}, None)++ assert [event[0] for event in events if event[0].startswith("tool.")] == expected, sid+++def test_tool_progress_off_keeps_reasoning_blocks(monkeypatch):+ events = _capture(monkeypatch)+ _session(monkeypatch, "tools-off-reasoning-on", show_reasoning=True, tool_progress="off")++ server._on_tool_progress("tools-off-reasoning-on", "reasoning.available", "_thinking", "finished thought", None)+ server._on_tool_progress(+ "tools-off-reasoning-on", "moa.reference", "reference-a", "other model's thoughts", None+ )+ server._on_tool_progress(+ "tools-off-reasoning-on", "tool.output_risk", "terminal", None, None,+ tool_call_id="t1", risk_metadata={"risk": "high", "findings": ["secret"]},+ )++ assert [event[0] for event in events] == ["reasoning.available", "moa.reference"]++def test_hidden_reasoning_drops_moa_reference_chrome(monkeypatch):events = _capture(monkeypatch)_session(monkeypatch, "hide-moa", show_reasoning=False, effort="high")@@ -177,7 +224,7 @@ def test_shown_reasoning_keeps_subagent_thinking_text(monkeypatch):assert events[0][2]["text"] == "the child's visible thought"-def test_hidden_reasoning_keeps_card_tool_lifecycle(monkeypatch):+def test_tool_progress_off_keeps_card_tool_lifecycle(monkeypatch):"""Card tools are the turn's deliverable, not chrome.Desktop's answer-only gate (`message-parts.tsx`) keeps card tools visible via@@ -188,7 +235,7 @@ def test_hidden_reasoning_keeps_card_tool_lifecycle(monkeypatch):call's `tool.complete`."""events = _capture(monkeypatch)- _session(monkeypatch, "hide-cards", show_reasoning=False, effort="high")+ _session(monkeypatch, "hide-cards", show_reasoning=False, tool_progress="off")cases = {"tool-image": ("image_generate", {"prompt": "a cat"}),@@ -204,7 +251,7 @@ def test_hidden_reasoning_keeps_card_tool_lifecycle(monkeypatch):assert lifecycle == ["tool.start", "tool.complete"], tool_id-def test_hidden_reasoning_keeps_file_edit_lifecycle_pair(monkeypatch):+def test_tool_progress_off_keeps_file_edit_lifecycle_pair(monkeypatch):"""A file edit is a diff card (`isFileEditTool`): answer-only keeps it visible.The complete-side guard admits edits through `inline_diff`; without the same@@ -212,7 +259,7 @@ def test_hidden_reasoning_keeps_file_edit_lifecycle_pair(monkeypatch):consumer got a `tool.complete` it never saw a `tool.start` for."""events = _capture(monkeypatch)- _session(monkeypatch, "hide-edit", show_reasoning=False, effort="high")+ _session(monkeypatch, "hide-edit", show_reasoning=False, tool_progress="off")def fake_edit_diff(tool_name, result, *, function_args=None, snapshot=None, print_fn=None):if print_fn is not None:@@ -259,9 +306,9 @@ def test_gateway_lifecycle_set_covers_desktop_card_tools():assert desktop_cards <= set(server._TOOL_LIFECYCLE_UI_TOOLS)-def test_hidden_reasoning_shows_failed_terminal_exit_code(monkeypatch):+def test_tool_progress_off_shows_failed_terminal_exit_code(monkeypatch):events = _capture(monkeypatch)- _session(monkeypatch, "hide-exit", show_reasoning=False, effort="high")+ _session(monkeypatch, "hide-exit", show_reasoning=False, tool_progress="off")server._on_tool_complete("hide-exit",@@ -276,9 +323,9 @@ def test_hidden_reasoning_shows_failed_terminal_exit_code(monkeypatch):assert failed[0][2]["result"]["exit_code"] == 1-def test_hidden_reasoning_hides_successful_terminal_exit(monkeypatch):+def test_tool_progress_off_hides_successful_terminal_exit(monkeypatch):events = _capture(monkeypatch)- _session(monkeypatch, "hide-exit-ok", show_reasoning=False, effort="high")+ _session(monkeypatch, "hide-exit-ok", show_reasoning=False, tool_progress="off")server._on_tool_complete("hide-exit-ok",diff --git a/tests/tui_gateway/test_todo_state_events.py b/tests/tui_gateway/test_todo_state_events.pyindex 58458b4cb49..2581a9855cc 100644--- a/tests/tui_gateway/test_todo_state_events.py+++ b/tests/tui_gateway/test_todo_state_events.py@@ -203,6 +203,11 @@ def test_subagent_lifecycle_bypasses_tool_progress_off(monkeypatch):monkeypatch.setattr(server, "_emit", lambda event, event_sid, payload=None: events.append(event))server._on_tool_progress(sid, "subagent.start", "delegate_task", "goal", None, goal="goal", subagent_id="s1")- server._on_tool_progress(sid, "reasoning.available", "_thinking", "hmm", None)+ # tool.output_risk is tool chrome, so tool_progress=off drops it. (reasoning.available is+ # not a control here: reasoning follows display.show_reasoning, never tool_progress.)+ server._on_tool_progress(+ sid, "tool.output_risk", "terminal", None, None,+ tool_call_id="t1", risk_metadata={"risk": "high", "findings": []},+ )assert events == ["subagent.start"]diff --git a/tui_gateway/agent_callbacks.py b/tui_gateway/agent_callbacks.pyindex 994871da381..22bc45a1a2f 100644--- a/tui_gateway/agent_callbacks.py+++ b/tui_gateway/agent_callbacks.py@@ -73,7 +73,7 @@ def _mirror_subagent_to_child(event_type: str, payload: dict, profile_home) -> Nif st["open_tool"]:open_tool = st["open_tool"]st["open_tool"] = None- if _process_tool_chrome_enabled(csid) or _tool_lifecycle_required_for_ui(str(open_tool.get("name") or "")):+ if _tool_progress_enabled(csid) or _tool_lifecycle_required_for_ui(str(open_tool.get("name") or "")):_emit("tool.complete", csid, open_tool)if event_type == "subagent.tool":st["seq"] += 1@@ -82,7 +82,7 @@ def _mirror_subagent_to_child(event_type: str, payload: dict, profile_home) -> N"tool_id": f"submirror:{child_key}:{st['seq']}", "args": {}}if preview := str(payload.get("tool_preview") or payload.get("text") or ""):tool["preview"] = preview- if not _process_tool_chrome_enabled(csid) and not _tool_lifecycle_required_for_ui(tool_name):+ if not _tool_progress_enabled(csid) and not _tool_lifecycle_required_for_ui(tool_name):returnst["open_tool"] = tool_emit("tool.start", csid, tool)@@ -153,7 +153,7 @@ def _agent_cbs(sid: str) -> dict:sid, tc_id, name, args, result),"tool_progress_callback": lambda event_type, name=None, preview=None, args=None, **kwargs: _on_tool_progress(sid, event_type, name, preview, args, **kwargs),- "tool_gen_callback": lambda name: _process_tool_chrome_enabled(sid) and _emit("tool.generating", sid, {"name": name}),+ "tool_gen_callback": lambda name: _tool_progress_enabled(sid) and _emit("tool.generating", sid, {"name": name}),"thinking_callback": lambda text: _agent_thinking_update(sid, text),# Affection reaction (ily / <3 / good bot) → hearts; core-detected so TUI/desktop share it."reaction_callback": lambda kind: _emit("reaction", sid, {"kind": kind}),diff --git a/tui_gateway/server.py b/tui_gateway/server.pyindex 9b879712127..ec5e223d250 100644--- a/tui_gateway/server.py+++ b/tui_gateway/server.py@@ -2008,16 +2008,11 @@ def _session_show_reasoning(sid: str) -> bool:return _load_show_reasoning()-def _process_tool_chrome_enabled(sid: str) -> bool:- """Non-essential tool rows follow display.show_reasoning, not reasoning_effort."""- return _session_show_reasoning(sid) and _tool_progress_enabled(sid)--def _tool_progress_enabled(sid: str) -> bool:return _session_tool_progress_mode(sid) != "off"-# Names whose lifecycle a UI renders as a card even in answer-only mode. `isCardTool` /+# Names whose lifecycle a UI renders as a card even with display.tool_progress off. `isCardTool` /# `isFileEditTool` in apps/desktop/src/lib/tool-render-class.ts must stay in sync with this# set (test_gateway_lifecycle_set_covers_desktop_card_tools pins the direction that matters)._TOOL_LIFECYCLE_UI_TOOLS = frozenset({diff --git a/tui_gateway/tool_progress.py b/tui_gateway/tool_progress.pyindex a1abdb3c21d..5e0f5be62c1 100644--- a/tui_gateway/tool_progress.py+++ b/tui_gateway/tool_progress.py@@ -288,7 +288,7 @@ def _on_tool_start(sid: str, tool_call_id: str, name: str, args: dict):# A preview prepared for an earlier call whose completion never fired (failed# flush) must not attach to a provider that reuses the same call id.session.setdefault("tool_result_metadata", {}).pop(tool_call_id, None)- if (_process_tool_chrome_enabled(sid) or _tool_lifecycle_required_for_ui(name)+ if (_tool_progress_enabled(sid) or _tool_lifecycle_required_for_ui(name)or _connector_tool_lifecycle(name, args)):payload: dict[str, object] = {"tool_id": tool_call_id, "name": name, "context": _tool_ctx(name, args)}if (labels := _tool_labels(name, args)) is not None:@@ -356,7 +356,7 @@ def _on_tool_complete(sid: str, tool_call_id: str, name: str, args: dict, resultpayload.update(todo_state)if session is not None:_cache_todo_state(session, todo_state)- if (_process_tool_chrome_enabled(sid) or payload.get("inline_diff") or _tool_lifecycle_required_for_ui(name)+ if (_tool_progress_enabled(sid) or payload.get("inline_diff") or _tool_lifecycle_required_for_ui(name)or is_todo_tool_name(name) or _connector_tool_lifecycle(name, args)or _tool_result_needs_user(result)):_emit_tool_lifecycle("tool.complete", sid, name, args, payload)@@ -371,8 +371,9 @@ def _on_tool_complete(sid: str, tool_call_id: str, name: str, args: dict, result# the stable id and args; an id-less duplicate row makes the desktop live view diverge from history.def _progress_output_risk(sid, name, preview, kw):+ # A risk badge on a tool row: tool chrome, so it follows display.tool_progress.metadata = kw.get("risk_metadata")- if isinstance(metadata, dict):+ if isinstance(metadata, dict) and _tool_progress_enabled(sid):_emit("tool.output_risk", sid, {"tool_id": str(kw.get("tool_call_id") or ""), "name": str(name), "risk": str(metadata.get("risk") or "low"),"findings": [str(item) for item in metadata.get("findings", [])], "redacted": bool(metadata.get("redacted", False)),@@ -498,8 +499,8 @@ def _on_tool_progress(# tool-progress chrome: it must survive display.tool_progress=off like todo.updated does.if event_type.startswith("subagent."):return _progress_subagent(sid, name, preview, _kwargs, event_type)- if not _tool_progress_enabled(sid):- return+ # No blanket tool_progress gate here: reasoning.available and moa.* are reasoning+ # content that follow display.show_reasoning in their own handlers.handler, requires = _PROGRESS_HANDLERS.get(event_type, (None, None))if handler is not None and (requires is None or {"name": name, "preview": preview}[requires]):handler(sid, name, preview, _kwargs)