A forge is an origin (#8900, first piece)

Connect another forge at /settings/origins: type its address and press "Sign in there". A token it gave you (Settings, Tokens there; ro is enough to bring code across) is the path for when sign-in is unavailable. discover asks GET /api/v1/version; a forge answers {"version", "software":"forge"} (a 0.5.x forge has no such route, and is known by /api/v1/health with its OAuth metadata), and is stored as an origin with software = forge (kind gitea, the dialect it speaks).

Measured against an older forge and itself, in containers: the compatibility matrix, scripts/forge-compat-lab.sh.

Sign in with one click (#8902)

Type the friend's address at /settings/origins and press "Sign in there". If the address is a forge, this forge registers itself there (POST /oauth/register, RFC 7591, a public client, kept per user and host), then sends the browser to its approval page with PKCE and the scope ro — the least that brings code across. The friend sees who asks and what for, picks the lifetime, and the browser returns to /settings/origins/callback. No client id or token is copied. A sign-in begun from /bring keeps its link on the flow (return_query) and carries straight on with the bring; a callback reaching a browser signed out here signs in and resumes, its state unspent.

Not yet: review and check state coming back live, guest rules for a crew on the receiving side.

Not yet, in order: follow upstream between forges with a pull back, and the one-page paste-a-link path. Test: test/forge-origin.test.ts runs two forges against each other.

Follow the forge it came from (#16069)

A repository brought across with a connected origin (migrate) keeps the address it came from and the origin whose credential reads it. Under its head an admin sees the state ("Brought from <host>/<owner>/<name>; new commits there are not shown here") and one Follow button that opens a question and, answered, turns the upstream follow on (src/origins/follow.ts, src/web/pages/origin-follow.ts, POST /:owner/:name/follow-origin, which needs the confirming field); the same place says Stop following once it is on. The terminal's About screen (src/tui/screens/about.ts) has the same press on g, behind a confirm, through the same setOriginFollow, so a web viewer sees it live. A new commit on the source's default branch then shows as "N commits behind" at the next check (every 30 minutes, or "Check upstream now"), as a pack's follow does. The credential is the origin's, handed to git through the environment at check time, never argv or config; it is sent only to the origin's own https address (a test may allow a loopback address over http with credentialOverLoopback; production never does).

Both presses write a repo.origin_follow event for the admins' history. An origin that needs signing in again (or was disconnected) stops the follow at its next check and says so on the repository and in the check history; the offer then points to Origins until it is signed in. A mirror (a repository that syncs with its origin) is not offered this: its sweep already takes what is new. Test: test/forge-origin-follow.test.ts, two forges.

Issues and comments both ways (#8967)

On a brought repository an issue or comment opened here is written to the origin as the connected account (src/origins/write-through.ts), then reflected here under the origin's own number and id.

Both doors, and what was exercised

The terminal reaches the same code as the web and the API: src/tui/screens/issue.ts and pull.ts comment and change state through addCommentThrough and setIssueStateThrough (src/actions/issues.ts), which call providers.createComment / setState when the repository is a mirror. The one-click sign-in has no terminal path (a forge has no device grant): Connected origins and Origin apps say so and point to the web page, and the terminal connects a forge with a token.

A forge's comments carry no edit time, so updatedAt is read when the forge sends one and is the creation time otherwise: an edited comment syncs once the forge reports edits. A thread is paged to its end; one of more than 100,000 comments is a failed sync, never a short one.

The preview of the pull was not exercised: the write-through is proven by test/forge-origin.test.ts (two forges in one process, including the origin going down and coming back), not by hand on the preview.

What you can see there (#8900)

/settings/origins/:id/repos and GET /api/v1/user/origins/:id/repos?group=yours|shared|public&q=&cursor= show three groups, read live, searched and paged: repositories the account owns, ones it was let into, and what anyone may read on that forge. Owning nothing there is not an empty list. A forge is read by GET /api/v1/repos on every release, so "shared" means another account's private repository or anything in an organization the account belongs to; a public repository one person was given write on reads as public, since a forge's JSON carries no rights. Forgejo and Gitea use /repos/search. GitHub sorts the account's own list into yours and shared and has no public group.

Any of them can be mirrored here, and a mirror follows the one there. Sending work back from a repository someone else owns takes a token that can write there: contribute forks it there and opens a pull, and a read-only connection is refused in words. Test: test/origin-repo-groups.test.ts.

The sync contract (src/git/sync_link.ts)

One contract written for every shape a network takes: a follower, a fork, a mirror, two forges syncing both ways, a forge with several upstreams, and a diamond. Today only one shape has a door: a fork following its parent on the same forge. Nothing yet calls it between two forges (no API, MCP, web or terminal door syncs a repository with one on another forge); the other shapes are exercised by tests alone. A link is judged (judgeLink: synced, behind, ahead or diverged, with the counts and the one action that reconciles it: fast-forward, offer, merge, or keep both) and synced (syncLink).

Where you meet it. A fork's standing against its parent now names the one action that reconciles it (none, fast-forward, offer, merge, keep-both) and says it in words: in the following API read (action, words), on the fork's home card, in the terminal's forks screen (Forks → the follows row), and in MCP following. Taking the parent's work (fastForwardFork, which every push to the parent triggers) goes through syncLink, so it is compare-and-swap, stages the parent's tip at refs/following/<branch>, and refuses a divergence. source is always a repository path computed from rows, never text a person typed. Syncs into the same repository's stage ref take turns, so a push's follow-on and a person's click at once never race on that ref (test: "syncs at once into one stage ref take turns").

test/sync-shapes.test.ts walks each shape with real git between bare repositories on one machine. scripts/forge-compat-lab/shapes.ts holds the same shapes as lab cells between two real forges, but they have not run yet: they run only when asked for (LAB_ONLY=shapes scripts/forge-compat-lab.sh) and are not proven until a docker host has walked them. A sync at one door reaches a web viewer live: a sync that moves a fork's branch, or is refused, appends one fork.linked event on the fork (announceLink, src/core/following.ts) carrying the link word and its count, and nothing else. It travels the page's one /events stream to those who may read the fork, and the fork's home card and the flows view (/flows/map) swap the word in place from what the server renders (test: test/fork-linked-event.test.ts). Each fork's link to its parent wears one word on the flows view (linkWord, src/flows/view.ts): following, behind N, conflicted, severed, or quiet (not read lately, or taking but not taken within the period; never green). It reads the standing the card already kept, with no git and no polling (test: test/flows-link-word.test.ts). Not yet wired: the schedule probe, and the crew taking the action on autonomous repositories (the rest of #9451).

A downstream forge as a peer (#9451)

A child forge's proposal (child/<name>/… head, proposal token) used to wait for a person to approve the exact head even when that forge was trusted. Now a writer trusts the pair (forge, child:<name>) in the same trusted-sources list as an origin's account, on the same page (/settings/trusted) and in the same terminal screen: write child:kid as the account. The forge is the host of the origin the proposal token was minted for; the name is the one the writer chose when minting it. Its pulls then run their checks and fold in like a trusted origin's (foldsIn, src/core/trusted_sources.ts).

Why the two namespaces cannot cross. Origin accounts are cleaned by cleanAccount, which refuses :, and sourceOfUrl and mirrored authors use it, so no origin account can ever be spelled child:kid. A child is looked up only as child:<name>. Trusting person kid on a host does not trust a child kid there, nor the reverse (test: "an origin account never trusts a child of the same name").

Why the origin is not an unchecked claim. Only a person who can write this repository mints a proposal token, and they type the origin and name; the pull's proposal row is written only by a request carrying that token (proposal_gate). A claimed host is therefore the writer's own statement, and nothing is trusted until a writer also trusts that exact pair. Nothing here verifies the forge answers at that host; trust is "work pushed with the token I gave that forge".

Seeing why it ran. The proposal line on a pull, in the web, terminal, API (proposal.folds) and MCP, says "trusted as child:<name> (trusted sources), so its checks run" when it does.

What still protects this forge:

Tests: test/trusted-downstream.test.ts. The other limits of #9451 are separate issues linked to it.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs