Repository navigation
Preserve route_clarify's structured question/options through to the UI - #1944
Conversation
closes #1930) route_clarify's question/options were flattened into markdown prose before reaching the frontend, so a designed HITL clarification looked identical to any other assistant reply. Carry the structured ClarifyPrompt through AgentTurnResult, persist it on AiChatMessage alongside the flattened text, and render it in chat-message.svelte as clickable option chips instead of markdown bullets. Ordinary zero-tool-call replies that merely phrase themselves as a question are explicitly out of scope — documented in code as a model-capability question for #1922/#1927, not a rendering gap here. Co-Authored-By: Claude <[email protected]>
Code Review SummaryThis PR closes a real, well-scoped gap: Independently verified against the two closed issues this PR cites as out-of-scope: #1922 was in fact a Stage-2 zero-tool-call reply caused by an empty Overall this is a net positive, atomic, low-risk change with good test coverage on both sides of the stack. A few real gaps and one meaningful nit below, none of which should block merge, but two are worth a follow-up. Requirements Check (issue #1930)
All four acceptance criteria are met. FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
Testing AssessmentCoverage is solid and appropriately targeted:
No missing coverage identified for the new code paths. Security / Performance / Dependencies
Type Parity CheckBackend/frontend field parity is correct and consistent across all four locations:
No mismatch found. RecommendationApprove. This is a net positive, correctly scoped, well-tested change. The out-of-scope reasoning for #1922/#1927 is verified accurate and the code comment documenting it is defensible. The two Suggested Improvements (dropped clarification-opener framing text, and the |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval/changes on own PR). Full findings in the review comment above.
…bled logic - chat-message.svelte: render content minus the bullet list (not the bare question field) as the clarify header text, so the backend's "I can take that a couple of ways..." framing survives alongside the chips instead of being dropped. - Simplify each option button's disabled condition to the two booleans that actually gate it (isLatest, onSelectOption) instead of re-deriving through an intermediate clarifyOptions array. - Test: assert the opener sentence renders and the raw bullet list does not (chips are the only representation of the options). Skipped per reviewer's own assessment (not made worse by this PR, both correctly flagged as pre-existing/low-risk rather than blocking): - session_already_clarified's string-prefix matching — recommend a fast-follow once more of the codebase migrates off the flattened string, but out of scope for this PR's fix. - No read-time consistency check between content/question/options — single write site today (append_assistant_message), so there is nothing to drift yet; premature to add invariant-checking now. Addresses reviewer recommendations from PR #1944 review. Co-Authored-By: Claude <[email protected]>
Addressed review feedback✅ Addressed:
⏭️ Skipped (both correctly flagged by the reviewer as pre-existing / not worsened by this PR):
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The changes are a small, low-risk, non-architectural follow-up — a text-derivation tweak in one Svelte component, a boolean simplification, and a corresponding test assertion. No new logic paths, no backend changes, full test suite (172/4112 frontend, all touched Rust crates) still green, Ready for merge, pending final approval. |
Summary
route_clarify's structuredquestion/options(ADR-038's typed clarification tool) were flattened into markdown prose (format_clarification) before ever reaching the frontend, so a designed HITL clarification turn was indistinguishable from any ordinary assistant reply — no clickable options, no distinct UI state.AgentTurnResult(newClarifyPrompt { question, options }field) instead of only the flattened string.question/optionsonAiChatMessage(both Rust copies —coreandnodespace-types— and the TS mirror) alongside the existing flattenedcontent, so plain-text readers and the LLM-facing history scan (session_already_clarified) are unaffected.chat-message.svelterendersoptionsas clickable buttons instead of markdown bullets — only actionable on the latest message — wired to send the chosen option via the existing chat-input path.route_clarify— Scenario 6: entity-types block never reaches the prompt despite successful schema retrieval (dynamic_ctx_len=0 with count=1) #1922 was a Stage-2 zero-tool-call reply (unreachableresolve_queryguidance), update_node resolves the correct node but persists no properties on state-change requests (scenario 6 residual gap) #1927 a no-opupdate_nodecall — so this change does not affect those scenarios' outcomes.Test plan
ClarifyPromptround-trips throughrun_turn(agent_loop.rs), persists viaappend_assistant_messageand round-trips throughAiChatNode(local_agent_service.rs)bun run test: 172 files / 4112 tests passed (baseline: 171/4108, no regressions)cargo teston touched crates (core, nodespace-types, agent, daemon): all passing, 0 failuresbun run quality:fix: cleanCloses #1930
🤖 Generated with Claude Code