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 — codex-proxy: PR #431's {env:CODEX_PROXY_PORT} baseURL has no fallback — opencode outside a home-manager shell gets an empty port · Issue #434 · developing-today/code

codex-proxy: PR #431's {env:CODEX_PROXY_PORT} baseURL has no fallback — opencode outside a home-manager shell gets an empty port #434

New issue
Copy link
New issue
Copy link
Closed
Closed
codex-proxy: PR #431's {env:CODEX_PROXY_PORT} baseURL has no fallback — opencode outside a home-manager shell gets an empty port#434
Copy link
Assignees
dezren39
Labels
app/opencode-configOpenCode configuration under .opencode/ and the root configarea/homeHome-manager / user environment configurationkind/bugSomething isn't working (prefixed form of the classic bug label)

Description

@dezren39
dezren39
opened on Oct 20, 2026
Issue body actions

Finding

PR #431 single-sources the codex-proxy port by changing the openai-codex provider's baseURL in .opencode/opencode.jsonc from the hardcoded http://127.0.0.1:18744/v1 to http://127.0.0.1:{env:CODEX_PROXY_PORT}/v1. The only place the new variable is set is home.sessionVariables (home/common/default.nix, from the single codexProxyPort definition) — i.e. it exists only in processes that inherit a home-manager shell session's environment.

OpenCode's {env:VAR} substitution has no fallback: a missing variable substitutes the empty string. In developing-today/opencode, packages/core/src/config/variable.ts (substitute function): const value = (input.env?.[name] ?? process.env[name]) || "". So any opencode process launched without CODEX_PROXY_PORT in its environment gets baseURL http://127.0.0.1:/v1 — a dead provider, and exactly the "looks like a network/auth problem" failure mode PR #431 set out to eliminate. The proxy script itself keeps a fallback (bin/codex-proxy.mjs:7: process.env.CODEX_PROXY_PORT || '18744'); after this PR the client side no longer has one, so the two sides can now disagree in the opposite direction: proxy listening on 18744, client dialling port "".

Evidence

  • PR codex-proxy: single-source the port via CODEX_PROXY_PORT #431 (OPEN, head 5be5217f): .opencode/opencode.jsonc baseURL becomes http://127.0.0.1:{env:CODEX_PROXY_PORT}/v1; home/common/default.nix sets CODEX_PROXY_PORT = toString codexProxyPort; only under home.sessionVariables.
  • PR codex-proxy: single-source the port via CODEX_PROXY_PORT #431's verification only covers the variable-set case: "a test server with CODEX_PROXY_PORT=18744 in its environment resolved the provider from the substituted config correctly." The unset case is untested.
  • Concrete unset launch path, verified today: the Muse sandbox's opencode serve runs as a systemd service whose environment file (~/tools/secrets.d/opencode-serve.env) sets the proxy/CA/Cloudflare keys and the PR opencode: enable web-search backends + experimental feature flags #430 feature flags but not CODEX_PROXY_PORT (key list checked 2026-10-20), while its deployed config is this repo's .opencode/opencode.jsonc. Merging codex-proxy: single-source the port via CODEX_PROXY_PORT #431 as-is turns that server's codex provider from "works when the proxy runs" into "empty port, always dead". Desktop/VS Code launches and other service contexts have the same exposure wherever they don't source the shell session variables.

Why it matters

The hardcoded port worked in every launch context; the env-substituted one silently works only in shell-launched ones. This reintroduces the PR's own failure mode (silently dead provider, misleading error) for a different — and already existing — class of launches.

Acceptance criteria

  • With CODEX_PROXY_PORT unset, the openai-codex provider's resolved baseURL still points at the proxy's fallback port (18744), OR every supported way of launching opencode with this config (shell, systemd service, desktop/VS Code) demonstrably receives the variable, with the sandbox opencode-serve service as the worked example.
  • A check or test pins the unset-variable behaviour so it can't regress silently (e.g. rendering/validating the effective config with the variable unset).
  • The solution keeps PR codex-proxy: single-source the port via CODEX_PROXY_PORT #431's single-source property: one definition of the port that all consumers derive from.

Activity

  1. github-actions
    assigned
    dezren39
    on Oct 20, 2026
  2. dezren39 commented on Oct 21, 2026

    @dezren39
    dezren39
    on Oct 21, 2026
    MemberAuthor
    More actions

    Sweep update (2026-10-21): the fork-level fix named in #437 is implemented, as a cross-repo set in one pass.

    opencode half — developing-today/opencode PR #232 (developing-today-forks/opencode#232): ConfigVariable.substitute now supports the shell-style {env:VAR:-fallback} form (fallback used when the variable is unset OR empty; plain {env:VAR} unchanged; fallback may contain colons, so a URL default works). New test covers set/unset/empty/plain/URL cases and fails with the implementation reverted; full config suite 52/52, core typecheck clean; docs updated.

    code half — PR #478 (stacked on #438): all three {env:} baseURLs become {env:CODEX_PROXY_PORT:-18744}, {env:AGY_PROXY_PORT:-18743}, {env:ANTIGRAVITY_LS_PROXY_PORT:-18745} — equal to each proxy script's fallback and to the single let-block definition, satisfying this issue's first acceptance branch. New guard .github/scripts/check-proxy-port-fallbacks.sh (run by nix-ci on every PR) fails by name when any fallback copy drifts from the let-block definition, when a bare {env:VAR} reappears, or when a literal port returns to opencode.jsonc — ablation-verified in both directions.

    Sequencing: #478 merges after the #430/#431/#438 stack (which awaits Drew's review); the syntax takes effect once opencode PR #232 is in the deployed fork build. On an older opencode the new token degrades to today's empty substitution — no worse than #431 as-is. This issue stays open until both PRs land.

  3. dezren39
    added 2 commits that reference this issue on Oct 21, 2026

    feat(core): support {env:VAR:-fallback} defaults in config substituti…

    dc72b96

    Merge pull request #478 from developing-today/sweep/434-env-fallback

    7153874
  4. dezren39
    closed this as completedin 2a23007on Oct 23, 2026
  5. dezren39
    added a commit that references this issue on Oct 25, 2026

    config(opencode): keep {env} port templates (port-fallback guard); co…

    32ad937
  6. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    app/opencode-configOpenCode configuration under .opencode/ and the root config
    area/homeHome-manager / user environment configuration
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/opencode-configOpenCode configuration under .opencode/ and the root configarea/homeHome-manager / user environment configurationkind/bugSomething isn't working (prefixed form of the classic bug label)

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.