fix(sessions): export and verify delegate transcripts before cascading session deletion#71123
Open
Drexuxux wants to merge 1 commit into
Open
fix(sessions): export and verify delegate transcripts before cascading session deletion#71123Drexuxux wants to merge 1 commit into
Drexuxux wants to merge 1 commit into
Conversation
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.
What?
hermes sessions export --delete-after-verifiedpreviously exported and verified only the explicitly selected parent session.It then called
SessionDB.delete_session(), which intentionally cascade-deletes every delegate/subagent session associated with that parent. This meant delegate messages and transcript files could be permanently deleted even though their content was never included in the verified archive.Fix
The export flow now discovers the complete delegate deletion set and writes each affected session to a separate Markdown/QMD file.
Every generated file must pass the existing hash, session ID, and message-count verification before deletion begins. The expected deletion set is also checked inside the SQLite write transaction. If a new delegate appears while the export is running, deletion fails closed and all sessions are preserved.
Normal session deletion behavior remains unchanged.
Related Work
--delete-after-verifiedflow.These PRs introduced the affected workflow but do not handle delegate sessions that are cascade-deleted with their parent.
Tests
497 passedgit diff --checkpassed.