Public: anyone can read this; the crew can change it.
Capacity changes live, never by restart: concurrency, shards and egress mode set by an admin, audited #903
Check · Review · Land · Live done — Landed and live in production.
Closes #874
shipped production is serving it for issue #874 — its issue is already done deploy 119f4d2
Sign in to join this conversation.
new above
offline
Closes #874
Touches hot files:
src/core/schema.ts(migration 62, appended last),src/http/api.ts,src/http/server.ts,src/http/mcp.tsandscripts/gate.ts. Changes one shared class:Gate(src/git/env.ts) gainsresize(limit), and itslimitis now a getter, so every existing caller is unchanged. No shared function's contract changes; in particular,childEnvis untouched.What changes
src/core/capacity.tsholds four settings, each read where it is used, on every pick:-
crew.concurrency-checks.concurrency-checks.shards-cells.egressThe environment (
FORGE_CREW_CONCURRENCY,FORGE_CHECKS_CONCURRENCY,FORGE_CHECK_SHARDS,FORGE_CELLS_EGRESS) stays the boot default. A stored value overrides it until it is cleared. Every change is kept as who, when, from and to.- The check service reads its concurrency on every
schedule()and resizes its gate. Lowering it lets running checks finish, and the next one waits. - The crew's pump reads its concurrency on every pump. - The shard count reaches a check's commands, and an agent's Claude Code process and so its shell, as an explicitFORGE_CHECK_SHARDSset by the launcher from the setting. It never comes from the pod's environment. - The egress mode is read at every cell start: app, preview, terminal, and install, test and check steps. Flippingreporttoenforceis the emergency lever, and it reaches the next cell without a roll. The app page's egress card states the mode in force.src/actions/capacity.tsallows a forge admin only, and never an agent. Everyone else getsnot_found. Each change emits acapacity.changedevent carrying key, from, to and actor.- Settings → Capacity,
/settings/capacity: an admin-only page listing each setting with its value, its source and a reset to the default, followed by the change history. -GET /api/v1/admin/capacityandPUT /api/v1/admin/capacity/:keywith{ value }(nullrestores the default). - ThecapacityMCP tool. It plans by default; making a change needs an admin-scope token.docs/APPS.md(Configuration) documents all of the above.Tests (
test/capacity.test.ts, added to the gate). The refusing tests come first:Gate.resize: when the limit is lowered, holders keep their permits and the next caller waits; when it is raised, waiters go at once.shards=2, the value the admin set.FORGE_CHECK_SHARDS=4, the value the admin set.reporttoenforcechanges the mode handed to the next cell start, with the same runtime and no restart.test/mcp.test.tsnow lists the new tool.Checks run. I merged main 6b03138 (one migration crossed, so mine is now 62).
bun x tsc --noEmitis clean. Onebun testcall covering this pull's files, the files it touches and the five cross files passed 381 of 381: capacity, checks, contain, mcp, here-manifest, secret-store, crew-sandbox, migrate, schema-migrations, reserved-names, studio, shards, check-list and hollow.🤖 Generated with Claude Code