Skip to content

fix(copilot): Cache copilot plugin unblock UI thread and improve startup times#21415

Draft
eastwood wants to merge 1 commit intoanomalyco:devfrom
eastwood:fix/copilot-models-fire-and-forget
Draft

fix(copilot): Cache copilot plugin unblock UI thread and improve startup times#21415
eastwood wants to merge 1 commit intoanomalyco:devfrom
eastwood:fix/copilot-models-fire-and-forget

Conversation

@eastwood
Copy link
Copy Markdown

@eastwood eastwood commented Apr 8, 2026

Issue for this PR

Closes #21296

There's a blocking call on the copilot provider setup which causes the TUI to block.

Type of change

  • Fixes bug

What does this PR do?

Caches the github copilot model provider and puts the request into the background in order to unblock the TUI startup.

How did you verify your code works?

Measured via debug logs — time from process start to first TUI plugin load:

Time to TUI ready (avg)
opencode v1.4.0 (before) ~1674ms
This fix ~1049ms
Improvement ~625ms faster
# Before (v1.4.0):
INFO  2026-04-08T01:19:05 +68ms service=default directory=... creating instance
INFO  2026-04-08T01:19:06 +1606ms service=tui.plugin id=internal:home-footer loading internal tui plugin
#After:
INFO  2026-04-08T01:37:27 +362ms service=default version=0.0.0-dev-202604080124 args=[] opencode
INFO  2026-04-08T01:37:28 +687ms service=tui.plugin id=internal:home-footer loading internal tui plugin

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Notes

Apologies, I'm not well versed in this codebase and haven't had a chance to comprehensively test all side effects of this change. I acknowledge that this solution could be completely naive, but happy to take feedback and discuss further.

In the meantime, I will dogfood my version to check for edge cases.

@eastwood eastwood marked this pull request as ready for review April 8, 2026 04:37
@eastwood eastwood force-pushed the fix/copilot-models-fire-and-forget branch 5 times, most recently from 81bf880 to 0488f5c Compare April 9, 2026 08:19
@eastwood eastwood changed the title fix(copilot): fire-and-forget model fetch to unblock TUI startup fix(copilot): Cache copilot plugin unblock UI thread and improve startup times Apr 9, 2026
@eastwood eastwood force-pushed the fix/copilot-models-fire-and-forget branch from 0488f5c to be7579e Compare April 9, 2026 08:58
import { CopilotModels } from "./models"

const log = Log.create({ service: "plugin.copilot" })
const ttl = 60 * 60 * 1000
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this too long? I figured it was a nice sweet spot without a refresh interval (which felt unnecessary)

@eastwood eastwood marked this pull request as draft April 9, 2026 09:04
@eastwood
Copy link
Copy Markdown
Author

eastwood commented Apr 9, 2026

Can't see a correlation between broken e2e tests and my changes. Can see other PRs have these tests breaking. Will check back in a few days

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI startup is blocked by GitHub Copilot model fetch timeout

1 participant