Repository navigation
feat(site/src): show descendant chat questions on the root chat page - #118
Conversation
…hind fork-nested-subagents A delegated chat that is not an explore subagent gets a blocking ask_user_question tool. The call records the question in the new chatd.chat_descendant_questions table and ends the turn; the answer is the next user message. The parent's wait_agent reports needs_input while the child's question is unanswered and, when called while it is pending, waits for the answer before it waits for the child.
…c and cover the late question TestDescendantQuestionEndsTurn raced the child's turn against the root's wait_agent call: when the question was already pending, wait_agent waited the default five minutes and the test hit its deadline (about 1 in 3 to 1 in 15 runs). The root's wait_agent now starts once the question is pending, with a 1 second timeout. TestDescendantQuestionWaitAgent now also covers a question the child asks while the parent waits on it, which only the racy end-to-end path exercised. TestAppendForkTools now includes wait_agent, so wrapping it with the experiment off fails.
…ions-1-chatd-tool # Conflicts: # coderd/database/forkdb/forkdbmock/forkdbmock.go # coderd/database/forkdb/querier.go # coderd/database/forkdb/sqlc.yaml
Adds the forkdb query ListPendingChatDescendantQuestionsByRoot with its dbauthz (read access to the root chat) and dbmetrics wrappers.
Lists the unanswered ask_user_question calls of the unarchived descendants in a chat's family behind fork-nested-subagents, so the root chat UI and API clients can answer them. Adds the codersdk types and client method and the generated swagger, API docs and TypeScript types.
…tions wait_agent now always runs the wrapped tool, so include_tool_calls and its validation apply while a question is pending, a question asked before an inner timeout is reported, and a failed question lookup is an error. Model-only user rows from lifecycle hooks no longer answer a question.
…ions-1-chatd-tool # Conflicts: # coderd/database/forkdb/sqlc.yaml
…ions-1-chatd-tool # Conflicts: # coderd/x/chatd/fork_tools.go
…ndant-questions-2-questions-route
…ions-1-chatd-tool # Conflicts: # coderd/database/dbauthz/fork_forkdb_test.go
…on dock by its header
…ions-1-chatd-tool # Conflicts: # coderd/database/dbauthz/fork_forkdb.go # coderd/database/dbmetrics/fork_forkdb.go # coderd/database/forkdb/sqlc.yaml # coderd/x/chatd/ARCHITECTURE.md
…ions-2-questions-route # Conflicts: # coderd/database/dbauthz/fork_forkdb_test.go # coderd/database/forkdb/chat_descendant_questions.sql.go # coderd/database/forkdb/chat_descendant_questions_test.go # coderd/database/forkdb/queries/chat_descendant_questions.sql
…family question list
…com:ibetitsmike/coder into mike/descendant-questions-3-question-dock
…ions-2-questions-route # Conflicts: # coderd/apidoc/docs.go # coderd/apidoc/swagger.json
…com:ibetitsmike/coder into mike/descendant-questions-3-question-dock
…ions-3-question-dock
UAT on
|
| Check | Result |
|---|---|
S1 (lead condition): real depth-2 family. Root 86d2d99d (client ui) spawns coordinator be6aa78e, which spawns asker 02dbcc94, and the asker calls ask_user_question (call_6eda0f31) |
At 06:51:23 the root is running with no wait_agent result yet, and its page shows "Waiting for coordinator" with a spinner. Above the composer the dock shows "Question from asker" (the title links to the asker), the header Color and the options Red and Blue. I picked Red and clicked Submit at 06:51:25.150. The browser made exactly one message POST, to /api/v2/chats/02dbcc94.../messages. The asker's new user row 295 (06:51:25.153) reads Answer to ask_user_question call call_6eda0f31: followed by Red. The root still has exactly 1 user message (its prompt), and the route returns []. The asker replies CHOSEN=Red. The coordinator's wait_agent result is written at 06:51:43.639, and the root's at 06:52:11.016. The root then reports CHOSEN=Red. The dock disappears from the same page within 8 s of Submit and is still absent on a fresh load after the family finishes, when the route is still []. |
S2: two children of one root, color-asker (06:49:43) and size-asker (06:50:05), each ask |
The dock shows the older question first, "Question from color-asker" with "1 of 2". Answering Red posts only to color-asker (Answer to ask_user_question call call_488c399c: then Red). The dock then shows "Question from size-asker" without a counter, and the route lists only size-asker. |
| S3: click the chat title in the dock header | The browser goes to /agents/65826cdd..., the page of color-asker, the chat that asked. |
S5: the page of a child chat that has a pending question (size-asker), experiment on |
The page shows upstream's inline question for its own tool call. There is no "Question from" dock, and in 12 s the page makes no request to /questions. |
S4: the same build restarted with CODER_EXPERIMENTS unset, size-asker's question still pending in the DB |
The route returns 403. The root page shows the upstream timeline with no dock, and in 12 s the browser makes no request to /api/v2/chats/fork/*/questions. |
With the experiment on, the root page polls the route about every 5 s (3 requests in 12 s), as intended.
After the run I stopped the dev server and revoked the temporary oMLX sub-key. The screenshots for each step are kept in the UAT evidence directory.
Xum posted this comment on behalf of @ibetitsmike.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1cad80384
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… cached descendant questions
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ac6d6ab93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… while the chat cannot take a turn
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8195ac59bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…t cached in the dock test
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41a8622a5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review
|
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closing and reopening only to make GitHub recompute the merge ref against current main ( |
The merge ref now points at current main ( |
…from a running root chat
|
@codex review
|
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merge evidence for head
|
Part of #73
With
fork-nested-subagentson, a root chat's page shows a "Question from " card whenever a descendant chat at any depth has calledask_user_question. The user answers on the root page, and the answer goes to the descendant that asked, not to the root chat. Until now these questions showed only on the asking chat's own page.This makes the model-facing text from #86 true.
descendantQuestionNoteand theask_user_questiondescription incoderd/x/chatd/fork_descendant_questions.goboth tell the model that the user answers in the root chat.What changes
site/src/api/forkChatQuestions.tsfetchesGET /api/v2/chats/fork/{chat}/questions(feat(coderd): list a chat family's pending descendant questions #114).site/src/api/queries/forkChatQuestions.tsholds the query key, query options and mutation options, the same split asforkChatTodos.createChatMessageto the asking chat, then refetches the list. It also refreshes the asking chat's cached chat, prompts and debug runs, with the same helpers that upstream'screateChatMessagemutation uses.ForkDescendantQuestionDock(new fork file) renders nothing, and never creates the query, unless the experiment is on, the chat is a root chat and the viewer can act on it. Otherwise it shows the oldest pending question:AskUserQuestionFormwith the question'stool_call_id, so the answer carries theAnswer to ask_user_question call <id>:prefix that the child's wait expects, and with the same draft key and sticky actions as upstream's dock.ChatPageTimelinegets one optionalchatprop and renders the fork dock when the root's own question dock is not showing;AgentChatPageViewpasseschat.Validation
tsc, knip, and vitest forForkDescendantQuestionDock.test.tsx,ForkComposerSlot.test.tsxandAgentChatPage.test.tsx: all pass.OnePending,SeveralPending,UntitledChat,LoadError,AnswersDisabled.808a20572d, including thesitejob (vitest, 5m15s) andchat-tests.76d3d0752fwith real chats: all five checks pass. In a depth-2 family (root, coordinator, asker), the root page shows "Question from asker" while the root waits onwait_agent. SubmittingRedmakes exactly one message POST, to the asker, with the prefixed answer, and the root then reportsCHOSEN=Red. Two pending questions show oldest first with "1 of 2". The title link opens the asking chat. A child page and an experiment-off build show no dock and make no/questionsrequest. The full table is in the UAT comment below. The branch has since merged main; that merge does not change this PR's diff.