Codex Desktop on a connected Child fails with "Missing environment variable: OPENCODEX_API_AUTH_TOKEN"; ocx connect reports only the CLI as ready

Aperta
#9,171 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend, cli

Direzione di ricerca

Start with src/codex/desktop-switches.ts and trace how ocx connect configures the Child environment and reports readiness for Codex. Check the existing tests for client role behavior and Desktop authentication. Done means Codex Desktop can authenticate on a connected Windows Child, or the completion report clearly explains the required environment variable and supported setup.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug cli
Client or integration

Codex CLI

Area

CLI

Summary

On a Windows machine connected as a Child to a remote hub, ocx connect succeeds and the Codex CLI works, but Codex Desktop cannot authenticate: the injected provider table carries env_key = "OPENCODEX_API_AUTH_TOKEN", and only the npm launcher shim exports that variable. Codex Desktop spawns its own codex binary and never goes through the shim, so every Desktop turn fails with:

text
Copy
ERROR: Missing environment variable: OPENCODEX_API_AUTH_TOKEN.
What I expected: either ocx connect makes Codex Desktop work on a Child (as it does for the CLI), or it states that the variable must be set — the completion report only says Local Codex CLI: ready and says nothing about Desktop. The documented remedy for exactly this shape, --desktop-authless, is inert on a client: codexDesktopAuthless stays stored-but-ineffective with inertReason: "client_role" (src/codex/desktop-switches.ts), so there is no supported switch that avoids the manual variable.

Reproduction
  1. Hub (Linux, tailnet bind):
    runtimeRole=hub, hostname=, unauthenticatedLoopbackListener={enabled:true},
    hub.managementIngress={enabled:true,port:10201}, hub.dataPublicOrigin=https://..ts.net:10003,
    hub.managementPublicOrigin=https://..ts.net:10002 (published with tailscale serve)
    ocx hub invite --json --clients codex

  2. Child (Windows 11), with the single-use code on stdin:
    ocx connect https://..ts.net:10003 --management-url https://..ts.net:10002 --clients codex --pairing-code-stdin
    -> "Connected to https://...:10003 as key ."
    -> "Local Codex CLI: ready (it accepts every reasoning level in the installed catalog)."
    -> "Codex autostart shim: installed and healthy"

  3. CLI works end to end:
    codex exec "Responde exactamente y solo: OCX-OK" -> OCX-OK, provider opencodex, 200 on the hub

  4. Run the exact binary Codex Desktop spawns, with no OPENCODEX_API_AUTH_TOKEN in the environment:
    & "$env:LOCALAPPDATA\OpenAI\Codex\bin<hash>\codex.exe" exec --skip-git-repo-check "hi"
    -> ERROR: Missing environment variable: OPENCODEX_API_AUTH_TOKEN. (twice, one per attempt)

  5. Same command with the variable set from the client token file:
    $env:OPENCODEX_API_AUTH_TOKEN = (Get-Content "$env:USERPROFILE.opencodex\service-api-token" -Raw).Trim()
    -> answers correctly through the hub

Version

2.100.10 (latest; also unchanged on dev @ time of report)

Operating system

Child: Windows 11 24H2 (26200.x). Hub: Ubuntu, kernel 7.0.0-31-generic. Codex CLI runtime on the Child: 0.171.0-alpha.13 (AppData\Local\OpenAI\Codex\bin<hash>\codex.exe)

Provider and model

openai / gpt-6-sol (hub account pool, "forward" auth mode)

Logs or error output
ERROR: Missing environment variable: `OPENCODEX_API_AUTH_TOKEN`.
ERROR: Missing environment variable: `OPENCODEX_API_AUTH_TOKEN`.

ocx status (Child), while the above fails:
   Codex autostart shim: wrapper shim present at ...\npm\codex.cmd
   routing=opencodex-local, service=viable, shim=healthy

ocx connect status --json:
   {"state":"connected", "readiness":"ready", "token":"owned", "selectedClients":["codex"]}
Screenshots and supporting files

No response

Redacted configuration
// Hub ~/.opencodex/config.json
{
  "runtimeRole": "hub",
  "hostname": "<tailnet-ip>",
  "port": 10100,
  "unauthenticatedLoopbackListener": { "enabled": true },
  "hub": {
    "dataPublicOrigin": "https://<hub>.<tailnet>.ts.net:10003",
    "managementPublicOrigin": "https://<hub>.<tailnet>.ts.net:10002",
    "managementIngress": { "enabled": true, "port": 10201 }
  },
  "corsAllowOrigins": ["http://localhost:10100"],
  "defaultProvider": "openai"
}
# Child %USERPROFILE%\.codex\config.toml — written by ocx connect
model_provider = "opencodex"

[model_providers.opencodex]
name = "OpenCodex Proxy"
base_url = "https://<hub>.<tailnet>.ts.net:10003/v1"
wire_api = "responses"
requires_openai_auth = true
env_key = "OPENCODEX_API_AUTH_TOKEN"
Checks
  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.
Lingua principale
TypeScript
Stelle
16.9k
Fork
1.3k
Merge medio
1g 4h
PR unite (30g)
814

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lidge-jun/opencodex

Tutte le issue di lidge-jun/opencodex

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.