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

A run never falls back to the forge's own model credential: no grant to the repository or its owner, no run #1156

Parked opened this
Closed without merging

A run now needs a grant to its repository or its owner. With neither, it ends without starting and without spending, and says "This repository has no model account". I did not run the full bun test or tsc.

Notes

stopped parked by the crew deploy f25261e

opened this

A run now needs a grant to its repository or its owner. With neither, it ends without starting and without spending, and says "This repository has no model account". I did not run the full bun test or tsc. The sandbox here refuses unix-socket listeners, which fails about 520 server-based tests regardless of my change, and tsc would not start.

I did run the new test/crew-no-grant.test.ts; it passes. The existing crew tests that start a server could not run here, so those are the ones to watch in the forge's check.

What changed

  • No grant, no run. executeAgentRun checks for a grant before it makes a fork, mints a token or calls Claude. If none exists, the run fails with that sentence on its page and the log. The agent also posts it once on the issue, not again on retries.
  • Ledger. The run still gets a ledger line, with zero cost.
  • The forge's own credential is now an explicit grant. pickSubscription returns a new none result when nothing is granted. It returns env, the forge's own token, only where a grant names the platform row.
  • Migration 73. It grants platform to every repo owned by a forge admin that has no grant of its own and whose owner has none either. Repos with existing grants are left alone.
  • New admin repos. createRepo records the same grant for repos the admin creates from now on. The issue only asked for the migration, but without this the owner's new repos would stop running.
  • App planner. The planner in actions/apps.ts also spent the forge's own credential. It now runs only where platform is granted to the new repo.
  • Tests. test/crew-no-grant.test.ts covers an outsider and an admin repo, with an agent assigned an issue in each:
    • The outsider's run does not start, the failure is on the run and the issue, and the ledger shows zero.
    • The admin's repo holds a platform grant and gets past the grant check.
    • The migration grants only the admin's existing repos.
  • Test edit. I changed one expectation in test/subscriptions.test.ts, from env to none for an ungranted scope. The old one asserted the fallback this change removes.

Not done

  • The "starts" half. The test for the admin's repo shows the run clears the grant check. It does not run a full agent session, which needs a server.
  • Forks. Forks are not auto-granted.
  • Settings page. It cannot grant or revoke platform; only the migration and createRepo write that grant.
  • Run logs. Pre-existing runs are untouched.

To try

  • bun test test/crew-no-grant.test.ts
  • As a non-admin user, create a repo, add an agent and assign it an issue. The run fails at once with the message above.

🤖 Generated with Claude Code

Closes #1144

commented

I merged main into the branch and pushed it. The type check is clean and test/subscriptions.test.ts passes (16 tests). I did not run the whole suite, since the forge's check does that on push.

  • The conflict: main had moved every migration out of src/core/schema.ts into its own timestamped file under src/core/migrations/. That left my numbered migration 73 with nowhere to live in the old array.
  • The fix: I took main's schema.ts as it is. I moved my migration into src/core/migrations/20261016150000-only-a-grant-pays.ts with the same SQL.
  • What the migration does: it gives each repository owned by the forge admin an explicit grant of the forge's own model credential, so nothing changes for the owner now that a run no longer falls back to it. Only repositories with no grant already in place get one.
  • Left alone: the runner and subscription changes merged cleanly with main's edits to those files.

I ran schema.test.ts along with the subscriptions test, but its result was cut off in the output, so I can't confirm it.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs