Skip to content

feat(opencode): add configurable subagent concurrency limit - #51471

Open
Jieiku wants to merge 1 commit into
anomalyco:devfrom
Jieiku:feature/subagent-concurrency-limit
Open

Jieiku wants to merge 1 commit into
anomalyco:devfrom
Jieiku:feature/subagent-concurrency-limit

Conversation

@Jieiku

@Jieiku Jieiku commented Sep 26, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #27110

Type of change

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

What does this PR do?

Adds a configurable limit for concurrent subagent task execution.

Previously, multiple subagents could be launched without a configurable concurrency cap. This adds a new subagent_concurrency config option that controls how many subagent executions may run at the same time.

The task tool now uses an Effect semaphore to gate subagent execution. Tasks can still be created and tracked normally, but execution waits for an available permit when the configured limit is reached.

The default behavior is unchanged: if subagent_concurrency is not configured, concurrency remains unlimited.

The change also updates the generated SDK/OpenAPI types and adds a regression test covering the concurrency limit behavior.

How did you verify your code works?

Verified locally with:

  • bun run typecheck
  • bun run lint
  • bun test test/tool/task.test.ts

Added a regression test that confirms subagent_concurrency: 1 prevents multiple subagents from executing at the same time.

Also manually tested the feature:

  • With subagent_concurrency: 1, three background tasks execute sequentially.
  • With subagent_concurrency: 3, three background tasks can execute concurrently.

Screenshots / recordings

N/A

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Add configurable subagent concurrency limit doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

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

Adds a subagent_concurrency config option to limit concurrent task execution.
Includes SDK schema updates and coverage for semaphore-based execution limits.

Closes anomalyco#27110
@Jieiku
Jieiku force-pushed the feature/subagent-concurrency-limit branch from 7270a7d to 101be29 Compare September 26, 2026 09:59
@Jieiku Jieiku changed the title Add configurable subagent concurrency limit feat(opencode): add configurable subagent concurrency limit Sep 26, 2026

This branch has not been deployed

No deployments
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.

[FEATURE]: Setting to limit max number of parallel subagents

1 participant