GitLab integration: remaining gaps for production readiness
Summary
The GitLab integration backend is substantially complete, but several gaps remain before it's production-ready. The primary blocker is web authentication — there's no GitLab OAuth flow, so users can't log in to a GitLab-configured deployment.
What's Done
- Provider abstraction —
SourceControlProviderinterface, factory, config resolver all support GitLab - GitLab provider (
gitlab-provider.ts) — fully implemented with PAT auth: repos, branches, merge requests, push auth, clone URLs - Tests — comprehensive test coverage for all provider methods + state mapping
- Modal data plane — clone token routing and VCS env var injection handle
SCM_PROVIDER=gitlab - Sandbox runtime — uses generic
VCS_HOST/VCS_CLONE_USERNAME/VCS_CLONE_TOKEN, works for GitLab automatically - Web URL utilities —
getScmRepoUrl/getScmBranchUrlare provider-aware - Documentation — ADR, provider checklist, env var docs all in place
- Route wiring —
GITLAB_ACCESS_TOKENandGITLAB_NAMESPACEread from env and passed to provider
Remaining Gaps
Blocking
- [ ] No GitLab OAuth login —
packages/web/src/lib/auth.tsis hardcoded toGitHubProviderfrom next-auth. Need to add a GitLab OAuth provider and make the login flow provider-aware. - [ ] "Sign in with GitHub" UI —
packages/web/src/components/sidebar-layout.tsxhassignIn("github")hardcoded. Login button text and provider must be dynamic based onNEXT_PUBLIC_SCM_PROVIDER.
Cosmetic / Minor
- [ ] "View in GitHub" label —
packages/web/src/components/action-bar.tsxstill shows GitHub-specific text in the PR dropdown. - [ ] Avatar URLs —
packages/control-plane/src/session/participant-service.tsgetAvatarUrl()returnsundefinedfor GitLab users (only generates GitHub avatar URLs). - [ ] JWT field naming —
auth.tsusesgithubUserId/githubLoginfield names in the JWT, which is misleading for GitLab deployments.
Feature Gaps
- [ ] Reviewer assignment —
gitlab-provider.tslogs aconsole.warnbecause GitLab requires numericreviewer_ids(username→ID resolution not implemented). - [ ] Self-hosted GitLab —
GITLAB_API_BASEis hardcoded tohttps://gitlab.com/api/v4. No support for self-hosted instances.
Operational Gaps
- [ ] Terraform variables — No
GITLAB_ACCESS_TOKEN,GITLAB_NAMESPACE, orSCM_PROVIDERvariables interraform/environments/production/. Must be set manually in Modal secrets. - [ ] Modal still requires GitHub App secrets —
packages/modal-infra/src/app.pyhasgithub_app_secretsas a required Modal secret even for GitLab-only deployments. GitLab deployments need dummy GitHub App secrets to pass validation.
Suggested Priority
- GitLab OAuth login + provider-aware sign-in UI (unblocks GitLab deployments)
- Cosmetic fixes ("View in GitHub", avatars, JWT field names)
- Terraform variable support
- Decouple Modal from GitHub App secrets requirement
- Self-hosted GitLab + reviewer assignment (future enhancements)
@duboff few remaining pieces to get this operational
Reviewed current main at 6fbb915.
Current state
GitLab support is not production-ready. The provider and low-level sandbox credential plumbing are substantial, but the production router currently rejects nearly every GitLab-dependent route with 501, including the normal repository, session creation, and MR flows. GitLab OAuth and deploy-time configuration are also still absent.
Of the issue’s 9 explicit remaining gaps:
- Resolved/obsolete: 1 (
githubUserId/githubLoginJWT naming; auth has moved to Better Auth with generic provider identities) - Partially improved but incomplete: 1 (sign-in UI is dynamically driven by enabled auth providers, but GitLab is not a supported auth provider)
- Still open: 7
Completed
- Provider abstraction, deployment resolver, and factory support
gitlab. - PAT-backed GitLab provider implements repository lookup/access, repository and branch listing, MR creation/state mapping, nested namespaces, push credentials, and manual MR/push URLs.
- Modal selects
GITLAB_ACCESS_TOKENforSCM_PROVIDER=gitlaband injects genericVCS_HOST/VCS_CLONE_USERNAME/VCS_CLONE_TOKEN. - Sandbox runtime scopes git credentials to the configured VCS host.
- Web repository and branch URL helpers support GitLab and nested namespaces.
/sessions/:id/scm-credentialsis explicitly enabled for GitLab.- Unit coverage for these low-level paths is strong.
Original gaps
- GitLab OAuth: open/blocking. Shared auth types only permit GitHub and Google (source); Better Auth also configures only those providers (source, source).
- Provider-aware sign-in UI: partial. The UI now discovers enabled providers rather than hardcoding
signIn("github"), but GitLab cannot be returned or rendered because the shared provider union excludes it. A GitLab SCM deployment therefore still advertises GitHub/Google auth, not GitLab auth. - “View in GitHub”: open. The overflow action still uses the GitHub icon and label (source).
- GitLab avatars: open. The avatar helper only handles GitHub (source). Persisting the OAuth profile avatar would be more robust than synthesizing a GitLab URL, especially for self-hosted instances.
- JWT field naming: resolved/obsolete. Current auth uses generic Better Auth account fields (
provider,provider_user_id,user_id) rather than the old GitHub-specific JWT fields (source). - Reviewer assignment: open. Reviewers are explicitly warned about and ignored because username-to-ID resolution is not implemented (source).
- Self-hosted GitLab: open. API, web, clone, and runtime hosts are hardcoded to
gitlab.com; this needs coordinated API/web/clone/OAuth configuration, not onlyGITLAB_API_BASE. - Terraform wiring: open/blocking. There are no Terraform occurrences of
SCM_PROVIDER,GITLAB_ACCESS_TOKEN,GITLAB_NAMESPACE,NEXT_PUBLIC_SCM_PROVIDER, orGITLAB_API_BASE. The control plane, Modal runtime, and web build can therefore drift and default to GitHub. - Modal GitHub App dependency: open. Terraform always creates a
github-appsecret (source), and Modal declares all GitHub App keys as required (source).
Additional gaps found
- Production router gate is the largest blocker. For GitLab, only
/sessions/:id/scm-credentialsis treated as implemented; other non-public/non-agnostic routes return501(source). This blocksGET /repos, branch listing,POST /sessions, andPOST /sessions/:id/pr, making much of the provider implementation unreachable through normal production requests. Existing router tests intentionally assert this behavior. - OAuth alone would not complete user-authenticated GitLab sessions. Session identity/token enrichment is GitHub-only (source). GitLab needs account selection, token enrichment/refresh, participant persistence, and MR attribution paths.
- No GitLab pagination. Repository and branch calls request
per_page=100once and do not followX-Next-Page/Linkheaders (source, source). Deployments with more than 100 projects or branches silently get incomplete data. - Provider-specific leftovers remain. Non-GitHub git author fallback still uses
[email protected]; some errors mention GitHub App installation; automation/webhook surfaces and the installed agent CLI remain GitHub-specific (github_event, GitHub bot,gh, with no GitLab webhook/bot orglabequivalent). These should either be generalized or documented as unsupported. - Repository cache is not provider-scoped. Switching a deployment’s SCM provider can temporarily serve stale repository data from the previous provider.
- Documentation overstates deployability. The README says the GitLab variables are configured through Terraform, but Terraform does not define them, while the ADR implies GitLab is implemented even though the production gate rejects its main routes.
Recommended completion order
- Define one Terraform-backed SCM configuration and propagate it consistently to control plane, Modal, and the web build; make GitHub App secrets conditional.
- Implement GitLab OAuth plus canonical identity/token enrichment and refresh.
- Enable and integration-test the GitLab router paths end to end: repos, branches, session creation, sandbox clone/push, and MR creation.
- Add pagination, provider-neutral UI/errors/identity fallbacks, and GitLab avatar persistence.
- Add reviewer resolution and self-hosted GitLab support as explicit follow-ups if they are not required for the first production milestone.
Validation
Targeted tests on current main passed:
- Control plane: 3 files, 88 tests
- Web: 3 files, 22 tests
- Modal: 34 tests
These verify the implemented low-level pieces, but no current end-to-end test proves a Terraform-deployed GitLab instance can authenticate, create a session, clone/push, and open an MR.