Repository navigation
feat: deleting a session also deletes the agent's conversation - #91
Merged
Merged
Conversation
Deleting a session from the phone removed the bridge's record and transcript but left the agent's own copy behind: Claude Code's transcript files, OpenCode's server-side session, the DeepSeek Harness's session directory. They piled up unseen and could still be resumed by hand. A new driver-protocol request, delete-conversation, asks the agent host to delete one conversation once its session has ended. The bridge sends it on close-session for each conversation the record points to (the current one, and one dropped as missing), all of them started by the bridge itself. A request the host could not take (down, or it died with the request in flight) is kept and sent once it is initialized again; deleting twice is harmless. The host handles lines concurrently, so the delete waits for that session's end-session to finish and is refused while it still runs. Each driver deletes what its agent keeps: - Claude Code: the SDK's deleteSession (transcript plus subagent transcripts). Ending a session now also waits, bounded, for the CLI to exit, so it cannot write the transcript back after the delete. - OpenCode: session.delete, which removes child sessions too; a 404 is already deleted. - DeepSeek Harness: no API, so the session directory is removed, with every subagent session whose header names it as parent. Verified live on the three agents: after the delete, resuming the conversation finds nothing, and its files are gone. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deleting a session from the phone now also deletes the agent's own copy of its conversation: Claude Code's transcript files, OpenCode's server-side session, and the DeepSeek Harness's session directory. Until now these piled up unseen and could still be resumed by hand.
delete-conversation {sessionId, agent, cwd, conversationId}request. The reply isack, also when there was nothing to delete, orerror. Documented indocs/PROTOCOL.md; the host's TS types are regenerated. The phone wire is unchanged.close-sessionit sends one delete for each conversation the record points to: the current one, and one dropped as missing. Every such conversation was started by the bridge, since a session can only be created fresh. A delete the host could not take (it was down, or died with the request in flight) is held and sent again once the host is initialized. Deleting twice is harmless.end-sessionto finish and is refused while the session still runs.deleteSession(transcript plus subagent transcripts).end()now also waits, at most 5 s, for the CLI to exit, so the CLI cannot write the transcript back after the delete.session.delete, which removes child sessions too; a 404 counts as already deleted.Verification
cargo clippy --workspace --all-targets -D warningsandcargo test --workspacepass. So do the ignored driver-protocol spawn test and the bridge end-to-end test (-- --ignored, after a host build). The agent host's typecheck and tests pass (512).deepseek-v4.1-flash. Each check ran one turn, thenend-sessionanddelete-conversationback to back, then a resume:.jsonlis gone; the resume reports "No conversation found".🤖 Generated with Claude Code