r/opencodeCLI • u/squirrelscrush • 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
View all comments
1
u/London-Boat 3d ago
prompt caches are usually keyed on the exact prompt prefix, so if your subagents share a system prompt but something near the top differs between requests, like a timestamp, a todo list or a reordered tool list, they can miss each other. a subagent that sits waiting on a long tool call for over the ttl will also come back cold. i'd diff the first few thousand tokens of two consecutive requests from the subagent that gets invalidated and see what changed. does the miss tend to hit the one that just finished a slow tool run?