Skip to content

fix: models-dev user agent is evaluated at module load, leaking host OPENCODE_CLIENT into requests #47512

Closed

Description

@woodsonl

Description

The models-dev catalog fetcher builds its User-Agent once at module load. Hosts that set OPENCODE_CLIENT before importing (desktop sets it to "desktop") silently send the wrong client identifier on every models.dev request, and the test suite asserting the "/cli" suffix fails on those hosts.

Steps to reproduce

  1. OPENCODE_CLIENT=desktop bun test packages/core/test/models.test.ts
  2. The user-agent assertion fails with "opencode/local/local/desktop" instead of "/cli"

Fix incoming in PR #47510 (lazy per-request evaluation + regression test); filing per the Issue First policy so the drive-by fix is referenceable.

Activity

  1. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    In v2, the models.dev catalog request builds its User-Agent from app metadata passed in when the server starts, and packages/core no longer reads OPENCODE_CLIENT itself. Running the core models test with OPENCODE_CLIENT=desktop set therefore no longer changes the User-Agent it checks.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions