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

The forge's own credential pays only for the forge's own repositories; anyone else runs on a grant or not at all #950

Closed opened this
Closed without merging

Refs #656 (part 1 of 2: the credential fallback. The per-account ceilings follow in a second pull.) What changes. Before, a run with no grant fell back to the forge's own credential, and so did new-app planning.

Notes

stopped closed without shipping for issue #656 — its issue is already done deploy 5172e0e

opened this

Refs #656 (part 1 of 2: the credential fallback. The per-account ceilings follow in a second pull.)

What changes. Before, a run with no grant fell back to the forge's own credential, and so did new-app planning. That credential is the process environment plus the signed-in Claude config, which is the owner's plan. Now it pays only for the forge's own repositories: those owned by an active site admin, or by an org with an active site admin on its Owners team (platformReaches, core/subscriptions.ts). Every other repository runs only on an explicit grant, so a new account cannot spend the owner's plan.

  • pickSubscription returns a new none pick when nothing is granted and the owner is not the forge's.
  • The runner ends such a run before any call, as failed with $0 spent: "this repository has no model account: an admin can grant one in Subscriptions". credentialEnv carries nothing for any pick but ready and env.
  • New-app planning (crew/plan.ts runs on the forge's own credential) is offered and run only where platformReaches; anyone else picks their crew member by hand.

The owner's crew is unchanged. The owner is a site admin, so their repositories and their orgs still get env. A suspended admin's repositories stop getting it.

Already in place, now load-bearing: subscriptions and grants are admin-only and recorded (created_by); a budgeted account caps each run at what is left and reserves it.

Part 2 (next pull, needs a migration): a per-account daily and per-run ceiling enforced before a run starts, and accounts adding their own subscription, which is admin-only today.

Tests (written refusing first; both failed before the change):

  • subscriptions "an outsider's repository with no grant runs nothing and spends nothing; a capped grant runs it to the cap (#656)". A fresh non-admin account makes a repository, adds the existing agent, opens and assigns an issue. The run fails with "no model account", the stand-in Claude is never invoked, and cost is 0. After the admin grants a $0.50-budget account, the run uses that key alone and reserves at most $0.50.
  • subscriptions "…reaches only the forge's own…". env for an admin and an admin's org; none for a newcomer, the newcomer's org, and a suspended admin.
  • The pool test's no-grant case now expects none for an owner that is not the forge's.
  • tsc is clean. Every test file that starts the crew, makes apps or picks subscriptions (40 files), plus the cross files: 705 pass. The one failure was spawn-keys statusHash, already fixed on main by 71fa319.

Widely used: the Pick union gains none, and pickSubscription answers none where it used to answer env for an owner that is not the forge's. No hot files.

🤖 Generated with Claude Code

commented

Closes #656 (with #897 for the per-account ceilings, as the lead decided).

Round two, on the lead's word:

  • The account's settings (/settings) and the board say "You have no model budget yet", and who can grant one, for an account that nothing pays for. That means no forge credential and no grant to it or its repositories (hasModelBudget). An app's page says "This repository has no model account yet", linking an admin to Subscriptions (crewKeyNote(ctx, repo)).
  • Main merged in. The test org for an admin is renamed, because orgs now hold the reserved-name rule (#935).
  • Self-added subscriptions stay admin-only (the owner's rule).

For #897: build on pickSubscription's none and ready picks and platformReaches(db, ownerId) / hasModelBudget(db, ownerId) in core/subscriptions.ts. A per-account ceiling belongs beside the budget reservation in pickSubscription, enforced before runClaude in crew/runner.ts where the none pick already ends a run at $0.

Tests: subscriptions (settings and board say it before the grant, and not after). tsc is clean; subscriptions, board, home-feed, studio, web, everyday, looks and the cross files pass (369).

commented

Steward (trevato): closing my own stale pull (opened 2026-10-06, conflicted, never landed). The crew builds, not the steward: its issue goes back to the map for a builder to start fresh from main.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs