Add GitLab Duo provider (subscription-backed coding model)
Summary
Add a native GitLab Duo provider mirroring pi_agent_rust's implementation. Lets users with a GitLab Duo subscription use it inside jcode the same way they use Copilot or Claude Max today.
Reference: pi_agent_rust provider list referring to "GitLab Duo" — see Architecture ("10 native provider implementation modules in src/providers/: Anthropic, OpenAI Chat, OpenAI Responses/Codex Responses, Gemini, Cohere, Azure OpenAI, Bedrock, Vertex AI, GitHub Copilot, and GitLab Duo").
Why
- jcode already supports Copilot via OAuth; GitLab Duo is the equivalent subscription-backed coding model for the GitLab ecosystem.
- Many enterprises pay for GitLab Duo and would adopt jcode if it could ride that subscription instead of asking for a separate API key.
Current state in jcode
- No
gitlab or duo references in src/provider/. CLI --provider doc string doesn't include it. No auth.json schema entry.
Implementation checklist
1. Auth
2. Provider implementation
3. Models
4. CLI surface
5. Telemetry + errors
Testing
Unit
Live (gated)
Manual
Acceptance criteria
- OAuth works against both gitlab.com and a self-hosted instance.
- Refresh-on-401 is automatic and only re-prompts if refresh genuinely fails.
- Streaming + tool calls + usage tracking work end to end.
jcode auth-test --provider gitlab-duo returns OK after login.
References
pi_agent_rust: Architecture — provider list.
- GitLab Duo API docs at integration time.
Implementation notes addendum (Devin gap-analysis pass, 2026-05-21)
Verified jcode code paths
- Add new file
src/provider/gitlab_duo.rs patterned on src/provider/copilot.rs (subscription-backed providers share OAuth + per-request bearer-token rotation).
- Auth integration:
src/auth/, login flow in src/cli/login/, picker in src/tui/login_picker.rs.
GitLab Duo specifics
- Auth: GitLab OAuth (PKCE) against
https://gitlab.com/oauth/authorize. After exchange, store refresh token in the existing keychain wrapper.
- API: GitLab Duo Code Suggestions / Chat. Endpoint pattern:
https://gitlab.com/api/v4/code_suggestions/completions (completion-style) and https://gitlab.com/api/v4/chat/completions (chat). Confirm against the upstream API before coding.
- Models: treat the active subscription model as a single virtual model (
gitlab-duo-chat) at launch; gate any future model selection on the API actually exposing one.
- Self-hosted: allow
GITLAB_URL env to point at a self-managed GitLab; the login flow uses that base URL.
Acceptance criteria
jcode /login gitlab-duo walks PKCE flow.
jcode --provider gitlab-duo "..." works.
- Self-hosted endpoint configurable.
- Token refresh handled invisibly (no re-login mid-session).
jcode --list-providers includes GitLab Duo.
Cross-references
Reference
Add GitLab Duo provider (subscription-backed coding model)
Summary
Add a native GitLab Duo provider mirroring
pi_agent_rust's implementation. Lets users with a GitLab Duo subscription use it inside jcode the same way they use Copilot or Claude Max today.Reference:
pi_agent_rustprovider list referring to "GitLab Duo" — see Architecture ("10 native provider implementation modules insrc/providers/: Anthropic, OpenAI Chat, OpenAI Responses/Codex Responses, Gemini, Cohere, Azure OpenAI, Bedrock, Vertex AI, GitHub Copilot, and GitLab Duo").Why
Current state in jcode
gitlaborduoreferences insrc/provider/. CLI--providerdoc string doesn't include it. Noauth.jsonschema entry.Implementation checklist
1. Auth
jcode login --provider gitlab-duo:--no-browserfallback (jcode already supports this pattern for Claude/Copilot).~/.jcode/gitlab-duo-auth.json.--gitlab-host https://gitlab.example.com. Stored alongside the token.2. Provider implementation
src/provider/gitlab_duo.rsimplements theProvidertrait. Endpoint pattern (TBD against Duo API docs at integration time):https://<gitlab-host>/api/v4/code-suggestions/...or the chat-completion equivalent.3. Models
src/provider_catalog.rsanddocs/providers.md.4. CLI surface
--provider gitlab-duoaccepted.--providerdoc string insrc/cli/args.rs.auth-test --all-configuredcoverage.jcode usageshows Duo subscription quota when the API exposes it.5. Telemetry + errors
Testing
Unit
Live (gated)
JCODE_LIVE=1 cargo test gitlab_duoagainst a real Duo subscription (skipped by default).Manual
jcode login --provider gitlab-duo --gitlab-host https://gitlab.comthenjcode -p "Hello".--gitlab-host https://gitlab.example.com.Acceptance criteria
jcode auth-test --provider gitlab-duoreturns OK after login.References
pi_agent_rust: Architecture — provider list.Implementation notes addendum (Devin gap-analysis pass, 2026-05-21)
Verified jcode code paths
src/provider/gitlab_duo.rspatterned onsrc/provider/copilot.rs(subscription-backed providers share OAuth + per-request bearer-token rotation).src/auth/, login flow insrc/cli/login/, picker insrc/tui/login_picker.rs.GitLab Duo specifics
https://gitlab.com/oauth/authorize. After exchange, store refresh token in the existing keychain wrapper.https://gitlab.com/api/v4/code_suggestions/completions(completion-style) andhttps://gitlab.com/api/v4/chat/completions(chat). Confirm against the upstream API before coding.gitlab-duo-chat) at launch; gate any future model selection on the API actually exposing one.GITLAB_URLenv to point at a self-managed GitLab; the login flow uses that base URL.Acceptance criteria
jcode /login gitlab-duowalks PKCE flow.jcode --provider gitlab-duo "..."works.jcode --list-providersincludes GitLab Duo.Cross-references
Reference