Skip to content

[Bug]: opencode on remote still uses codex and gpt 5 mini ? #2797

@saleemalharir1

Description

@saleemalharir1

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

start app wthe npx t3 serve
then add it to the t3 app local
get the url and code put it and connect
send a message to my throw t3 to the remote and the model that i have is my self hosted ollama qwen3.6
here are the configs on the remote

cat ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",

  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CHPC Ollama",
      "options": {
        "baseURL": "*********************"
      },
      "models": {
        "qwen3.6:27b": {
          "name": "Qwen 3.6 27B",
          "reasoning": true,
          "tool_call": true,
          "variants": {
            "thinking": {
              "reasoningEffort": "high"
            },
            "low": {
              "reasoningEffort": "low"
            }
          }
        }
      }
    },

    "local": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Local H200 Ollama",
      "options": {
        "baseURL": "****************"
      },
      "models": {
        "gemma4:31b": {
          "name": "Gemma 4 31B",
          "reasoning": true,
          "tool_call": true
        },

        "qwen3.6:27b": {
          "name": "Qwen 3.6 27B Local",
          "reasoning": true,
          "tool_call": true
        }
      }
    }
  },

  "model": "ollama/qwen3.6:27b",

  "agent": {
    "primary": {
      "description": "Primary coding agent",
      "model": "local/qwen3.6:27b",
      "temperature": 0.2
    },

    "builder": {
      "description": "Fast builder",
      "model": "ollama/qwen3.6:27b",
      "temperature": 0.1
    },

    "planner": {
      "description": "Planning agent",
      "model": "local/gemma4:31b",
      "temperature": 0.3
    }
  }
}

as you can see i have no chatgpt setup here

 {
    threadId: '2a57968e-a00e-4074-8dde-1a2a962d6863',
    cwd: '/',
    cause: 'TextGenerationError: Text generation failed in generateThreadTitle: Codex CLI command failed: 2026-05-25T03:22:41.757975Z ERROR codex_login::auth::manager: Failed to refresh token: 401 Unauthorized: {\n' +
      '  "error": {\n' +
      '    "message": "Your refresh token has already been used to generate a new access token. Please try signing in again.",\n' +
      '    "type": "invalid_request_error",\n' +
      '    "param": null,\n' +
      '    "code": "refresh_token_reused"\n' +
      '  }\n' +
      '}\n' +
      '2026-05-25T03:22:41.758072Z ERROR codex_login::auth::manager: Failed to refresh token: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.\n' +
      '2026-05-25T03:22:41.797871Z ERROR codex_login::auth::manager: Failed to refresh token: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.\n' +
      '2026-05-25T03:22:41.880306Z ERROR codex_models_manager::manager: failed to refresh available models: unexpected status 401 Unauthorized: Provided authentication token is expired. Please try signing in again., url: https://chatgpt.c
**********n' +
      '2026-05-25T03:22:41.897677Z ERROR codex_login::auth::manager: Failed to refresh token: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.\n' +
      'OpenAI Codex v0.121.0 (research preview)\n' +
      '--------\n' +
      'workdir:' +
      'model: gpt-5.4-mini\n' +
      'provider: openai\n' +
      'approval: never\n' +
      'sandbox: read-only\n' +
      'reasoning effort: low\n' +
      'reasoning summaries: none\n' +
      'session id: 019e5d27-fb58-72c3-a3ff-9c80bfb25503\n' +
      '--------\n' +
      'user\n' +
      'You write concise thread titles for coding conversations.\n' +
      'Return a JSON object with key: title.\n' +
      'Rules:\n' +
      "- Title should summarize the user's request, not restate it verbatim.\n" +
      '- Keep it short and specific (3-8 words).\n' +
      '- Avoid quotes, filler, prefixes, and trailing punctuation.\n' +
      '- If images are attached, use them as primary context for visual/UI issues.\n' +
      '\n' +
      'User message:\n' +
      'hello there\n' +
      'warning: Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the vendored bu
bblewrap in the meantime.\n' +
      '2026-05-25T03:22:41.934874Z ERROR codex_login::auth::manager: Failed to refresh token: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.\n' +
      '2026-05-25T03:22:41.971831Z ERROR codex_login::auth::manager: Failed to refresh token: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.\n' +
      '2026-05-25T03:22:41.991896Z ERROR rmcp::transport::worker: worker quit with fatal: Transport channel closed, when UnexpectedContentType(Some("text/plain; body: {\\n  \\"error\\": {\\n    \\"message\\": \\"Provided authentication to
ken is expired. Please try signing in again.\\",\\n    \\"type\\": null,\\n    \\"code\\": \\"token_expired\\",\\n    \\"param\\": null\\n  },\\n  \\"status\\": 401\\n}"))\n' +
      '2026-05-25T03:22:42.006850Z ERROR codex_login::auth::manager: Failed to refresh token: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.\n' +
      '2026-05-25T03:22:42.230619Z ERROR codex_api::endpoint::responses_websocket: failed to connect to websocket: HTTP error: 401 Unauthorized, url: wss://chatgpt.com/backend-api/codex/responses\n' +
      '2026-05-25T03:22:42.265361Z ERROR codex_login::auth::manager: Failed to refresh token: Your access token could not be refreshed because your refresh token was already used. Please log out and sign in again.\n' +
      '2026-05-25T03:22:42.434419Z ERROR codex_api::endpoint::responses_websocket: failed to connect to websocket: HTTP error: 401 Unauthorized, url: wss://chatgpt.com/backend-api/codex/responses\n' +


i have a codex running there with an expired token but it is defaulting to using chatgpt while i have chosen a different model in the app

Expected behavior

choose the correct model on the remote also a better way to add the remotes since adding them was hard

Actual behavior

prompt failing and not responsive after 16 minutes no feedback and thread is stuck at working
can't stop the thread so i have to delete it

Impact

Blocks work completely

Version or commit

No response

Environment

No response

Logs or stack traces

Screenshots, recordings, or supporting files

No response

Workaround

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions