[PR #10875] fix(perf): skip models.dev refresh when running as attach client #13586

Open
opened 2026-02-16 18:18:26 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10875

State: open
Merged: No


Summary

Fixes #10781

When using opencode attach to connect to an already running server, the client was still performing a models.dev refresh on every connection, causing ~1 second delay. Since the server already has models cached, the attach client doesn't need to fetch them independently.

Changes

  • Skip automatic models.dev refresh when running in attach mode
  • Detect attach mode by checking process.argv for the "attach" command
  • Reduces attach startup time from ~1.2s to <100ms

Test plan

  • Run opencode serve --port 4096 to start a server
  • Run time opencode attach http://localhost:4096 --version
  • Verify the models.dev refreshing log no longer appears
  • Verify connection is instant (<100ms instead of ~1.2s)

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10875 **State:** open **Merged:** No --- ## Summary Fixes #10781 When using `opencode attach` to connect to an already running server, the client was still performing a `models.dev` refresh on every connection, causing ~1 second delay. Since the server already has models cached, the attach client doesn't need to fetch them independently. ## Changes - Skip automatic `models.dev` refresh when running in attach mode - Detect attach mode by checking `process.argv` for the "attach" command - Reduces attach startup time from ~1.2s to <100ms ## Test plan - Run `opencode serve --port 4096` to start a server - Run `time opencode attach http://localhost:4096 --version` - Verify the `models.dev refreshing` log no longer appears - Verify connection is instant (<100ms instead of ~1.2s) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-16 18:18:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13586