attach client should not refresh models.dev on every connection #7697

Open
opened 2026-02-16 18:07:57 -05:00 by yindo · 1 comment
Owner

Originally created by @nxxxsooo on GitHub (Jan 27, 2026).

Originally assigned to: @thdxr on GitHub.

Problem

When using opencode attach to connect to an already running opencode serve server, the client still performs a models.dev refresh on every connection, causing ~1 second delay.

Expected Behavior

The attach client should:

  1. Skip models.dev network request
  2. Reuse model information from the server
  3. Connect instantly (< 100ms)

Current Behavior

$ time opencode attach http://localhost:4096 --version
INFO  2026-01-27T06:27:37 +20ms service=models.dev file={} refreshing
1.1.36
real    1.236s

The models.dev refreshing log appears even though the server already has this information cached.

Environment

  • opencode version: 1.1.36
  • macOS (Apple Silicon)
  • Server running: opencode serve --port 4096
  • Client: opencode attach http://localhost:4096

Impact

Every new terminal session has ~1 second startup delay, which defeats the purpose of the server/client architecture (fast reconnection).

Suggested Fix

  • Move models.dev refresh to server-side only
  • Client should fetch model list from server via the existing connection
  • Or add --skip-model-refresh flag / OPENCODE_SKIP_MODEL_REFRESH env var
Originally created by @nxxxsooo on GitHub (Jan 27, 2026). Originally assigned to: @thdxr on GitHub. ## Problem When using `opencode attach` to connect to an already running `opencode serve` server, the client still performs a `models.dev` refresh on every connection, causing ~1 second delay. ## Expected Behavior The attach client should: 1. Skip `models.dev` network request 2. Reuse model information from the server 3. Connect instantly (< 100ms) ## Current Behavior ``` $ time opencode attach http://localhost:4096 --version INFO 2026-01-27T06:27:37 +20ms service=models.dev file={} refreshing 1.1.36 real 1.236s ``` The `models.dev refreshing` log appears even though the server already has this information cached. ## Environment - opencode version: 1.1.36 - macOS (Apple Silicon) - Server running: `opencode serve --port 4096` - Client: `opencode attach http://localhost:4096` ## Impact Every new terminal session has ~1 second startup delay, which defeats the purpose of the server/client architecture (fast reconnection). ## Suggested Fix - Move `models.dev` refresh to server-side only - Client should fetch model list from server via the existing connection - Or add `--skip-model-refresh` flag / `OPENCODE_SKIP_MODEL_REFRESH` env var
yindo added the perf label 2026-02-16 18:07:57 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 27, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10686: Annoying logging info for model refreshing
  • #10506: Reduce log noise: models.dev refresh logs at INFO level during startup

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 27, 2026): This issue might be a duplicate of existing issues. Please check: - #10686: Annoying logging info for model refreshing - #10506: Reduce log noise: models.dev refresh logs at INFO level during startup Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7697