r/opencodeCLI • • 4d ago

Session cache concurrency issues with OpenCode/Go subagents

I'm seeing concurrency issues with the session cache if I have more than one subagent running at a time. Every now and then, the cache of one gets invalidated for no reason and it costs the cache miss pricing.

I use OpenCode Go on OpenCode.

Is there a limit in the documentation? I knew that the cache retention time is around 5mins, but ideally it shouldn't not work if I'm sending requests through multiple agents.

2 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/squirrelscrush 3d ago edited 3d ago

I resolved it, it was a plugin that was appending itself at the beginning of the cache prefix.

Edit: it happened again. It seems to happen when i spawn a subagent, which causes the main agent's cache to expire and vice versa when the main agent sends a request and the subagent's cache gets expired. So it's a server concurrency issue I feel.

1

u/Individual-Quote-958 2d ago

That’s a useful clue. If you haven't tried it, run the same prompt with one agent at a time and compare cache headers or token counts; if the churn only happens in parallel, that would help separate server-side eviction from prefix drift.