Cogny's Code Agent Now Works With Forgejo: Pull Requests on Your Own Git Server
Cogny's code agent takes a ticket ("add a news page under /news", "fix the canonical tag on the pricing page") and returns a pull request. Until now that pull request had to land on GitHub.
Plenty of teams don't keep their code on GitHub. Healthcare, public sector and anyone with a data-residency requirement often run their own git server, and more and more of those servers are Forgejo, the community-run, self-hosted forge that also powers Codeberg.
The code agent now works with them. Connect a repository on your Forgejo instance and tickets become pull requests there, on your server, under your branch rules.
TL;DR
- Connect with an access token. Instance address,
owner/name, a token withwrite:repositoryandread:user. Cogny checks the token and the account's write access before it saves anything. - One branch and one pull request per ticket, opened against the base branch you choose (a
developbranch, for example, ifmainis protected). - Ask for changes and Fix Conflicts work as on GitHub. The agent pushes follow-up commits to the same pull request.
- Your branch rules decide who merges. The ticket shows the pull request's reviews, status checks and conflicts. Make it live merges it as the connected account, so it can merge where that account may (a
developbranch, say) and is refused where it may not (amainonly two people can merge), with Forgejo's reason shown on the ticket. - The ticket moves on by itself. When someone merges the pull request, Cogny picks it up within a few minutes and moves the ticket to impact analysis. No webhook needed, so you don't need admin rights on the repository.
- Your token stays with Cogny. The agent that edits your code works without it, and pushing and opening the pull request happen after the agent is done.
- Part of Cogny Cloud. Tell us your instance address and we'll switch it on for your workspace.
Why a self-hosted forge is different
GitHub has one front door: install an app, pick repositories, done. A self-hosted forge has no central app to install. Every instance is its own server with its own accounts. In practice the person setting this up is often a consultant or contractor who has been given branch-push rights on one repository, not an administrator of the whole instance.
The Forgejo integration is built around that:
- You connect with an account's token, not an app install. The pull requests are opened by that account. Use a dedicated bot account if you can. It keeps the history clear about which changes a person wrote and which the agent wrote, which matters when someone has to answer for a change months later.
- No webhook required. Adding a repository webhook needs admin rights, and the account doing the work usually doesn't have them. Cogny checks the pull requests it is tracking instead, so merged work still moves the ticket forward.
- Merging follows your rules, not ours. Teams that run their own forge tend to restrict merging to named people, sometimes with a separate reviewer for anything sensitive. Make it live merges as the connected account, so a protected branch stays protected: Cogny shows Forgejo's refusal and links you to the pull request.
What the pull request contains
Each pull request comes from a branch named after the ticket and says how it was made:
- what the agent changed and why, in its own words;
- the model that wrote it, the number of turns, and the ticket it came from.
If your repository has a CLAUDE.md or AGENTS.md, the agent reads it before it starts, so house rules ("never edit the routing table as part of a content change", "run npm test and paste the output") apply on Forgejo exactly as on GitHub. Workspace-level instructions under Settings → Coding Agent apply too.
Linking pull requests you opened yourself
If you or your own agent open a pull request by hand, link it to a ticket with the link_pr_to_ticket tool on the Cogny MCP server. A Forgejo pull request URL (https://code.example.com/owner/name/pulls/12) works for any repository connected to the workspace, and the ticket moves to analysis when it merges, the same as for agent-opened pull requests.
Requirements
- A Cogny Cloud workspace.
- A Forgejo instance reachable from the internet over HTTPS. Gitea speaks the same API, and Codeberg runs Forgejo.
- An account with write access to the repository and a token with
write:repositoryandread:user.
Get started
Already on Cogny Cloud? Send us your Forgejo instance address and we'll switch it on for your workspace. Then open Settings → Coding Agent → Forgejo repositories and connect your first repository.