Skip to content

feat(coderd/x/chatd): give API root chats the async ask_user_question - #206

Merged
ibetitsmike merged 1 commit into
mainfrom
mike/api-root-async-question
Nov 11, 2026
Merged

ibetitsmike merged 1 commit into
mainfrom
mike/api-root-async-question

Conversation

@ibetitsmike

Copy link
Copy Markdown
Owner

A root chat created by an API client got no ask_user_question tool outside plan mode. turn_environment.go adds the async tool only for UI client chats, so an API root could not ask its owner anything. With fork-nested-subagents on, appendForkTools in coderd/x/chatd/fork_tools.go now adds the async tool to every root chat that is not an explore chat and does not already have ask_user_question. The owner answers in the web UI, and the turn continues without waiting, as it does for UI roots.

  • turn_environment.go is unchanged. UI roots still get the tool there, and plan mode keeps its blocking tool, because the new code skips a turn that already has the tool.
  • TestDescendantQuestionTurnTools covers an API root (async tool), a plan-mode root (blocking tool only), an explore chat (no tool) and the experiment off (no tool). If the new append is removed through a -overlay, the API root case fails.
  • docs/fork/pstack-adapter.md describes the API root tool and has updated fork_tools.go line references.

Part of #4

Xum opened this PR on behalf of @ibetitsmike.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T20:08:44.766878Z a0bb210 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: a0bb210bd9

ℹ️ 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".

@ibetitsmike
ibetitsmike merged commit 7b56ab6 into main Nov 11, 2026
10 checks passed
@ibetitsmike
ibetitsmike deleted the mike/api-root-async-question branch November 11, 2026 20:37
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum merged this PR on behalf of @ibetitsmike.

Merged as a squash of head a0bb210bd9, on top of main 86d8fd242b (#205). This closes PRD R8.1: root chats created through the API get the async ask_user_question outside plan mode, behind fork-nested-subagents.

  • CI: fork-ci run 43093247980 passed on the exact head, which is based on current main.
  • Codex: review summary 6806054299 on a0bb210bd9 has no findings. 0 review threads.
  • UAT: UAT206 passed on a fresh branch server at a0bb210bd9 in 2 root turns. A chat created with client_type=api called ask_user_question and got the async result, and the same turn kept going to waiting. The owner answered the question in the web UI with no console or HTTP errors, and the next turn used the answer. The leak audit was clean.
  • Tests: plan-mode and UI roots keep exactly one question tool, explore roots get none, and with the experiment off the tool list is unchanged. A negative control (dropping the append) fails the API case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant