Advertise cwd in the agent tool schema (#6314)

The multi-checkout spawn refusal tells the caller to specify cwd, but the
schema hid it — discoverable only by failing. Advertise it with the
worktree/disambiguation semantics; exact-list test updated, discoverability
test pins the new description.

Docs follow-up pending: SUBAGENTS.md still files cwd under parse-accepted
compat. Held out of this commit to avoid churning around contributor PR
#6335, which touches the same table; will update once it lands.
This commit is contained in:
Hunter B committed 2026-09-18 10:30:37 -07:00
1 parent 5466bfd1fd
commit 1a40b37f0a
2 files changed
+16 -1

No files matched your search

+4
View File
@@ -9480,6 +9480,10 @@ impl ToolSpec for AgentTool {
"type": "boolean",
"description": "When true, create a fresh git worktree and branch for this child before it starts. Use for parallel edit tasks that must not collide with the parent checkout."
},
"cwd": {
"type": "string",
"description": "Working directory for this child. With worktree=true it becomes the worktree root; otherwise the child's workspace. Pass it when the parent directory holds several checkouts and the spawn names no single repository."
},
"write_roots": {
"type": "array",
"items": { "type": "string" },
+12 -1
View File
@@ -5694,6 +5694,7 @@ fn subagent_tool_schemas_advertise_real_type_and_role_vocabulary() {
"all_parked",
"allowed_tools",
"coordination_contracts",
"cwd",
"deliverables",
"detail",
"detached",
@@ -5731,7 +5732,8 @@ fn subagent_tool_schemas_advertise_real_type_and_role_vocabulary() {
"worktree_base",
"worktree_branch",
"worktree_path",
"cwd",
// "cwd" deliberately advertised since #6314: the multi-checkout
// refusal names it as the remedy, so the schema must teach it.
"deliberate",
"dependencies",
"acceptance",
@@ -5786,6 +5788,15 @@ fn agent_start_schema_documents_hidden_spawn_requirements() {
model.contains("resolved route"),
"model description should point at per-role resolved routes: {model}"
);
// #6314: the multi-checkout refusal tells the caller to specify cwd,
// so the schema must advertise it before the first failure.
let cwd = schema_property_description(&schema, "cwd");
for needle in ["worktree", "several checkouts"] {
assert!(
cwd.contains(needle),
"cwd description should teach {needle:?}: {cwd}"
);
}
}
#[test]