Skip to content

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

Merged
marius-kilocode merged 1 commit into
mainfrom
fix/prevent-subagent-questions
Jun 11, 2026
Merged

fix(cli): prevent subagents asking questions#11101
marius-kilocode merged 1 commit into
mainfrom
fix/prevent-subagent-questions

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Task subagents can inherit or be configured with access to the interactive question tool, but those questions belong to the child session and are not reliably answerable from the parent conversation. This leaves the child task waiting indefinitely in both the VS Code sidebar and Agent Manager.

Disable the question tool at the task-spawn boundary and persist a matching deny rule on child sessions. Applying the restriction after configured agent permissions ensures global and custom-agent overrides cannot re-enable interactive questions for task subagents, while primary sessions retain normal question support.

@kilo-code-bot

kilo-code-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The fix is well-structured. Two layers of defence are applied:

  1. tools: { question: false } in the prompt call disables the tool at invocation time.
  2. { permission: "question", pattern: "*", action: "deny" } in KiloTask.permissions() persists the restriction on the child session, preventing any inherited or configured allow rules from re-enabling the tool (since KiloTask.permissions() is always the last argument to KiloTask.merge(), and the permission evaluator uses last-match wins).

The inherited() filter at packages/opencode/src/kilocode/tool/task.ts:57-59 already ensures only edit, bash, and MCP rules pass through, so the ...rules spread inside permissions() cannot smuggle a question: allow rule in to override the deny.

Test coverage in both task-nesting.test.ts and task.test.ts correctly validates both the session permission array and the tool toggle.

Files Reviewed (5 files)
  • .changeset/prevent-subagent-questions.md
  • packages/opencode/src/kilocode/tool/task.ts
  • packages/opencode/src/tool/task.ts
  • packages/opencode/test/kilocode/task-nesting.test.ts
  • packages/opencode/test/tool/task.test.ts

Reviewed by claude-4.6-sonnet-20260217 · 1,019,718 tokens

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode enabled auto-merge (squash) June 11, 2026 09:53
@marius-kilocode
marius-kilocode merged commit 294c532 into main Jun 11, 2026
21 checks passed
@marius-kilocode
marius-kilocode deleted the fix/prevent-subagent-questions branch June 11, 2026 09:59
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
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.

2 participants