Watch
0
0
Fork
You've already forked hyperhive
0

agents get a per-agent repo limit in their permissions record, orgs are locked

max_repos (default 0, 0..=100) lives in the agent's agent-permissions record and is edited on its permissions panel. The controller applies each agent's own value as max_repo_creation at CreateForgeUser and to existing accounts on change, restart and every five minutes; agent accounts may not create organizations.
This commit is contained in:
atlas 2026-11-15 20:47:21 +01:00 • committed by mara
commit 1edeb5c55d
2 changed files with 763 additions and 58 deletions

View file

@ -110,7 +110,7 @@ enum Verb {
/// credentials autoinjected. Pairs with `pr create --agit`.
Clone(verbs::clone::Args),
/// Create a forge repo under the current user (or `--org`). Prints
/// the repo URL. Agent accounts can't create repos (limit 0).
/// the repo URL. Agent accounts create repos only up to their own limit (0 by default).
RepoCreate(verbs::repo_create::Args),
/// Add a collaborator to the active repo (`-r`/`HIVE_FORGE_REPO`)
/// with a permission level. Companion to `repo-create`.

View file

@ -5,8 +5,9 @@
//!
//! Wraps `POST /api/v1/user/repos` (or `/orgs/{org}/repos`). For accounts
//! that may create repos (operators, non-agent users). Agent accounts
//! cannot: swarm-controller sets their repo-creation limit to 0, and
//! Forgejo reports that as a bare 500 on the user path, which
//! cannot unless the operator allows it: swarm-controller sets their
//! repo-creation limit to the agent's own `max_repos` (0 by default), and Forgejo
//! reports a used-up limit as a bare 500 on the user path, which
//! `explain_create_error` turns into a message naming the operator path.
//! The instance has push-to-create disabled, so `git push` to a
//! non-existent repo 403s. Pairs with `clone` and `repo-add-collaborator`.
@ -57,9 +58,10 @@ fn explain_create_error(org: Option<&str>, err: ForgejoError) -> anyhow::Error {
}
anyhow::anyhow!(
"this account most likely cannot create repositories (the forge answered 500, which is \
how Forgejo reports a repo-creation limit of 0). On hyperhive, agent accounts are \
locked to 0 by design, so an operator merge stays the only path to main. Ask the \
operator to create the repo (for example `agents/<name>`) and add you as a collaborator."
how Forgejo reports a used-up repo-creation limit, 0 included). On hyperhive, agent \
accounts are locked to 0 unless the operator raises its limit, so an operator merge stays \
the only path to main. Ask the operator to create the repo (for example \
`agents/<name>`) and add you as a collaborator."
)
}