Public: anyone can read this; the crew can change it.

Per-account limits on repositories and apps: the count is checked before creating, and the refusal names it #1158

Parked opened this
Closed without merging

Each account now has a repository limit and an app limit, both defaulting to 10. The count is checked before anything is created. I did not get a green full check locally, so that part of your list is not done.

Notes

stopped parked by the crew deploy 4cb6fb3

opened this

Each account now has a repository limit and an app limit, both defaulting to 10. The count is checked before anything is created. I did not get a green full check locally, so that part of your list is not done.

bun x tsc --noEmit failed in my sandbox on a temp-directory error, so I ran node ./node_modules/typescript/lib/tsc.js --noEmit instead and it was clean. The full check run (FORGE_CHECK_SHARDS=1 bun scripts/test-shards.ts --timeout 60000 --gate) stopped at fail-fast on a timing test, "fifty agents at once", which took 5.6s. Agents are exempt from the limits, so that test doesn't touch this change, and I assume it was load in my sandbox, but I haven't confirmed it. The other 178 shards were skipped, so the forge's run on this push is the first full verdict. test/quotas.test.ts (5 tests, in GATE) passes alone. It timed out once under load on newApp's scaffold, so I gave its slow tests a 30s timeout. test/forks.test.ts failed once in a combined run and then passed alone.

  • Limits: src/core/quotas.ts counts what the account owns and builds the refusal. The limits are two new capacity settings, quota.repos and quota.apps, with env defaults FORGE_QUOTA_REPOS and FORGE_QUOTA_APPS. They share the existing Settings → Capacity page and its audit log, and are documented in docs/APPS.md. A new PATCH /api/v1/admin/settings takes { "quota.repos": "20" }. It checks every key first, so one bad value changes nothing.
  • Where it applies: creating a repository, forking, "make it yours" copies, creating an app, enabling an app, and migrating a repository in.
  • Refusal: the API returns 403 quota with a message like "you have 10 of 10 repositories, the most one account may have: delete one or ask the owner to raise the limit". The web pages show the same sentence, and the MCP capacity tool accepts the new keys.
  • Exempt: forge admins (the owner) and agents.
  • Tests: a fresh account is refused on repositories, forks and apps, on the API and in the actions, while the owner's account isn't. Raising a limit makes room, each change is audited, and a bad value or a non-admin changes nothing.

Left out:

  • Org-owned repositories: a repository created for an org the account can write to is not counted against that account.
  • #918 and #919: their keys aren't added; they add entries to QUOTAS and call overQuota.
  • Tables: I did not touch repo, run or repo_crew.

To try it: set quota.repos to 1 with PATCH /api/v1/admin/settings as an admin, then create two repositories as a non-admin.

🤖 Generated with Claude Code

Closes #973

commented

I merged main into the branch and pushed it. The forge's check hasn't run on the merge yet. In the sandbox, bun x tsc --noEmit is clean, and 21 of 22 tests pass across quotas.test.ts, limits.test.ts and capacity.test.ts.

Conflicts

  • scripts/gate.ts: the gate list keeps test/quotas.test.ts and the four test files main added (access-log, flow-pipeline, flow-throughput, limits).
  • src/http/api.ts: PATCH /api/v1/admin/settings (the quota keys) and main's GET/PUT /api/v1/admin/limits both stay, along with both import sets.
  • src/web/pages/site.ts: the quotaMessage import and main's limitValue import both stay.

The one failure: capacity.test.ts ("an admin changes each one…") fails at the reset step. The cause is that this sandbox exports FORGE_CHECK_SHARDS=4, and that value becomes the shards default after the reset. I didn't run the test on a clean main to confirm it fails there too. The forge's check, with a clean environment, should show whether it passes.

I left the failing test alone.

commented

Parked by the crew: the check failed ("the studio, continued > the door reads public apps, not a window of the newest repositories, and shows only the live ones (#288, #686)") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs