Repository navigation
feat: let descendant chats ask secret questions - #153
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
…ions-4-secret-answers
…hitecture document
… answer reports through prompt overrides
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c00f1ba03c
ℹ️ 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".
…errors and explain a disabled secret form
… submitting story
The coderd test raced a promotion of the queued report, so either 409 satisfied it. The chatd test queues the report itself.
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b99bcd95ae
ℹ️ 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".
…o the field and explain secret questions in descendant chats
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab08929b52
ℹ️ 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".
…the secret question story to the visual capture
|
@codex review
|
|
Codex Review: Didn't find any major issues. Chef's kiss. 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 ( |
Merge evidence for head
|
Part of #73
This PR turns on secret questions for descendant chats. #126 and #136 built the storage, the substitution into tool input and the scrub of tool output, with the
secretflag ofask_user_questionoff. Here a child agent can ask the user for a value such as an API token, and the user answers it on the root chat page in a masked field. The value reaches the child'sexecute,write_fileandedit_filescalls through a{{secret:<tool call ID>}}placeholder, and never enters a chat message or a model-visible row.What changes
ask_user_questionin a descendant chat of thefork-nested-subagentsexperiment now offers thesecretproperty and handles a secret question. A computer-use chat still gets nosecretproperty, because its screenshots reach the model without the scrub.GetPendingChatDescendantQuestionandListPendingChatDescendantQuestionsByRootnow retire a secret question only with a user message that starts withAnswer to ask_user_question call <tool call ID>:, which only the answer route writes. A clear still retires every question. That message retires the question even after an edit deletes it, so a consumed secret question cannot come back.declined: truewith no value, for a value the user cannot or will not give as a secret, such as one shorter than the 8 byte floor. The child gets a message that the user declined and can ask again without the secret option. A decline deletes a stored answer to that question in the same transaction. A decline is refused while the report of an answer is queued.user_prompt_submithook'sinput_overridedoes not apply to the answer or decline message. coderd writes that text, which holds no user input, and the pending rule needs it as written.POST /api/v2/chats/fork/{chat}/questions/secret-answerwith the tool call ID in the body. The field keeps no draft and writes nothing to local storage. An error from the route, such as the 8 byte floor, shows under the field and points to Decline.ask_user_questioncard of an open secret question shows the question with no form and a notice to answer it in the root chat's question panel, so the user cannot answer it as a chat message.With the flag off
The
fork-nested-subagentsexperiment gates descendant questions. With it off, no chat is a descendant chat, so no secret question can exist, and the dock and tool card render as before.Validation
TestDescendantSecretQuestioncovers the schema with the flag on, the computer-use refusal, the refusal while a message is queued and the recorded secret question.TestForkChatSecretQuestionQueuedMessagequeues a message on a running child, records a secret question, and drives the turn to its end. The queued message is delivered and the secret question stays pending.TestGetPendingChatDescendantQuestioncovers a secret question that an ordinary message and the answer message of another question leave pending, and that its own answer message retires.ForkDescendantQuestionDock.test.tsxtypes a value into the masked field and checks the request body of the secret answer route, that no chat message is sent, and that local storage does not hold the value. It also checks that an error marks the field invalid, is part of its accessible description, and clears once the value changes.forkSecretQuestions.test.tschecks that a secret question in the arguments or the result marks the tool card as not answerable. TheSecretQuestionstory captures the descendant chat's secret question with its notice to answer it in the root chat and no form.TestForkChatSecretAnswercovers the route's refusals, the stored value staying out of messages, the busy-chat queue, and a decline that deletes a stored answer and retires the question.TestSecretQuestionRefusesSubagentMessagechecks that a decline is refused while the answer's report is queued and that the stored answer stays.TestForkChatSecretAnswerPromptOverridechecks that a hook that rewrites every prompt cannot keep an answered or declined question pending.executeprinted the expected sha256 of the value. The value was in 0 of 128 text columns of chat and message tables (the answer store was the 1 control hit) and 0 times in the server log. Sending, editing, a wrong ID and a second answer were refused with 409, and a short value with 400. The field hasautocomplete="off"and password manager ignore attributes.executewith the expected sha256, and the server log had 0 hits.