Repository navigation
feat: add multiple-choice question handling in assistant UI - #639
Conversation
- Introduced AskQuestionCard component for displaying multiple-choice questions from agents. - Enhanced ToolFallback component to render AskQuestionCard when the tool call is of type `ask_user_question`. - Implemented parsing and extraction of ask questions from tool call inputs and comment blocks. - Added functionality to link mentions in comments to project members, allowing for structured team mentions. - Updated internationalization files to support new ask question features in multiple languages. - Added tests for ask question parsing and mention linking functionality.
There was a problem hiding this comment.
Important
The ask_user_question tool advertises document support, but answering a question posted on a document never resumes the agent — doc comments have no mention trigger. Details in the section below.
Reviewed changes — full pass over the 53-file diff (agent ask_user_question MCP tool, plain-text mention linking, question notifications, chat/comment question UI, tool-call input display, i18n).
ask_user_questionMCP tool (apps/mcp/src/tools/ask-tools.ts) — chat mode returns immediately and echoes apaca-askpayload in the tool result; withprojectId+taskId/docIdit posts apaca-askcomment and returns immediately.- Comment question card (
ask-question-card.tsx,activity-pane.tsx,ask-question.ts) — renders the embedded payload and posts the chosen answer as a reply that mentions the asking agent. - Chat question card (
tool-fallback.tsx,thread.tsx) — keeps the ask call outside the collapsible tool group; the answer is appended as the user's next message. - Plain-text mention linking (
services/api/.../activity/mentions.go,apps/mcp/.../converters.ts) — converts@username/@Name (id: …)text toteamMentionchips; the task activity service reads the stored content so linked agents trigger. - Question notifications (
question_notification_consumer.go, notification service/repo/DTO, migration000074) — newquestiontype, optionalproject_id, optionalconversation_id; the bell opens the conversation (global or project). - Tool-call input display (
conversation-to-thread-messages.ts,tool-args.ts) — ACPrawInputbecomesargsText; the header shows a one-line summary. - i18n — new
shared/appShellstrings in all 9 locales.
⚠️ Answering a question on a document never wakes the agent
ask_user_question documents a docId path ("pass projectId plus taskId (or docId): the question is posted as a comment there and the user's choice comes back as a reply comment that @-mentions you"), and ActivityPane will happily render the card and post the reply on a document. But doc comments have no mention trigger: only task/activity_service.go's AddComment calls handleMentions/TriggerCommentMention, while service/doc/activity_service.go's AddComment posts the comment and returns. So on a document the reply is recorded, the agent is never woken, and the question is effectively a dead end — the same symptom the task path avoids.
Technical details
# Doc-comment ask flow does not resume the agent
## Affected sites
- `apps/mcp/src/tools/ask-tools.ts:139` — the `docId` branch posts the question via `docClient.addDocumentComment`.
- `apps/web/src/components/shared/activity-pane.tsx:284` — `answerAsk` posts the answer as a reply carrying a `teamMention` of the asking agent.
- `services/api/internal/service/doc/activity_service.go:116` — `ActivitySvc.AddComment` never calls `handleMentions`, so nothing resolves the mention or triggers the agent for a doc comment.
- `services/api/internal/service/task/activity_service.go:167` — the task path does call `handleMentions`, which is why tasks work.
## Required outcome
- Answering a question posted on a document must resume the asking agent, or the tool must stop advertising `docId` support (and its description should say the answer is only recorded).
## Suggested approach
- Add mention handling for doc comments mirroring the task path (agent trigger + `NotifyDocMentioned`), or restrict `ask_user_question` to tasks and remove the `docId` branch until doc comments trigger agents.
## Open questions for the human
- Is doc-comment agent triggering intentionally out of scope here? If so, the `docId` option, its description, and `ALL_TOOLS.md` should state that the answer is recorded but does not resume the agent.deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
- Introduced DocumentID in the Trigger struct to handle document comment mentions. - Updated message building functions to include DocumentID when present. - Enhanced notification system to create in-app notifications for users @mentioned in document comments. - Implemented logic to trigger agent conversations when agents are mentioned in document comments. - Added tests to verify the functionality of document comment mentions and notifications. - Created a database migration to add the document_id column to the notifications table.
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes — incremental delta since the prior pullfrog review (929596f9): the doc-comment mention path the previous review flagged as missing.
- Doc-comment mentions now act —
docsvc.ActivitySvc.handleMentionsstarts @-mentioned agents (TriggerDocCommentMention) and notifies @-mentioned people (NotifyDocCommentMentioned), so answering a question posted on a document now wakes the agent. - Doc trigger plumbing —
TriggerDocCommentMentionadded to the agent service and the trigger gate;DocumentIDthreaded through the agent-runner trigger, decode, prompt, and ACP message/dispatch. - Doc notifications —
document_id/document_titleadded to the notification domain, repository, and DTO (migration000075); the bell renders and opens doc mentions. - Owner-mention default —
ask_user_questionnow mentions the conversation's owner whenmentionis omitted. - Notification chime — redesigned to a two-note marimba motif.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Summary
Agents can now ask the user a multiple-choice question and get the answer with a click, in chat conversations and in task/document activity comments. The PR also makes tool calls show what they were given, turns plain-text
@mentionsinto real mention badges, and notifies the user when an agent asks them something in a conversation.Changes
Tool calls show their input
rawInput(and later updates), instead of an empty string.$ <command>.ask_user_questiontoolapps/mcp/src/tools/ask-tools.ts): takesquestion,options, optionalmultiSelectandmention. In chat it returns immediately and echoes the question in its result (some runtimes, e.g. Goose-wrapped CLIs, report an empty tool input). WithprojectId+taskId/docIdit posts the question as a task or document comment.AskQuestionCardshows the options plus a free-text field; picking one sends it as the user's next message. The card sits outside the collapsible tool group, so it is visible without expanding anything. The tool name match also covers Goose-style titles such asmcp: paca ask user question.ActivityPanerenders the question embedded in a comment (apaca-askcode block) as the same card; the answer is posted as a reply that @-mentions the asking agent, so the existing mention trigger wakes it. The card disables once someone else has replied.Mentions render as badges
@usernameor@Name (id: …)as plain text, which the API ignored. The activity service now links these to project members asteamMentionchips on add/edit of task and doc comments (agent id for agent members, user id otherwise). Unknown names, emails, inline code and code blocks are left alone.add_task_commentdocuments@username.Agents @-mentioned in document comments are triggered
docsvc.ActivitySvcnow starts a conversation for each @-mentioned agent (TriggerDocCommentMentionon the agent service and trigger gate, same permission check as task comments; self-mentions are ignored).document_id. agent-runner decodes it and tells the agent the Document ID (LLM and ACP prompts, and the ACP bridge dispatch).NotifyDocCommentMentioned; migration000075_add_document_notifications.sqladdsdocument_id), plus the existingnotification.doc_mentionedplugin event. The bell shows "X mentioned you in document <title>" and opens the document. Self-mentions and non-members are skipped.ask_user_questionis given a task/doc but nomention, the MCP server mentions whoever started the conversation (by member id), so the agent doesn't needlist_project_members.Notification when an agent asks a question in a conversation
question_notification_consumer.goreads the conversation event stream (paca:agent:events), detects the ask tool's result, and notifies the conversation's owner (the global-chat user, or the triggering project member). No agent-facing endpoint is involved.000074_add_question_notifications.sql: addsconversation_id, allows thequestiontype, and makesproject_idoptional (global chat has no project).i18n
shared.jsonfor the card,appShell.jsonfor the notification).Notes
mentionfield.Testing
go test ./internal/...(mention linking,NotifyQuestion, ask-result detection).vitest run(ask tool, mention linking).tsc -b, vitest for tool args, ask parsing,rawInputconversion, assistant-ui, notification bell, i18n parity.🤖 Generated with Claude Code