Skip to content

Add configurable system and project run concurrency limits#44

Merged
joyzoursky merged 1 commit intomainfrom
concurrent-limit
Mar 10, 2026
Merged

Add configurable system and project run concurrency limits#44
joyzoursky merged 1 commit intomainfrom
concurrent-limit

Conversation

@joyzoursky
Copy link
Copy Markdown
Collaborator

Summary

  • Add configurable concurrency controls for test runs at system and project levels.
  • Enforce a system-wide active run cap via environment variable.
  • Add per-project max concurrent run setting with a default of 1 and configurable ceiling.

Changes

  • Schema/API
  • Add Project.maxConcurrentRuns (default 1) to Prisma schema.
  • Add env configs:
  • RUNNER_MAX_CONCURRENT_RUNS (default 10)
  • PROJECT_MAX_CONCURRENT_RUNS_MAX (default 5)
  • Extend project APIs to return and validate maxConcurrentRuns and maxConcurrentRunsLimit.
  • Scheduler/dispatch
  • Enforce both system and project concurrency limits in Android claim path.
  • Enforce both limits in browser dispatch path.
  • Add queued browser run backfill dispatch when slots are freed (complete/fail/cancel/lease-reaper/MCP cancellation).
  • UI
  • Add Settings tab on project page after Variables.
  • Add project settings form to edit max concurrent runs.
  • Add i18n strings for EN / zh-Hant / zh-Hans.
  • Docs/config
  • Update .env.example and k8s deploy docs for new env vars.

Validation

  • Lint/Type-check: npm run lint (pass)
  • Verify: npm run verify (pass)
  • Tests:
  • npm test -- src/lib/runners/__tests__/claim-service.test.ts src/app/api/run-test/route.test.ts src/lib/mcp/__tests__/run-execution.test.ts 'src/app/api/test-runs/[id]/cancel/route.test.ts' src/lib/runtime/__tests__/local-browser-runner.usage.test.ts src/lib/mcp/__tests__/run-cancellation.test.ts (pass)

Breaking Changes

  • Database schema change: adds Project.maxConcurrentRuns.
  • New runtime env vars introduced (with defaults).

Risks

  • Dispatch behavior now triggers queued browser run checks at more transition points; this increases claim attempts under high churn.

Follow-ups

  • Run npx prisma db push (or migration flow) in target environments before deploy.
  • Monitor queue throughput and tune RUNNER_MAX_CONCURRENT_RUNS / PROJECT_MAX_CONCURRENT_RUNS_MAX per environment.

@joyzoursky joyzoursky merged commit 0edd6e9 into main Mar 10, 2026
1 check passed
@joyzoursky joyzoursky deleted the concurrent-limit branch March 10, 2026 10:29
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