Repository navigation
Description
Overview
route_clarify (Stage-1's typed clarification tool, packages/agent/src/local_agent/routing.rs:75-97) produces structured question: string + options: Vec<String> data specifically so the UI has something concrete to render instead of a bare "what do you mean?" — per ADR-038's own stated rationale. That structure is discarded before it ever reaches the frontend.
What actually happens
agent_loop.rs:2014-2029 matches RouteDecision::Clarify and calls format_clarification(&question, &options) (agent_loop.rs:558), which flattens both fields into one markdown string — "{opener}. {question}\n\n- opt1\n- opt2..." — then pushes it as ChatMessage::text(Role::Assistant, clarification) (agent_loop.rs:815-824): the exact same shape used for every ordinary assistant reply. There is no reference to route_clarify/RouteDecision anywhere in packages/desktop-app (confirmed by grep) — the structured data simply never crosses the Rust/frontend boundary.
On the frontend, DisplayMessage (packages/desktop-app/src/lib/components/chat/types.ts:15-23) has only id, role, content: string, toolExecutions, timestamp, reasoning? — no clarify/options field. chat-message.svelte renders message.content through <ChatMarkdown> unconditionally, with no branch on message type/state beyond role. The markdown - bullets from format_clarification render as prose, not clickable options.
Consequence: this is true for route_clarify (a designed, structured HITL mechanism) and equally true for an ordinary Stage-2 zero-tool-call reply that happens to phrase itself as a question (the observed failure mode on agent-matrix scenarios 6/8c — see #1922, #1927, both closed/tracked as a model-capability limit where resolve_query is never called). Both collapse into indistinguishable plain assistant text. There is no "the agent is asking for input" UI state anywhere in the chat surface — no disabled/different input affordance, no clickable option chips, no visual marker distinguishing a completed answer from an open question.
Why it matters
route_clarifywas built and measured specifically to avoid a bare, unstructured "what do you mean?" (ADR-038's own evidence). Its structure is currently wasted — from the user's perspective, aroute_clarifyturn is indistinguishable from any other assistant reply.- Scenario 6/8c's zero-tool-call refusals (Scenario 6: entity-types block never reaches the prompt despite successful schema retrieval (dynamic_ctx_len=0 with count=1) #1922, update_node resolves the correct node but persists no properties on state-change requests (scenario 6 residual gap) #1927) are conversationally asking for something, but nothing marks the turn as such — a user could easily miss that the agent is waiting on them rather than just having replied.
- This is a real, scoped UX/product gap, independent of and more tractable than the model-capability question in Scenario 6: entity-types block never reaches the prompt despite successful schema retrieval (dynamic_ctx_len=0 with count=1) #1922/update_node resolves the correct node but persists no properties on state-change requests (scenario 6 residual gap) #1927 — it doesn't require the model to behave differently, only for the app to render what's already available (or could be) more usefully.
Proposed acceptance criteria
-
route_clarify'squestion/optionsare preserved as structured data through to the frontend (not flattened to a markdown string), via a dedicated field onChatMessage/DisplayMessageor a distinct message variant - The chat UI renders a clarify turn distinctly from an ordinary reply — at minimum,
optionsrender as clickable choices, not markdown bullet prose - Decide and document whether a plain zero-tool-call assistant reply (no
route_clarifyinvolved, e.g. Scenario 6: entity-types block never reaches the prompt despite successful schema retrieval (dynamic_ctx_len=0 with count=1) #1922/update_node resolves the correct node but persists no properties on state-change requests (scenario 6 residual gap) #1927's failure mode) should also get some lighter-weight "agent may be asking for input" treatment, or whether that's explicitly out of scope until/unless it's produced via a structured mechanism - No regression to existing chat message rendering for ordinary tool-call and plain-text turns
Reference Files
packages/agent/src/local_agent/routing.rs:75-97—RouteDecision::Clarify,route_clarifytool schemapackages/agent/src/local_agent/agent_loop.rs:558—format_clarification(the flattening point)packages/agent/src/local_agent/agent_loop.rs:2014-2029, 815-824— where the flattened string is pushed as an ordinaryChatMessagepackages/desktop-app/src/lib/components/chat/types.ts:15-23—DisplayMessageshape, no clarify/options fieldpackages/desktop-app/src/lib/components/chat/chat-message.svelte— renderscontentunconditionally via<ChatMarkdown>, no state branch beyondrole
Related Issues
- Scenario 6: entity-types block never reaches the prompt despite successful schema retrieval (dynamic_ctx_len=0 with count=1) #1922, update_node resolves the correct node but persists no properties on state-change requests (scenario 6 residual gap) #1927 — the specific failure pattern (zero-tool-call replies on indirect-reference requests) that surfaced this while investigating whether that failure at least "falls to" a structured clarification flow. It doesn't — and neither does the mechanism that was actually built for that purpose.
Activity
malibio commentedon Aug 3, 2026
Frontend baseline: 171 test files passed, 4108 tests passed.
Preserve route_clarify's structured question/options through to the UI (