fix(cli): prevent subagents asking questions (#11101)

This commit is contained in:
Marius
2026-06-11 11:59:40 +02:00
committed by GitHub
parent 237fd10602
commit 294c532f6a
5 changed files with 21 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
---
"@kilocode/cli": patch
"kilo-code": patch
---
Prevent task subagents from asking questions that users cannot answer from the parent session.
+5 -1
View File
@@ -61,7 +61,11 @@ export namespace KiloTask {
/** Extra permission rules appended to subagent sessions */
export function permissions(rules: Permission.Ruleset): Permission.Ruleset {
return [{ permission: "task", pattern: "*", action: "deny" }, ...rules]
return [
{ permission: "task", pattern: "*", action: "deny" },
{ permission: "question", pattern: "*", action: "deny" },
...rules,
]
}
export function merge(...rulesets: Permission.Ruleset[]): Permission.Ruleset {
+1
View File
@@ -247,6 +247,7 @@ export const TaskTool = Tool.define(
variant, // kilocode_change
agent: next.name,
tools: {
question: false, // kilocode_change - subagents cannot prompt the user directly
...(canTodo ? {} : { todowrite: false }),
...(canTask ? {} : { task: false }),
...Object.fromEntries((cfg.experimental?.primary_tools ?? []).map((item) => [item, false])),
@@ -155,7 +155,7 @@ describe("Kilo task nesting", () => {
),
)
it.live("disables nested task tool even when global task permission allows it", () =>
it.live("disables nested task and question tools even when global permissions allow them", () =>
provideTmpdirInstance(
() =>
Effect.gen(function* () {
@@ -186,6 +186,7 @@ describe("Kilo task nesting", () => {
const child = yield* sessions.get(result.metadata.sessionId)
expect(seen?.tools?.task).toBe(false)
expect(seen?.tools?.question).toBe(false)
expect(child.permission).toEqual(
expect.arrayContaining([
{
@@ -193,6 +194,11 @@ describe("Kilo task nesting", () => {
pattern: "*",
action: "deny",
},
{
permission: "question",
pattern: "*",
action: "deny",
},
]),
)
}),
@@ -200,6 +206,7 @@ describe("Kilo task nesting", () => {
config: {
permission: {
task: "allow",
question: "allow",
},
},
},
+1
View File
@@ -484,6 +484,7 @@ describe("tool.task", () => {
)
// kilocode_change end
expect(seen?.tools).toEqual({
question: false, // kilocode_change - subagents cannot prompt the user directly
todowrite: false,
task: false, // kilocode_change - Kilo disallows nested subagents
bash: false,