Skip to content

feat: delete session state file when session is deleted#559

Open
tomasWade wants to merge 1 commit into
Opencode-DCP:masterfrom
tomasWade:feat/delete-session-state
Open

feat: delete session state file when session is deleted#559
tomasWade wants to merge 1 commit into
Opencode-DCP:masterfrom
tomasWade:feat/delete-session-state

Conversation

@tomasWade
Copy link
Copy Markdown

DCP persists pruned tool state per session at ~/.local/share/opencode/storage/plugin/dcp/{sessionId}.json. When a session is deleted, the corresponding state file remains on disk as an orphan and accumulates over time.
The opencode SDK already emits a session.deleted event with the session ID. This PR adds a handler in createEventHandler that calls fs.unlink to remove the state file when a session is deleted.
Changes:

  • lib/state/persistence.ts: export deleteSessionState(sessionId) — deletes the session state file
  • lib/hooks.ts: handle session.deleted event in the event handler, calling deleteSessionState

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.

1 participant