Skip to content

feat(codemode): remove hardcoded agent() and llm() run limits - #67267

Merged
hearnadam merged 1 commit into
devfrom
remove-workflow-limits
Nov 30, 2026
Merged

hearnadam merged 1 commit into
devfrom
remove-workflow-limits

Conversation

@hearnadam

Copy link
Copy Markdown
Contributor

Summary

Removes Code Mode's hardcoded per-run caps on agent() and llm(): 16 concurrent / 100 total agents and 32 concurrent / 500 total llm() calls. Calls now start whenever the script starts them instead of waiting on or failing against a fixed limit.

The usage/rate-limit circuit breaker is kept: after any call fails with a usage, quota or rate limit, no more calls start in that run. retries still retries failures that are not limits.

Guarded by the existing codemode_agents feature flag.

Context

Supersedes #67221 per the #core discussion with Adam, Kit and Aiden: hardcoded per-run caps on Code Mode agent() and llm() are not needed right now. Unified, configurable bounds shared with subagent will be designed separately.

Verification

  • bun typecheck in packages/core: no type errors
  • bun run test test/codemode/agents.test.ts test/codemode-agents-e2e.test.ts in packages/core: 17 pass, 0 fail
  • bun run check from the worktree root: 37/37 tasks successful

Tests

  • more than 16 agent() calls run concurrently
  • more than 32 llm() calls run concurrently
  • more than 100 total agent() calls in one run
  • a usage/rate limit stops later calls and is not retried
  • non-limit failures still honor retries

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I ran the new tests against the base: the 16-agent and 32-llm() concurrency tests hang (the old limit holds calls back) and the 101-agent test fails on the old total cap. With this PR, test/codemode/agents.test.ts and test/codemode-agents-e2e.test.ts pass 17 of 17.

Public API: the SDK, server, config and plugin API are unchanged. The LIMITS export from codemode/agents.ts is removed, but nothing else in the repo used it. The prompt guide and skill text no longer mention the limits.

One thing to keep in mind, not blocking: with no concurrency cap, a script that runs Promise.all(items.map(agent)) starts every call before any of them can fail. The usage/rate-limit check then stops only later calls and retries; calls already running continue. That fits the plan to design shared bounds separately.

@hearnadam
hearnadam merged commit a73b785 into dev Nov 30, 2026
11 checks passed
@hearnadam
hearnadam deleted the remove-workflow-limits branch November 30, 2026 06:52
Sign up for free to 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