mirror of
https://github.com/coder/coder.git
synced 2026-06-07 15:08:20 +00:00
f4a7fa5b95
## Summary Subagent (child) chats were previously given access to workspace provisioning tools (`list_templates`, `read_template`, `create_workspace`), which could lead to uncontrolled resource consumption. This PR moves those tools behind the same `!chat.ParentChatID.Valid` gate that already protects the subagent tools (`spawn_agent`, `wait_agent`, etc.). ## Changes - **`coderd/chatd/chatd.go`**: Moved `list_templates`, `read_template`, and `create_workspace` tool registration into the root-chat-only block alongside subagent tools. - **`coderd/chatd/chatd_test.go`**: Added `TestSubagentChatExcludesWorkspaceProvisioningTools` — an E2E test that spawns a subagent via a root chat and verifies the subagent's LLM call does not include workspace provisioning or subagent tools. - **`coderd/chatd/chattest/openai.go`**: Added `Tools` field to `OpenAIRequest` and supporting `OpenAITool`/`OpenAIToolFunction` types so tests can inspect which tools are sent to the model.