Skip to content

feat(core): per-agent subagent_depth override - #37226

Closed
M4buAO wants to merge 7 commits into
anomalyco:devfrom
M4buAO:dev
Closed

feat(core): per-agent subagent_depth override#37226
M4buAO wants to merge 7 commits into
anomalyco:devfrom
M4buAO:dev

Conversation

@M4buAO

Copy link
Copy Markdown

Adds optional subagent_depth field to agent config (.md frontmatter or opencode.json). When set, overrides the global subagent_depth for that specific agent. Falls back to global -> 1 if unset.

core/config/agent.ts: schema field + KNOWN_KEYS
opencode/agent/agent.ts: runtime schema + state builder mapping
opencode/tool/task.ts: per-agent lookup before global fallback
opencode/test/tool/task.test.ts: 5 new test cases

Issue for this PR

Closes #

Type of change

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

What does this PR do?

The recent subagent_depth config (PR #37124) was global only — you set one limit for all agents. This PR makes it per-agent so you can give specific subagents a higher nesting limit while keeping everyone else at the default.
The change is small: added subagent_depth as an optional field in the agent config schema, plumbed it through the runtime state builder, and made the depth check in the task tool prefer the current agent's value over the global one. If an agent doesn't set it, it falls back to the global config, then to 1 — same behavior as before.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Ran tests.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

it's not.

Checklist

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

If you do not follow this template your PR will be automatically rejected.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@M4buAO