Skip to content

Fix OpenCode 2 tools in multiple directories and duplicate captures - #110

Open
ishaanxgupta wants to merge 5 commits into
mainfrom
fix/v2-per-directory-capture
Open

ishaanxgupta wants to merge 5 commits into
mainfrom
fix/v2-per-directory-capture

Conversation

@ishaanxgupta

@ishaanxgupta ishaanxgupta commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Every directory saved every session. OpenCode delivers every location's events to every plugin instance, and some events have no location. With per-directory owners, each loaded directory captured every session. Each runtime now handles only sessions in its own directory: it checks the event's location, or looks up the session's directory once and caches the answer.
  • Replay on shutdown. cleanup() cleared session state before its final flush, so the flush re-sent every batch it had already saved. It now flushes first.
  • Replay after a reload or restart. A new runtime started with an empty record of saved batches and re-sent earlier turns of any resumed session. Saved batch ids are now kept in plugin storage, loaded before capturing, and removed when the session is deleted.
  • Unbounded retries after a timeout. A write that timed out on the client may still have reached the server, but it was re-sent after every later turn. A batch is now tried at most 3 times, in both the V1 and V2 plugins.

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.

2 participants