René's URL Explorer Experiment


Title: feat: Gitea and Forgejo git provider for Coder Agents · Issue #32588 · coder/coder · GitHub

Open Graph Title: feat: Gitea and Forgejo git provider for Coder Agents · Issue #32588 · coder/coder

X Title: feat: Gitea and Forgejo git provider for Coder Agents · Issue #32588 · coder/coder

Description: gitprovider.New implements GitHub and GitLab. The gitea external auth type is accepted but returns no provider, so Coder Agents chats whose repository is hosted on Gitea or Forgejo get no diff viewer or pull request status (Config.Git() ...

Open Graph Description: gitprovider.New implements GitHub and GitLab. The gitea external auth type is accepted but returns no provider, so Coder Agents chats whose repository is hosted on Gitea or Forgejo get no diff view...

X Description: gitprovider.New implements GitHub and GitLab. The gitea external auth type is accepted but returns no provider, so Coder Agents chats whose repository is hosted on Gitea or Forgejo get no diff view...

Opengraph URL: https://github.com/coder/coder/issues/32588

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: Gitea and Forgejo git provider for Coder Agents","articleBody":"`gitprovider.New` implements GitHub and GitLab. The `gitea` external auth type is accepted but returns no provider, so Coder Agents chats whose repository is hosted on Gitea or Forgejo get no diff viewer or pull request status (`Config.Git()` documents Gitea as \"not implemented yet\", and #28141 / #32116 already plan for \"the release that adds a provider\").\n\nI've implemented a provider for the existing `gitea` type that covers both Gitea and Forgejo, and I'm volunteering to see it through review and maintenance. I'm moving a real project's agent workflow, hosted on a self-hosted Forgejo, onto Coder Agents, so this will get production use as well as testing against test instances.\n\n**Proposal:** add a Gitea and Forgejo provider for Coder Agents. The full implementation is up as **draft PR #32591** so you can review the approach and the assumptions below before I mark it ready. It builds on two small, independent fixes that are ready for review now: #32589 (Gitea external auth defaults) and #32590 (pull request URL parsing in the Agents UI).\n\n@coder/community-triage\n\n## Design\n\n- One `giteaProvider` in `coderd/externalauth/gitprovider/gitea.go`, registered in `New` for `\"gitea\"`. Plain `net/http`, modeled on `github.go`. I avoided `code.gitea.io/sdk/gitea` because its client calls `/version` at construction time.\n- Forgejo is a fork of Gitea and keeps the same `/api/v1` REST API for everything this interface needs, so a single implementation handles both. Following the lesson from Renovate (which split Gitea and Forgejo into two platforms and later merged them back, renovatebot/renovate#45825), the provider stays a single implementation. Where the servers differ, it uses requests that behave correctly on both instead of detecting the server type or version.\n- Method mapping:\n  - `FetchPullRequestStatus`: `GET /repos/{o}/{r}/pulls/{n}` (title, state, merged, draft, head/base, additions/deletions/changed_files, user) and `GET /repos/{o}/{r}/pulls/{n}/reviews`, mapped to `Approved` / `ChangesRequested` / `ReviewerCount` using each reviewer's latest review: dismissed reviews count as decisive but not approving, and approvals Gitea marks stale still count, as on GitHub. Commit count from `GET .../pulls/{n}/commits` (Gitea does not return it on the PR object).\n  - `ResolveBranchPullRequest`: `GET /pulls?state=open&head=\u003cbranch>`. Forgejo filters by head server-side; Gitea ignores the parameter, so results are always filtered client-side on `head.ref` and `head.repo` (excluding forks), scanning at most 10 pages of 50. No server type or version detection is needed.\n  - `FetchPullRequestDiff`: `GET /repos/{o}/{r}/pulls/{n}.diff`, bounded by `MaxDiffSize`.\n  - `FetchBranchDiff`: `GET /repos/{o}/{r}/compare/{base}...{head}?output=diff`. Gitea 1.27 and later return a raw diff. Forgejo and older Gitea return JSON for this request and have no other token-authenticated way to get a branch diff (I tested the web compare page; it rejects API tokens), so the provider returns an error wrapping `errors.ErrUnsupported` and the diff appears once a PR is opened.\n  - URL helpers: `/pulls/{n}` (not `/pull/`), HTTPS and SSH origins including custom ports (`ssh://git@host:2222/o/r.git`), and instances behind a subpath.\n- `site/src/pages/AgentsPage/utils/pullRequest.ts` only accepts `/pull/\u003cn>`; extend it to accept `/pulls/\u003cn>`.\n- Docs: add a Gitea and Forgejo section to `docs/coder-agents/platform-controls/git-providers.md` with known limitations.\n\n## Differences from the GitHub and GitLab providers\n\nThese are deliberate, and each is documented under Known limitations in `git-providers.md`:\n\n| Area | Behavior | Reason |\n|---|---|---|\n| Branch diff before a PR | Gitea 1.27+ only; others return `errors.ErrUnsupported` | Verified on Forgejo 15/16 and Gitea 1.26: no token-authenticated raw branch diff. I plan a separate Forgejo PR adding `output=diff` to its compare API, which this provider already sends. |\n| Branch to PR lookup on Gitea | Scans at most 500 open PRs | Gitea has no head filter; bounds API cost. Forgejo filters server-side. |\n| Stale approvals | Count unless dismissed | Matches GitHub and the Gitea UI. Gitea's \"dismiss stale approvals\" setting marks them dismissed. |\n| Response caching | None (3 requests per refresh) | Same as GitLab. |\n| Token revocation on unlink | Not available | Gitea and Forgejo advertise no revocation endpoint. This is in external auth, not the provider, and is out of scope here; noting it for transparency. |\n\n## PR stack\n\nOpened: #32589 (1), #32590 (2), and #32591 (3, draft).\n\n1. `fix(coderd/externalauth)`: derive the Gitea API base URL from the auth URL host (it is always `https://gitea.com/api/v1` today, so self-hosted instances call gitea.com), and remove a stray space from the default `\" write:repository\"` scope. Small and independent; opened alongside this issue.\n2. `fix(site/src/pages/AgentsPage/utils)`: accept Gitea's `/pulls/\u003cn>` URLs in the fallback pull request URL parser. Small and independent; opened alongside this issue.\n3. `feat(coderd/externalauth)`: the provider, unit tests, registration, and docs, stacked on PR 1. Opened as a draft so you can steer the assumptions below first. It is about 1,050 lines, slightly over the ~1,000 guideline; roughly half is tests. I can split the docs into a follow-up if you prefer.\n4. Optional: recorded integration tests (go-vcr), following the GitLab precedent (#25653), recorded against throwaway public repositories on test instances.\n\n## Assumptions I made (happy to change any of them)\n\nThe implementation is written and tested (PR 3 is open as a draft so you can see it), but these choices are yours to make. Tell me if you'd prefer otherwise and I'll rework it:\n\n- **One `gitea` provider covers Forgejo.** I reused the existing `gitea` external auth type rather than adding a `forgejo` type, because Forgejo serves the same API for everything the provider needs.\n- **Branch diff gap uses `errors.ErrUnsupported`.** On servers that can't produce a branch diff, `FetchBranchDiff` wraps the standard sentinel recommended in `.claude/docs/GO.md` rather than adding a new error type.\n- **Chat handler and UI are unchanged.** On those servers the Agents Git panel shows the generic red \"Failed to get chat diff\" error until a PR is opened, the same rendering any provider diff error gets today. A neutral \"diff available after a pull request is opened\" state would be a nicer follow-up, but I left that design to you.\n- **No `stale_at` reset for parked `gitea` rows.** #28141 and #32116 plan a reset \"when a provider implementation ships.\" PR 3 doesn't include one, since #32116 is still open; I can add it to whichever PR lands second.\n- **Coordination with #32388.** That open PR renames `checkRateLimitError` and adds `ErrTokenRejected`. If it lands first I'll rebase and return `ErrTokenRejected` on 401 so Gitea users get the reconnect button.\n\n## Testing\n\nBefore opening any PR I ran the provider against live Forgejo 15.0.12, Forgejo 16.0.7, Gitea 28.4.0, Gitea 1.27.3, and Gitea 1.26.4, covering PR status and review mapping, branch resolution including a fork with the same branch name, diffs, private repositories, and failure cases (no token, user without access, revoked token, token without repository scope, missing PR or branch, unreachable server). The external auth OAuth flow was tested end to end with Coder's default Gitea scopes. I also ran the same checks on my production Forgejo (15.0.10) with the OAuth token Coder stored, on throwaway repositories (one check, a token without the repository scope, was covered only on the test instances), and ran a Coder Agents chat end to end against test instances and production: the agent pushed a branch through external auth, and the PR status and diff appeared in the Agents UI. Output and screenshots are attached to each PR.\n\nAI disclosure: this work is AI-assisted (Claude Code) per `contributing/AI_CONTRIBUTING.md`. I have reviewed, tested, and am accountable for all changes, and each PR will include manual verification output.\n\n","author":{"url":"https://github.com/jtperry","@type":"Person","name":"jtperry"},"datePublished":"2026-11-22T19:43:16Z","url":"https://github.com/coder/coder/issues/32588"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d0413072-c069-f020-5a6c-f3c366402e32
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9F1C:11C492:674EE:8E481:6B044C7C
html-safe-nonce8c5b988505d15faa482456e1258825477201ff87eafeac1794da2f75037376ef
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjFDOjExQzQ5Mjo2NzRFRTo4RTQ4MTo2QjA0NEM3QyIsInZpc2l0b3JfaWQiOiI4MTg2ODQyNTg0Mzk2ODc2OTI0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca3f7ffafc5df33db6fbb4624541681ff11cef6f4368d77de979630211ba0fae8
hovercard-subject-tagissue:6546881029
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/32588/issue_layout
twitter:imagehttps://opengraph.githubassets.com/38d1aaf70de41ec11e492ee3a6ad14b988ca093bd5e095ecc7635d031631c7cb/coder/coder/issues/32588
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/38d1aaf70de41ec11e492ee3a6ad14b988ca093bd5e095ecc7635d031631c7cb/coder/coder/issues/32588
og:image:altgitprovider.New implements GitHub and GitLab. The gitea external auth type is accepted but returns no provider, so Coder Agents chats whose repository is hosted on Gitea or Forgejo get no diff view...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejtperry
hostnamegithub.com
expected-hostnamegithub.com
None002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730
turbo-cache-controlno-preview
go-importgithub.com/coder/coder git https://github.com/coder/coder.git
octolytics-dimension-user_id95932066
octolytics-dimension-user_logincoder
octolytics-dimension-repository_id440752086
octolytics-dimension-repository_nwocoder/coder
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id440752086
octolytics-dimension-repository_network_root_nwocoder/coder
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release059f24c781e3a0d7df3f27a97da0e93fab06ae39
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/coder/coder/issues/32588#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F32588
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fissues%2F32588
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=coder%2Fcoder
Reloadhttps://github.com/coder/coder/issues/32588
Reloadhttps://github.com/coder/coder/issues/32588
Reloadhttps://github.com/coder/coder/issues/32588
coderhttps://github.com/coder
coderhttps://github.com/coder/coder
Codehttps://github.com/coder/coder
Issues322 (322)https://github.com/coder/coder/issues
Pull requests475 (475)https://github.com/coder/coder/pulls
Discussionshttps://github.com/coder/coder/discussions
Actionshttps://github.com/coder/coder/actions
Projectshttps://github.com/coder/coder/projects
Security and quality49 (49)https://github.com/coder/coder/security
Insightshttps://github.com/coder/coder/insights
https://github.com/coder/coder
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/32588
New issuehttps://github.com/login?return_to=https://github.com/coder/coder/issues/32588
#32591https://github.com/coder/coder/pull/32591
feat: Gitea and Forgejo git provider for Coder Agentshttps://github.com/coder/coder/issues/32588#top
#32591https://github.com/coder/coder/pull/32591
https://github.com/jtperry
jtperryhttps://github.com/jtperry
on Nov 22, 2026https://github.com/coder/coder/issues/32588#issue-6546881029
#28141https://github.com/coder/coder/issues/28141
#32116https://github.com/coder/coder/pull/32116
#32591https://github.com/coder/coder/pull/32591
#32589https://github.com/coder/coder/pull/32589
#32590https://github.com/coder/coder/pull/32590
feat(platform): validate gitea responses with schemas and share the implementation with forgejo renovatebot/renovate#45825https://github.com/renovatebot/renovate/pull/45825
#32589https://github.com/coder/coder/pull/32589
#32590https://github.com/coder/coder/pull/32590
#32591https://github.com/coder/coder/pull/32591
test: add integration tests for gitlab git provider #25653https://github.com/coder/coder/pull/25653
fix(coderd/x/gitsync): stop retrying unimplemented git provider types forever #28141https://github.com/coder/coder/issues/28141
fix(coderd): back off for a day on unimplemented git provider types #32116https://github.com/coder/coder/pull/32116
fix(coderd): back off for a day on unimplemented git provider types #32116https://github.com/coder/coder/pull/32116
fix: show inline reconnect when git provider rejects owner token #32388https://github.com/coder/coder/pull/32388
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Nov 22, 2026https://github.com/coder/coder/issues/32588#issuecomment-7084625555
Linear Codehttps://linear.app
ENG-3562https://linear.app/codercom/issue/ENG-3562
Sign up for freehttps://github.com/signup?return_to=https://github.com/coder/coder/issues/32588
Sign in to commenthttps://github.com/login?return_to=https://github.com/coder/coder/issues/32588
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.