Skip to content

fix: prevent agent Workflows exhausting subrequests - #182

Merged
iamjr15 merged 1 commit into
mainfrom
fix/agent-workflow-subrequest-limit
Aug 8, 2026
Merged

fix: prevent agent Workflows exhausting subrequests#182
iamjr15 merged 1 commit into
mainfrom
fix/agent-workflow-subrequest-limit

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Raise the agent Worker subrequest allowance to Cloudflare's paid-plan maximum.
  • Prevent normal model, Daytona, database, storage, and Durable Object traffic from terminating semantically active agent runs.
  • Document why the transport budget must match the existing 25,000-step Workflow contract.

Context

Production QA for the pomodoro-app failure proved the prior fourth-tool fix works: all four tool calls completed. The next model turn then failed four times with Cloudflare's exact Too many subrequests by single Worker invocation error. This PR fixes that independent deployment boundary.

No separate Linear issue or plan document exists for this production incident.

Architecture

Cloudflare counts external fetches and Cloudflare-service calls against one Workflow-instance subrequest budget. The agent loop is intentionally completion-driven, so apps/agent-worker/wrangler.jsonc now pins the paid-plan maximum while the existing 25,000-step limit, operation timeouts, cancellation, and provider quotas remain the operational safeguards.

Decisions Made

Decision Choice Alternatives considered Reasoning
Budget location Top-level agent Worker limits.subrequests Model retries or per-tool workarounds This is the Cloudflare-owned deployment boundary named by the runtime error.
Budget value Paid-plan maximum, 10,000,000 Arbitrary lower ceilings Agent work varies by sandbox and tool traffic; a lower value would remain a hidden product limit and subrequests are not preallocated.
Scope Agent Worker only Raise every Worker Only the long-running agent Workflow demonstrated this workload and failure mode.

Edge Cases Handled

Scenario Handling
Long app-building run uses many provider and sandbox requests The platform budget no longer terminates the run before its configured Workflow-step ceiling.
Other Workers receive ordinary webhook or gateway traffic Their limits remain unchanged.
Runaway or abandoned run Existing cancellation, timeouts, provider quotas, and Workflow steps remain in force.

How to Review

  1. Review apps/agent-worker/wrangler.jsonc for the deployment limit.
  2. Review apps/agent-worker/README.md for the architectural contract.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm turbo build --force
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm turbo skills:build
  • wrangler deploy --dry-run --config apps/agent-worker/wrangler.jsonc
  • Rerun the exact failing flow on production after merge and Cloudflare deployment.

Pin Cloudflare's paid-plan maximum so model, sandbox, database,
and storage traffic cannot exhaust the Workflow before semantic completion.
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cheatcode Skipped Skipped Aug 8, 2026 12:19pm

@iamjr15
iamjr15 merged commit 37219e3 into main Aug 8, 2026
6 checks passed
@iamjr15
iamjr15 deleted the fix/agent-workflow-subrequest-limit branch August 8, 2026 12:21
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