Skip to content

GitLab Duo workflow fails on self-managed instances #50843

Closed as not planned
Closed as not planned

Description

@MJVNOR

Description

GitLab Duo workflow models do not work correctly with a self-managed GitLab instance.

I found two issues while testing this:

  1. Duo workflow models need the current working directory and GitLab project/namespace context.
  2. If the stored GitLab OAuth token is expired and the refresh fails, provider initialization throws and can prevent OpenCode from starting.

I reproduced the OAuth failure with an expired credential where the refresh endpoint returned invalid_grant.

Plugins

None

OpenCode version

0.0.0-dev-202609112115

Steps to reproduce

  1. Configure OpenCode to use a self-managed GitLab instance:

    $env:GITLAB_INSTANCE_URL = "https://gitlab.example.com"
    $env:GITLAB_HOST = "https://gitlab.example.com"
    
  2. Authenticate OpenCode with GitLab OAuth and configure GitLab Duo.

  3. Start OpenCode using the GitLab Duo workflow model:

    opencode -m gitlab/duo-workflow`
    
  4. On a self-managed GitLab instance, start a GitLab Duo workflow and observe that the workflow does not receive the working directory and project/namespace context required for the current repository.

  5. Let the stored GitLab OAuth credentials expire or make the refresh token invalid/revoked, then start OpenCode again.

  6. OpenCode attempts to refresh the expired GitLab OAuth token. If GitLab returns invalid_grant, provider initialization throws and OpenCode can fail to start.

  7. Removing the expired GitLab entries from auth.json allows OpenCode to start again. Re-authenticating restores GitLab access.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal / PowerShell 7

Activity

  1. github-actions commented on Sep 23, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your OAuth startup failure is the same as #50759 or #49439, it may be worth adding your reproduction details there. The context-passing issue for self-managed instances may be distinct enough to stand on its own.

  2. guillermovc commented on Sep 24, 2026

    @guillermovc

    I had that problem too, both on Linux and Windows

  3. cazaroni commented on Sep 25, 2026

    @cazaroni

    I came across this issue as well while running Arch Linux under WSL. Seems like I had similar behavior with GitLab Duo on a self-managed GitLab instance, so that would seem to indicate the issue is OS-agnostic.

  4. KarolBurrola commented on Sep 25, 2026

    @KarolBurrola

    I had some issues with it too, and couldn’t get everything to work properly

  5. l22330896-arch commented on Sep 25, 2026

    @l22330896-arch

    Had a rough time getting this working on Windows too, ended up stuck on the same problems.

  6. ana-chenoweth commented on Sep 25, 2026

    @ana-chenoweth

    It also didn’t work correctly for me, the same issues on Windows 11, I tried re-authenticating, but I still couldn't get it working

  7. GikAvecLeStik commented on Sep 25, 2026

    @GikAvecLeStik

    I can confirm this as well. The missing working directory and project/namespace context prevents the Duo workflow from having the repository context it needs. I also confirmed that an expired or invalid GitLab OAuth credential returning invalid_grant can cause provider initialization to fail and prevent OpenCode from starting.

    Removing the expired GitLab credentials from auth.json and re-authenticating resolves the startup issue, which confirms that the OAuth refresh failure is the cause.

  8. elba505 commented on Sep 25, 2026

    @elba505

    I ran into the same issue on Windows 11. Tried several fixes and configuration changes without success. Haven't found a reliable workaround yet. If anyone has additional troubleshooting ideas, I'd appreciate the suggestions.

  9. CarlosMancillas commented on Sep 25, 2026

    @CarlosMancillas

    I had the same problem everyone is having: it's not working on Windows 11. I tried re-authenticating to double-check that it was not that, but it still didn't work.

  10. trujillocharlotte0-oss commented on Sep 25, 2026

    @trujillocharlotte0-oss

    I’ve been seeing the same behavior on my end. Tried a few things but couldn’t get it to work as expected.

  11. rekram1-node commented on Oct 3, 2026

    @rekram1-node
    Collaborator

    I'm realizing now the agent stuff is kinda weird, are gitlab users wanting to use the duo agent? OR are you mostly just wanting to use duo models in opencode agent?

  12. MJVNOR commented on Oct 3, 2026

    @MJVNOR
    Author

    We want to use gitlab dúo models on opencode, whi the merge request that's i propuse is working for opencode v1

  13. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and for working on a fix in #50844, @MJVNOR!

    This was reported against OpenCode v1 (0.0.0-dev-202609112115, a build from before v2 became the main line). v1 now only gets fixes for critical bugs such as data loss, security problems, or breakage with no workaround. This one has a workaround (removing the GitLab entries from auth.json and logging in again), so it's unlikely to be fixed in v1.

    We'd encourage you to try v2 (@opencode/cli). Its GitLab provider was rewritten and, going by the code:

    • Duo workflow models get the current working directory, so the project context can be detected from the repository remote.
    • OAuth refresh uses the instance URL stored with the credential, which covers self-managed instances.
    • A failed provider load is caught instead of breaking startup, and a revoked or expired refresh token gets a specific error message.

    Related:

    If you see the same problem on v2, or you think this is critical, please reply here with your v2 version and what happens.

  14. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Closing this as not planned. It was reported against OpenCode v1 (0.0.0-dev-202609112115), which only gets critical fixes, and the expired-token startup failure has a workaround: remove the GitLab entries from auth.json and log in again. Thanks again for the report and for the work in #50844, @MJVNOR.

    v2 (@opencode/cli) passes the working directory to Duo workflow models, refreshes OAuth against your self-managed instance URL, and handles failed refreshes without breaking startup. If you still see either problem on v2, please comment here with your v2 version and what happens, and we can reopen this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions