Add interactive ask_user tool across TUI and Dashboard - #406
Add interactive ask_user tool across TUI and Dashboard#406maxscheurer wants to merge 10 commits into
Conversation
Implementation PlanProblem analysisdreb already has blocking user-input primitives and RPC/Dashboard transport, but built-in tools are wrapped without an extension context, so a native tool cannot currently reach The current TUI can host only one extension dialog at a time; concurrent requests overwrite the visible component and can orphan a promise. Following the latest maintainer discussion and re-assessment, this plan recommends strict FIFO, one-question-at-a-time behavior for the first release. The tabbed concurrent view and The Dashboard already marks any pending blocking extension-UI request as needing attention and already turns that state into fleet styling, a title badge, and a service-worker notification. Routing the new request through that pipeline should satisfy the notification requirement without parallel notification infrastructure. DeliverablesStage 1 — UX prototype and sign-off
Stage 2 — Runtime and surface wiring
Acceptance criteria
Files to create or modifyCore tool and session wiring
TUI
RPC and Dashboard
Tests and documentation
Testing approach
Risks and open questions
Plan created by mach6 |
Progress Update — Stage 1 (UX prototype)Landed the development-only UX prototype for What's included
Maintainer feedback addressed
Scope noteThis follows the latest re-assessment: strict one-question-at-a-time for the first release. The tabbed concurrent view and Screenshots of the updated single-choice and answered states are attached below (drag-drop from local run; not committed as repo binaries). Verification
Commit: Progress tracked by mach6 |
Progress Update — Stage 2 (runtime wiring)
Core (coding-agent)
TUI
RPC + Dashboard
Tests & docs
Scope noteStrict one-question-at-a-time per the accepted re-assessment; no tabbed concurrent view and no Verification
Commit: Progress tracked by mach6 |
Availability: add ask_user to the default active-tool lists (agent-session runtime and sdk) so it no longer needs an explicit --tools flag, and create the ExtensionRunner unconditionally so the RPC-bound UI context reaches built-in tools (previously ctx.ui.ask was a no-op without third-party extensions). Restore a synchronous fast-path in _emitExtensionEvent via a new hasExtensions getter so the async event queue still drains agent_end before prompt() resolves. Dashboard UX: render the ask_user question inline at the end of the transcript instead of a blocking modal overlay, so the chat area stays scrollable while the agent waits. Dismiss the request optimistically on answer/skip (the response is fire-and-forget with no server acknowledgement event, so skip previously left the dialog stuck until the next agent_start). Tests: ask_user activation + UI context binding with no extensions; retry-test mock runners declare hasExtensions; store.resolveUiRequest optimistic dismiss; inline (non-modal) rendering assertions.
Progress Update — Dashboard fixesTwo issues surfaced while testing 1. Tool was unavailable in the Dashboard
2. Dashboard UX — popup to inline, and skip now dismisses
Tests
Full pre-commit suite green: 5128 passed / 708 skipped. Coding-agent (2765) and Dashboard (841) suites pass; build clean. Commit: Progress tracked by mach6 |
…inline card The ask_user tool call 'runs' for the whole time it awaits an answer, so it was force-opened (and un-collapsible) like other in-flight tools, showing a redundant options JSON dump. Exempt ask_user from force-open-while-running so its tool card stays collapsed by default and the user can expand/collapse it freely; the inline question card carries the actual UI. Recolor the inline question card's accent bar and tint from --status-running (green) to --status-attention (orange in the default theme) so it matches the session's needs-attention signal — an unanswered question is the primary your-move cue. (Needs-attention already fires for ask requests via uiRequests.) Test: ask_user tool card stays collapsed while running, while a running bash card auto-opens.
Progress Update — ask_user Dashboard polishTwo refinements from live testing: 1. Collapse the
|
Code ReviewCriticalNone. Important
Suggestions
Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Counts
Assessment by mach6 |
Progress Update — review fixes, batch 1Implemented assessed findings 1–3:
Verification
Commit: Findings 4–9 and 11 remain for subsequent batches. Progress tracked by mach6 |
Code Review (re-review pass, HEAD
|
Review Assessment (re-review pass)Each finding assessed against two gates — Factual (is it a real problem in the current code?) and Scope (must it be fixed to deliver the authoritative scope: TUI+Dashboard parity, needs-attention notification, strict FIFO, graceful resolution, lossless RPC, correct docs/tests). Classifications
Action Plan
Counts
Deferred tracking: No tracking issue exists yet. Findings 3, 5, 6, 7, 8 are valid optional follow-ups suited to a single consolidated "ask_user hardening" issue (timeout wiring, queued-abort test, host-failure logging, Dashboard Escape, RPC response validation). None block this PR. Assessment by mach6 |
Progress Update — review fixes, batch 2Implemented the three genuine findings from the latest assessment (findings 4, 1, 2). Deferred findings (3, 5, 6, 7, 8) and nitpicks (9, 10, 11) were intentionally left out of scope. Finding 4 — TUI single-select now preserves custom text (parity)
Finding 1 — RPC
|
Code ReviewCriticalNone. Important
Suggestions
Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Counts
Deferred tracking: No matching issue exists. Findings 5, 13, and 14 can be grouped into an optional Assessment by mach6 |
Progress Update — review fixes, recovery batchImplemented assessed findings 1–3:
Verification
The first unskipped full-suite attempt reached the external ChatGPT enterprise usage limit in live OpenAI Codex E2E tests; the repository-supported Commit: Remaining assessed findings will be handled in subsequent batches. Progress tracked by mach6 |
…own, and coverage Normalize the schema so a question is always answerable (free text when no options; drop meaningless multiSelect/multiline). Add an optional timeoutSeconds that auto-skips with a live countdown across surfaces. Add production Dashboard Escape-to-skip and a visible countdown. Fix a multiline TUI bug where Editor cleared its state before onSubmit, dropping the typed answer. Add tests for queued-abort, multiline editing, Dashboard retry state/dedup, and the server ask needs-attention branch.
Progress UpdateAddressed findings 4, 6, 7, 8, 9, 10, 11 from the latest review/assessment. Code fixes
Tests added
Build clean; full suite passes (5166 tests). Not addressed — finding 12 (process gate): this requires a recorded human maintainer Stage-1 approval or an explicit waiver on the PR before merge. It is not a code change and needs a maintainer's action here. Commit: Progress tracked by mach6 |
Code Review (round 4, HEAD
|
Review Assessment (round 4)Each finding assessed against two gates — Factual (a real problem in the current code at HEAD Classifications
Action PlanGenuine issues required before merge, in priority order:
Deferred (optional follow-up — not merge blockers)Findings 2 (no logging in the Counts
Assessment by mach6 |
Progress Update — review fixes, findings 4 & 5Implemented the two code-implementable genuine findings from the round-4 assessment. Finding 5 — drill-in
|
Addresses #396
Plan a first-class
ask_userexperience with TUI and Dashboard parity. The draft deliberately starts with a UX prototype/sign-off stage before wiring the tool into the runtime.The latest issue discussion recommends strict one-question-at-a-time behavior for the first release; the plan comment calls out the resulting scope decision for maintainer confirmation.
Implementation plan posted as a comment below.