r/opencode • • 10d ago

Never let your stale cache TTL cause a miss again.

3 Upvotes

3 comments sorted by

1

u/InvaderDolan 10d ago

Try it yourself: https://github.com/PVLPM/opencode-quota-gui
Or run `opencode plugin add opencode-quota-gui` in your terminal.

Yeah, I know it looks ugly, but this is what OpenCode lets me do with the composer pill natively.

1

u/herrera-j6782 10d ago

Does the pill refresh the quota when its cache TTL expires, or just show the cached value? That seems key to preventing stale-cache misses.

1

u/InvaderDolan 10d ago

The plugin and pill are read-only for now. It shows the cache reuse from the last actual model call and an estimated TTL, but it doesn’t send requests to refresh the cache.
OpenCode already has its own optional cache warming, so I’d rather leave that to OpenCode than have the plugin interfere with sessions or generate extra API calls.
The pill is mainly there to give you a heads-up when cache reuse might be at risk after a long break. It’s not a guarantee of a hit or a miss. But I have a plan on how to make this TTL timer more reliable.
One limitation I am still looking into is detecting when OpenCode has warmed the cache in the background, since that isn’t reliably exposed to plugins yet.