Support multiple-account auth in fj (per-invocation account/credential override) #157

Open
opened 2026-06-12 16:51:28 +00:00 by gerri · 0 comments
Member

Problem

fj authenticates against rasterhub.com via a single git-credential helper tied to one account (here, the human operator stephen). Our agent fleet needs to post PR comments and formal reviews as a separate QA account (gerri) so agent activity is attributable and distinct from the operator, and so reviews on agent-authored PRs aren't blocked by "can't review your own pull." Today every fj action attributes to the default account, so we work around it by calling the Forgejo API directly with a PAT (e.g. POST /repos/{o}/{r}/pulls/{n}/reviews with Authorization: token <gerri-PAT>), bypassing fj entirely.

Request

Let fj select the account/credential per invocation, e.g.:

  • an env var (FJ_TOKEN / FJ_ACCOUNT) and/or a --token / --account flag, and/or
  • named credential profiles (fj auth login --account gerri; fj --account gerri pr review ...).

Default behavior unchanged when no override is given.

Must be flexible for BOTH account types (operator requirement)

The account model must not assume a single forge or a fjord-managed identity. Profiles must be keyed per (host, account), covering both:

  • a fjord account (rasterhub.com / fjord-managed identity, e.g. stephen, gerri), and
  • a standalone single-instance Forgejo account (an arbitrary host + token, not fjord-managed).

So an agent can act on a customer's independent Forgejo instance under that instance's own account, with credentials scoped to that (host, account) pair, while rasterhub.com fjord identities continue to work side by side. Selection (env/flag/profile) resolves the right token for the target host + chosen account.

Acceptance

  • fj pr review / fj pr comment / fj issue create can post as a specified non-default account given that account's token.
  • The default (box-helper) account is used when no override is set.
  • Per-(host, account) profiles: both fjord (rasterhub.com) and standalone arbitrary-host Forgejo accounts are selectable, with credentials scoped to the host they belong to.
  • Token/account never logged.

Use case

Multi-agent fleet on usw-dev-01: lanes post QA reviews as gerri, the lead/operator act as stephen. Agents may also need to act on a customer's independent Forgejo instance under its own standalone account. Filed by gerri to dogfood the need.

## Problem `fj` authenticates against rasterhub.com via a single git-credential helper tied to one account (here, the human operator `stephen`). Our agent fleet needs to post PR comments and **formal reviews** as a separate QA account (`gerri`) so agent activity is attributable and distinct from the operator, and so reviews on agent-authored PRs aren't blocked by "can't review your own pull." Today every `fj` action attributes to the default account, so we work around it by calling the Forgejo API directly with a PAT (e.g. `POST /repos/{o}/{r}/pulls/{n}/reviews` with `Authorization: token <gerri-PAT>`), bypassing `fj` entirely. ## Request Let `fj` select the account/credential per invocation, e.g.: - an env var (`FJ_TOKEN` / `FJ_ACCOUNT`) and/or a `--token` / `--account` flag, and/or - named credential profiles (`fj auth login --account gerri`; `fj --account gerri pr review ...`). Default behavior unchanged when no override is given. ### Must be flexible for BOTH account types (operator requirement) The account model must not assume a single forge or a fjord-managed identity. Profiles must be keyed per **(host, account)**, covering both: - a **fjord account** (rasterhub.com / fjord-managed identity, e.g. `stephen`, `gerri`), and - a **standalone single-instance Forgejo account** (an arbitrary host + token, not fjord-managed). So an agent can act on a customer's independent Forgejo instance under that instance's own account, with credentials scoped to that `(host, account)` pair, while rasterhub.com fjord identities continue to work side by side. Selection (env/flag/profile) resolves the right token for the target host + chosen account. ## Acceptance - `fj pr review` / `fj pr comment` / `fj issue create` can post as a specified non-default account given that account's token. - The default (box-helper) account is used when no override is set. - Per-(host, account) profiles: both fjord (rasterhub.com) and standalone arbitrary-host Forgejo accounts are selectable, with credentials scoped to the host they belong to. - Token/account never logged. ## Use case Multi-agent fleet on usw-dev-01: lanes post QA reviews as `gerri`, the lead/operator act as `stephen`. Agents may also need to act on a customer's independent Forgejo instance under its own standalone account. Filed by gerri to dogfood the need.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rasterstate/fj#157
No description provided.