GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — copilot: models fail to sync in shared service; attached models still resolve as unavailable · Issue #60702 · anomalyco/opencode

copilot: models fail to sync in shared service; attached models still resolve as unavailable #60702

New issue
Copy link
New issue
Copy link
Open
Open
copilot: models fail to sync in shared service; attached models still resolve as unavailable#60702
Copy link
Labels
reproduced

Description

@mazen-ghzaly
mazen-ghzaly
opened on Oct 30, 2026
Issue body actions

Description

Summary

GitHub Copilot models sync successfully only in --standalone mode. In the shared background service (serve --service, used by the desktop app and TUI), Copilot models are intermittently attached and then lost: the initial model sync after login fails with TimeoutError, models only appear after a later retry, and session runs still reject the models with Model unavailable even while /api/model lists them.

Environment

  • opencode version: 2.2.4 (channel: latest, desktop app-spawned CLI at ~/.config/ai.opencode.desktop/cli/2.2.4-x64/opencode-cli)
  • OS: Linux lordofwar 7.1.5+kali-amd64 feat: compact and other improvements #1 SMP PREEMPT_DYNAMIC Kali 7.1.5-1kali1 (2026-07-29) x86_64 GNU/Linux
  • Terminal: xterm-256color (OpenCode desktop app / zsh)
  • Shell: /usr/bin/zsh
  • Install/channel: latest (desktop app 2.2.4, Electron 44.9.1)
  • Active plugins: none (no opencode.json found at global or project locations)

Reproduction

  1. Connect GitHub Copilot via the desktop app (/connect → device OAuth). Credential is stored and active.
  2. Right after the credential is created (within ~5 s), the server logs:
    WARN message="failed to sync GitHub Copilot models" cause="TimeoutError: The operation timed out."
    
  3. A later retry attaches the models: GET /api/model returns 28 github-copilot/* models (verified repeatedly while attached).
  4. Despite that, running a session with one of the attached models fails:
    SessionRunnerModel.ModelUnavailableError: Model unavailable: github-copilot/gpt-5.4-nano
    
  5. Before any credential is present, or after the inventory drops, opencode models shows zero github-copilot models even though the provider is listed via GET /api/provider with an active credential.

Contrast: the identical setup in a private server works immediately and reliably:

opencode models --standalone | grep copilot   # 28 models, sync succeeds
opencode api --standalone get /api/model      # github-copilot: 28 models

Network to GitHub is healthy from the same machine and environment (no proxies):

  • curl https://api.githubcopilot.com/models → HTTP 400 in 0.49 s (expected without auth)
  • curl https://api.github.com → HTTP 200 in 0.21 s

Expected Behavior

In the shared background service, GitHub Copilot models should sync reliably after login and remain selectable, same as --standalone mode.

Actual Behavior

  • First model sync after login times out (TimeoutError) even though the endpoint responds in under a second from the same environment; only a later retry succeeds.
  • GET /api/model lists 28 Copilot models while SessionRunnerModel still resolves them as unavailable (Model unavailable: github-copilot/gpt-5.4-nano) — a registry/session-resolver mismatch.
  • Per the docs, a failed sync is supposed to be logged as failed to sync GitHub Copilot models; that log exists, but the models are still attached despite the failure — the attach/drop behavior appears to be a race between the failing sync and the inventory refresh.
  • Additionally, when a Copilot model does execute, GitHub rejects requests with:
    The requested model is not available for integrator "opencode". Verify the correct Copilot-Integration-Id header is being sent.
    

Additional Context

  • Timeline from ~/.local/share/opencode/log/opencode.log:
    20:20:04Z credential removed      integrationID=github-copilot
    20:20:34Z credential created      integrationID=github-copilot type=oauth
    20:20:39Z WARN "failed to sync GitHub Copilot models" cause="TimeoutError: The operation timed out."
    20:21:52Z GET /api/model          → github-copilot: 28 models attached
    20:23-20:29Z session attempts     → ModelUnavailableError: Model unavailable: github-copilot/gpt-5.4-nano
                                      (models still listed as attached at exactly the same time)
    
  • The models.dev catalog cache in the server KV store (models-dev:v2:catalog) does contain github-copilot with 36 models, so the local catalog is not the problem.
  • Credential state in the DB was active throughout; the token refresh works in standalone mode with the same stored credential, so OAuth is not the problem.
  • Observed both in desktop-app-spawned service (opencode-cli serve --service)and via CLI-discovered service; not reproducible with --standalone.
  • Frequency: reproducible every time a new Copilot credential is created (observed 3 logins); Silver models attached 28 steady for 8+ minutes but never resolvable by the session runner.
  • No workaround found for the service; standalone runs work but are not usable through the desktop app/TUI.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot

No response

Operating System

No response

Terminal

No response

Activity

  1. opencodejr commented on Oct 30, 2026

    @opencodejr
    opencodejrBot
    on Oct 30, 2026
    Contributor
    More actions

    Thanks for the detailed timeline. I was able to reproduce this with a mock Copilot API and a fake OAuth credential, on 2.2.4 and on the latest dev (9321c2c).

    What I did (the script below does the same):

    • Started a long-running opencode serve and opened one project in it.
    • Made the mock's first /models response slower than OpenCode's 5-second limit, then connected Copilot from that project. The server logged failed to sync GitHub Copilot models with TimeoutError: The operation timed out.
    • After that the mock answered instantly, but that project kept listing 28 github-copilot models, the same count you saw. Those come from the models.dev fallback list, not from your account's live model list, and the sync was never retried.
    • A second project in the same server synced the live list. Running github-copilot/gpt-5.4-nano there failed with Model unavailable: github-copilot/gpt-5.4-nano, even though the first project listed it.
    • From the first project, models from the fallback list were sent to Copilot even when the account doesn't offer them. With a real account, that likely explains the not available for integrator "opencode" error.

    --standalone syncs fresh on each run, which is why it worked for you.

    Related:

    • server: GitHub Copilot model sync and opencode.json changes require manual service restart to take effect #53413: a failed Copilot model sync in the background service is never retried until the service restarts. This is the same underlying problem.
    • GitHub Copilot model sync times out on 2.0.32 (manual API works) #57264: the same Copilot sync TimeoutError.

    Until this is fixed, restarting the background service after connecting Copilot (opencode service restart) should make it sync again.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Repro for #60702: in a long-running server, a GitHub Copilot model sync that times out once is never retried.
    # The location that hit the timeout keeps the models.dev fallback list (28 models) for good, while other
    # locations sync the account's live list, so a model listed in one location is "Model unavailable" in another.
    # Usage: bash repro.sh            (uses `opencode` from PATH)
    #        OC="bun --conditions=browser --preload=<repo>/packages/tui/node_modules/@opentui/solid/scripts/preload.js <repo>/packages/cli/src/index.ts" bash repro.sh
    set -u
    OC=${OC:-opencode}
    export OPENCODE_PASSWORD=repro60702
    R=$(mktemp -d /tmp/oc60702.XXXX)
    export XDG_DATA_HOME=$R/data XDG_CONFIG_HOME=$R/config XDG_STATE_HOME=$R/state XDG_CACHE_HOME=$R/cache
    mkdir -p $R/a $R/b
    cat > $R/mock.ts <<'TS'
    // Mock Copilot API. The first /models call hangs 8s (OpenCode aborts after 5s); later calls answer at once.
    let calls = 0
    const ids = ["gpt-5-mini", "gpt-4.1"]
    Bun.serve({ port: 4555, async fetch(req) {
      const p = new URL(req.url).pathname
      console.log(new Date().toISOString(), req.method, p)
      if (p.endsWith("/models")) {
        if (++calls === 1) await Bun.sleep(8000)
        return Response.json({ data: ids.map((id) => ({ id, name: id, version: id, model_picker_enabled: true,
          supported_endpoints: ["/chat/completions"],
          capabilities: { family: id, limits: { max_context_window_tokens: 128000, max_output_tokens: 16000, max_prompt_tokens: 100000 },
            supports: { tool_calls: true, streaming: true } } })) })
      }
      return new Response("not found", { status: 404 })
    } })
    TS
    cat > $R/cred.json <<'J'
    [{"id":"cred_mockcopilot0001","integrationID":"github-copilot","label":"mock","active":true,"value":{"type":"oauth","methodID":"oauth","refresh":"gho_mock","access":"gho_mock","expires":0,"metadata":{"apiEndpoint":"http://127.0.0.1:4555"}}}]
    J
    bun $R/mock.ts > $R/mock.log 2>&1 & MOCK=$!
    (cd $R && exec $OC serve --port 4777 > $R/server.log 2>&1) & SRV=$!
    sleep 6
    S="--server http://127.0.0.1:4777"
    (cd $R/a && $OC models $S >/dev/null 2>&1)   # open project location A before connecting
    # Connect Copilot while the server runs: A's sync hits the slow /models -> TimeoutError
    (cd $R/a && $OC auth import $S $R/cred.json)
    sleep 12   # from now on the mock answers instantly
    for i in 1 2; do
      echo "== [$i] project location A: number of github-copilot models listed =="
      (cd $R/a && $OC models $S 2>&1 | grep -c github-copilot)
      echo "== [$i] project location B: github-copilot models listed =="
      (cd $R/b && $OC models $S 2>&1 | grep github-copilot)
      sleep 10
    done
    echo "== run gpt-5.4-nano (listed in project location A) from B =="
    (cd $R/b && timeout 60 $OC run $S --model github-copilot/gpt-5.4-nano hi 2>&1 | tail -1)
    echo "== run gpt-5.4-nano from project location A (HTTP 404 from the mock = resolved and sent) =="
    (cd $R/a && timeout 60 $OC run $S --model github-copilot/gpt-5.4-nano hi 2>&1 | tail -1)
    echo "== mock log =="; cat $R/mock.log
    grep -rh "sync GitHub Copilot" $R/data $R/server.log 2>/dev/null | tail -2
    kill $SRV $MOCK 2>/dev/null; 

    Run it: bash repro.sh

  2. opencodejr
    added
    reproduced
    on Oct 30, 2026
  3. lazyalex616 commented on Nov 6, 2026

    @lazyalex616
    lazyalex616
    on Nov 6, 2026
    More actions

    Another trigger for the same symptom: switching the active Copilot credential while the background service is running. The service's Copilot model list goes stale, and sessions using a model that is missing from it fail locally with Model unavailable.

    Environment

    • OpenCode 2.2.5 (@opencode/cli, npm install), background service opencode serve --service
    • Windows 11 (10.0.26200)
    • Provider github-copilot with two stored credentials (account A: Copilot Business, account B: Copilot Enterprise)

    Steps to reproduce

    1. With the background service running, have a session whose selected model is github-copilot/gpt-6.1-sol (a second session used github-copilot/claude-opus-5.5).
    2. Change the active credential from another process: opencode auth switch github-copilot <account B> --standalone (a disposable private server that writes the shared credential table).
    3. Run opencode models (served by the background service) and opencode models --standalone.
    4. Send a prompt in the existing session.

    Actual

    • opencode models (service) does not list github-copilot/claude-opus-5.5 or github-copilot/gpt-6.1-sol. opencode models --standalone, with the same active credential, lists both.
    • The next prompt fails immediately with Error: Model unavailable: github-copilot/gpt-6.1-sol. Server log: SessionRunnerModel.ModelUnavailableError: Model unavailable: github-copilot/gpt-6.1-sol at SessionRunnerModel.resolve. No request reaches Copilot; the rejection is local (the catalogue lookup in resolve() misses).
    • The TUI still shows "Switched model to github-copilot/gpt-6.1-sol/high", so the session keeps a selected model that the server refuses.
    • Re-activating the same credential through the service (opencode auth switch github-copilot <account B>, without --standalone) does not restore the models.

    Workaround

    opencode reload fixes it: afterwards opencode models lists both models again and the session works. Reproduced the same way on a second Windows machine (stale catalogue after the switch, fixed by opencode reload). This may also help the original reporter, who found no workaround short of a restart.

    Suggested behaviour

    1. When the active credential changes (credential.switched, including changes another process makes to the shared DB), invalidate and re-sync the provider's model catalogue.
    2. When a session's selected model is missing from the catalogue, re-sync the catalogue once before failing.
    3. Preferably, do not reject locally a model that was previously known for this provider: send the request and let Copilot decide entitlement, surfacing its error.

    Related: #53413 (failed Copilot sync never retried until restart), #59177 (a stored session model that leaves the catalogue is unrecoverable).

  4. gloria-utp commented on Nov 7, 2026

    @gloria-utp
    gloria-utp
    on Nov 7, 2026
    More actions

    Contexto adicional (2.2.5, Linux)

    Confirmo el bug en opencode v2.2.5 (latest) en Linux 7.0.0-38-generic x86_64, terminal xterm-256color, shell /bin/bash. Config global solo con compaction (~/.config/opencode/opencode.jsonc), sin plugins configurados.

    Reproductibilidad

    La credencial github-copilot (OAuth device, stored) está activa en la BD compartida, y el provider aparece vía GET /api/provider:

    • opencode models (servicio compartido serve --service) → solo 11 modelos opencode/*, 0 github-copilot/*. opencode run --model github-copilot/gpt-5.3-codex → Model unavailable: github-copilot/gpt-5.3-codex.
    • opencode models --standalone → 28 modelos github-copilot/* (claude-fable-5, claude-haiku-4.5, gpt-6.1-sol, grok-4.7, kimi-k3, mai-code-1.1-flash…), estable en cada arranque.
    • Basicamente mismo host/entorno, solo cambia --standalone vs servicio.

    Detalle relevante: los modelos aparecen y desaparecen

    Tras un opencode service restart, en la terminal salieron los 28 modelos al instante:

    opencode models | grep github-copilot
    github-copilot/claude-fable-5
    ...
    github-copilot/mai-code-1.1-flash
    

    Pero segundos/minutos después ya no aparecen (0 modelos de Copilot en el servicio). Esto coincide también con #59895 (“models disappear ~2s after server start”).

    Qué probé

    • opencode service restart → hizo aparecer los modelos una vez de forma transitoria, luego desaparecieron; un restart anterior (PID 8416 → 53616) no los mostró en absoluto.
    • opencode reload / POST /api/location/reload → no restauró el catálogo en el servicio.
    • /connect no fue necesario: la credencial ya está activa y la prueba --standalone sincroniza bien, así que OAuth/entitlement no parece ser el problema.

    Relacionado

    #60702, #59895

  5. DXXS commented on Nov 23, 2026

    @DXXS
    DXXS
    on Nov 23, 2026
    More actions

    FWIW, for me 'opencode models | grep copilot' also produces the full copilot models list, but many recent ones (esp. 'gemini') aren't showing up inside of opencode itself. Attempting to start with 'opencode --standalone' made no difference.

    See also: anomalyco/opencode#53682)

  6. opencodejr
    marked providers: GitHub Copilot models missing from background service, available with --standalone #66359 as a duplicate of this issue on Nov 25, 2026
  7. Restacl commented on Nov 26, 2026

    @Restacl
    Restacl
    on Nov 26, 2026
    More actions

    Additional reproduction on Windows with OpenCode 2.3.2

    Environment:

    • OpenCode v2.3.2 (latest channel)
    • Windows 11 Enterprise 26H2
    • PowerShell 7.7.0
    • GitHub Copilot OAuth credential is present and active in the shared service.

    The local log confirms credential creation:

    timestamp=2026-11-26T00:28:44.905Z level=INFO message="credential created" integrationID=github-copilot type=oauth active=true
    

    Observed on the same machine and account:

    1. Shared/background service:
    opencode models | Select-String 'github-copilot'

    Returns no output (zero Copilot models).

    1. Private standalone server:
    opencode models --standalone | Select-String 'github-copilot'

    Returns the Copilot model catalogue (31 model IDs), including:

    • github-copilot/claude-fable-5
    • github-copilot/claude-sonnet-5.5
    • github-copilot/gemini-3.8-flash
    • github-copilot/gpt-5.3-codex
    • github-copilot/gpt-5.4-nano
    • github-copilot/gpt-5.4-nano
    • github-copilot/gpt-5.4-nano
    • github-copilot/gpt-6.1-sol
    • github-copilot/grok-4.7
    • github-copilot/kimi-k3
    • github-copilot/mai-code-1.1-flash

    The same active OAuth credential is usable for model discovery in --standalone, while the shared/background service returns no github-copilot/* models. This reproduces the service-vs-standalone discrepancy on OpenCode 2.3.2 / Windows 11, beyond the original 2.2.4 report.

    The log excerpt available to me confirms the credential was created and active, but does not include a 'failed to sync GitHub Copilot models' error. I have not yet verified whether restarting the background service resolves this instance.

    Expected: the shared/background service should expose the same Copilot model catalogue as --standalone for the same active credential.

  8. Restacl commented on Nov 26, 2026

    @Restacl
    Restacl
    on Nov 26, 2026
    More actions

    Follow-up reproduction: models disappear again shortly after restarting the shared service (Windows 11, OpenCode 2.3.2)

    After the previous report, I tested the suggested workaround on the same Windows 11 Enterprise 26H2 machine with OpenCode v2.3.2:

    1. Ran opencode service restart. The command returned http://127.0.0.1:28894.
    2. Immediately ran opencode models | Select-String 'github-copilot'. This time the shared service temporarily returned the Copilot catalogue (34 model IDs).
    3. Ran opencode run --model github-copilot/gpt-5.3-codex "Reply with exactly: COPILOT_OK". It failed with:
      Error: Model unavailable: github-copilot/gpt-5.3-codex
    4. Waited 30 seconds, then ran:
      $models = opencode models | Select-String 'github-copilot'
      "Copilot models: $($models.Count)"
      Output: Copilot models: 0.

    So restarting the shared service causes the Copilot model list to appear temporarily, but the list disappears again within 30 seconds, and a run cannot resolve the model even during this interval. The same credential still works for model discovery using opencode models --standalone (31 model IDs), as reported in my previous comment.

    This appears consistent with the stale/fallback catalogue or shared-service sync/race described in this issue. I have not identified the exact cause from my logs; the available log excerpt confirms the OAuth credential was created and active, but contains no sync failure line.

    Expected: once the service syncs the active Copilot credential, the catalogue should remain available and selected models should resolve in sessions.

  9. 4DGA4 commented on Nov 27, 2026

    @4DGA4
    4DGA4
    on Nov 27, 2026
    More actions

    Adding a Windows / 2.4.2 data point — same symptom, but deterministic, and with no sync-failure log line, so possibly a distinct trigger.

    Environment

    • opencode 2.4.2, latest channel, npm global (@opencode/cli)
    • Windows 10.0.19045, TUI connected to the shared background service
    • Credential: GitHub Copilot device OAuth, stored and active
    • No custom plugins; global config only sets a local Ollama provider + permissions

    Observed

    • Shared service /api/model: ollama: 495, opencode: 11, github-copilot: 0
    • opencode --standalone models: 34 github-copilot/* models immediately
    • No failed to sync GitHub Copilot models warning anywhere in opencode.log

    Not credential or entitlement

    • GET https://api.githubcopilot.com/models with the stored token -> 49 models
    • GET https://api.individual.githubcopilot.com/models -> 49
    • cached models.dev catalog contains github-copilot with 33 models

    Recovery attempts that did not help

    • opencode service restart
    • full opencode service stop + service start with OPENCODE_CONFIG_CONTENT cleared
    • POST /api/location/reload
    • POST /api/credential/{id}/activate

    Timeline clue
    The same machine and version listed 34 Copilot models in the shared service before. After deleting the credential and reconnecting via device OAuth, the provider has never reappeared in the shared service across multiple restarts. So this is not only a transient sync timeout — a re-created credential appears not to be re-synced by the service at all.

    Related: #66359 (closed as duplicate of this), #53413.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    reproduced

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.