From e8275318ba1e3c886625d586604e9b11b19e90df Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Fri, 1 May 2026 10:42:56 -0500 Subject: [PATCH] [codex] Raise agent heartbeat concurrency default (#4954) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip orchestrates AI agents for zero-human companies > - Agent heartbeat settings control how much parallel work one employee can run > - The previous default of 5 concurrent runs was too restrictive for active local agent teams > - The shared default, heartbeat clamp, docs, and route/import/UI expectations need to agree > - This pull request raises the default heartbeat concurrency to 20 while keeping explicit headroom up to 50 for power users > - The benefit is higher throughput for agent teams without each new agent needing manual runtime config edits ## What Changed - Raised `AGENT_DEFAULT_MAX_CONCURRENT_RUNS` from 5 to 20. - Raised the heartbeat service max clamp from 10 to 50, keeping the new default below the ceiling. - Updated V1 implementation docs and tests that assert default imported/exported runtime config. - Updated the new-agent UI runtime config test to assert the shared default constant instead of duplicating the numeric value. ## Verification - `pnpm exec vitest run server/src/__tests__/agent-permissions-routes.test.ts server/src/__tests__/company-portability.test.ts ui/src/lib/new-agent-runtime-config.test.ts` ## Risks - Medium risk: new agents can consume more local execution capacity by default. The heartbeat scheduler still respects configured max concurrency and budget/pause controls, and operators can lower or raise the per-agent cap within the `1..50` clamp. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI Codex, GPT-5 coding agent, tool use and local command execution. Exact context window was not exposed in the runtime. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip --- doc/SPEC-implementation.md | 2 +- packages/shared/src/constants.ts | 2 +- server/src/__tests__/agent-permissions-routes.test.ts | 4 ++-- server/src/__tests__/company-portability.test.ts | 4 ++-- server/src/services/heartbeat.ts | 2 +- ui/src/lib/new-agent-runtime-config.test.ts | 5 +++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/SPEC-implementation.md b/doc/SPEC-implementation.md index d77384ee..22075e04 100644 --- a/doc/SPEC-implementation.md +++ b/doc/SPEC-implementation.md @@ -676,7 +676,7 @@ Per-agent schedule fields in `adapter_config`: - `enabled` boolean - `intervalSec` integer (minimum 30) -- `maxConcurrentRuns` integer; new agents default to `5` +- `maxConcurrentRuns` integer; new agents default to `20`; scheduler clamps configured values to `1..50` Scheduler must skip invocation when: diff --git a/packages/shared/src/constants.ts b/packages/shared/src/constants.ts index 8b196e93..8cbe9eef 100644 --- a/packages/shared/src/constants.ts +++ b/packages/shared/src/constants.ts @@ -72,7 +72,7 @@ export const AGENT_ROLE_LABELS: Record = { general: "General", }; -export const AGENT_DEFAULT_MAX_CONCURRENT_RUNS = 5; +export const AGENT_DEFAULT_MAX_CONCURRENT_RUNS = 20; export const WORKSPACE_BRANCH_ROUTINE_VARIABLE = "workspaceBranch"; export const MODEL_PROFILE_KEYS = ["cheap"] as const; diff --git a/server/src/__tests__/agent-permissions-routes.test.ts b/server/src/__tests__/agent-permissions-routes.test.ts index 85d4f180..624f3772 100644 --- a/server/src/__tests__/agent-permissions-routes.test.ts +++ b/server/src/__tests__/agent-permissions-routes.test.ts @@ -901,7 +901,7 @@ describe.sequential("agent permission routes", () => { heartbeat: { enabled: false, intervalSec: 3600, - maxConcurrentRuns: 5, + maxConcurrentRuns: 20, }, }, }), @@ -939,7 +939,7 @@ describe.sequential("agent permission routes", () => { heartbeat: { enabled: false, intervalSec: 3600, - maxConcurrentRuns: 5, + maxConcurrentRuns: 20, }, }, }), diff --git a/server/src/__tests__/company-portability.test.ts b/server/src/__tests__/company-portability.test.ts index 01794385..fecd7a78 100644 --- a/server/src/__tests__/company-portability.test.ts +++ b/server/src/__tests__/company-portability.test.ts @@ -2158,7 +2158,7 @@ describe("company portability", () => { runtimeConfig: { heartbeat: { enabled: false, - maxConcurrentRuns: 5, + maxConcurrentRuns: 20, }, }, }); @@ -2237,7 +2237,7 @@ describe("company portability", () => { runtimeConfig: { heartbeat: { enabled: false, - maxConcurrentRuns: 5, + maxConcurrentRuns: 20, }, }, })); diff --git a/server/src/services/heartbeat.ts b/server/src/services/heartbeat.ts index f7c0a220..41383f6f 100644 --- a/server/src/services/heartbeat.ts +++ b/server/src/services/heartbeat.ts @@ -145,7 +145,7 @@ const MAX_RUN_EVENT_PAYLOAD_OBJECT_KEYS = 100; const MAX_RUN_EVENT_PAYLOAD_DEPTH = 6; const HEARTBEAT_MAX_CONCURRENT_RUNS_DEFAULT = AGENT_DEFAULT_MAX_CONCURRENT_RUNS; const HEARTBEAT_MAX_CONCURRENT_RUNS_MIN = 1; -const HEARTBEAT_MAX_CONCURRENT_RUNS_MAX = 10; +const HEARTBEAT_MAX_CONCURRENT_RUNS_MAX = 50; const LIVENESS_BOOKKEEPING_ACTIVITY_ACTIONS = [ "environment.lease_acquired", "environment.lease_released", diff --git a/ui/src/lib/new-agent-runtime-config.test.ts b/ui/src/lib/new-agent-runtime-config.test.ts index f33cdc85..3a72943c 100644 --- a/ui/src/lib/new-agent-runtime-config.test.ts +++ b/ui/src/lib/new-agent-runtime-config.test.ts @@ -1,5 +1,6 @@ // @vitest-environment node import { describe, expect, it } from "vitest"; +import { AGENT_DEFAULT_MAX_CONCURRENT_RUNS } from "@paperclipai/shared"; import { buildNewAgentRuntimeConfig } from "./new-agent-runtime-config"; describe("buildNewAgentRuntimeConfig", () => { @@ -10,7 +11,7 @@ describe("buildNewAgentRuntimeConfig", () => { intervalSec: 300, wakeOnDemand: true, cooldownSec: 10, - maxConcurrentRuns: 5, + maxConcurrentRuns: AGENT_DEFAULT_MAX_CONCURRENT_RUNS, }, }); }); @@ -27,7 +28,7 @@ describe("buildNewAgentRuntimeConfig", () => { intervalSec: 3600, wakeOnDemand: true, cooldownSec: 10, - maxConcurrentRuns: 5, + maxConcurrentRuns: AGENT_DEFAULT_MAX_CONCURRENT_RUNS, }, }); });