Skip to content

feat(opencode): allow general nested task via depth - #47106

Closed
samuelrizzo wants to merge 1 commit into
anomalyco:devfrom
samuelrizzo:general-nested-task
Closed

samuelrizzo wants to merge 1 commit into
anomalyco:devfrom
samuelrizzo:general-nested-task

Conversation

@samuelrizzo

@samuelrizzo samuelrizzo commented Sep 3, 2026

Copy link
Copy Markdown

Issue for this PR

No issue filed.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Nested subagents need two things today: subagent_depth >= 2 and a task: allow override on the agent. The built-in general agent denies todowrite but says nothing about task, so deriveSubagentSessionPermission adds an implicit task deny and hides the tool from the child. That means setting subagent_depth: 2 alone is not enough for general -> general, which is surprising next to the docs.

This adds task: allow to the default permission of general (one line in packages/opencode/src/agent/agent.ts). The depth check in task.ts is untouched, so the default (depth=1) still blocks nesting; you only get one nested level when you explicitly opt in with subagent_depth: 2. I left explore alone since it is read-only by design, and I did not change the default depth.

How did you verify your code works?

I tried bun test test/tool/task.test.ts in packages/opencode but the suite does not boot in this env (missing @opentui/solid/preload), unrelated to this diff. I verified the one-line diff by reading deriveSubagentSessionPermission + visibleTools paths and confirmed the existing depth tests (prevents subagents from launching subagents by default, allows nested subagents up to the configured depth) cover the gate I left in place.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

PR #32301: feat: nested sub-agent spawning (up to 5 levels) + fixes for #23091 / #13715

PR #37902: fix(acp): child/subagent session permission requests no longer hang forever

The current PR #47106 appears to be a targeted fix/improvement rather than a full duplicate. It specifically aligns the behavior of the task tool on the general agent with documentation by removing an implicit permission restriction, which is different from past nested subagent implementations.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 3, 2026
@github-actions github-actions Bot closed this Sep 3, 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.

1 participant