Fix issues #60, #59: /fork pointer entries and empty async hook entries#61
Closed
Fix issues #60, #59: /fork pointer entries and empty async hook entries#61
Conversation
When /fork is used to branch a conversation, Claude Code v2.1.118+
writes each inherited parent entry with a forkedFrom:{sessionId,
messageUuid} field instead of duplicating them verbatim.
Add forked_from: Option<Value> to Entry to capture this field.
In scan_session_metadata and IncrementalTokenScanner, skip entries
with forkedFrom set so that session metadata (turn_count, tokens,
first_message, duration, ongoing state) reflects only the fork's
own activity — not the inherited parent conversation.
The conversation view (read_session_incremental) still includes
inherited entries so the full history remains visible as context.
Closes #60
Claude Code pre-v2.1.119 had a bug where async PostToolUse hooks could write JSONL transcript entries with empty or near-empty content. An entry that has a uuid but no type field would pass the existing uuid-presence guard in parse_entry(), then fall through classify() and produce a spurious meta AI message in the conversation view. Add a second guard: if entry_type is empty after deserialization, return None. This matches the existing entry-discarded-if-broken policy and is safe for all post-v2.1.119 sessions because valid entries always carry a non-empty type. Fixes #59
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
Compatibility fixes for two Claude Code regressions introduced in v2.1.118 and v2.1.119 that caused transcript parsing to break or produce incomplete results.
Fixed Issues
[Compat] Claude Code v2.1.118: /fork now writes a pointer entry instead of duplicating full parent conversation #60 —
/forkpointer entries (v2.1.118+): Claude Code v2.1.118 changed/forkto write aforkedFrom: {sessionId, messageUuid}pointer field on each inherited parent entry instead of duplicating the full parent conversation. The parser now deserialises this field onEntryso forked sessions round-trip correctly without data loss.[Compat] Claude Code v2.1.119: Async PostToolUse hooks wrote empty transcript entries #59 — Empty entries from async PostToolUse hooks (pre-v2.1.119): Async
PostToolUsehooks in Claude Code pre-v2.1.119 could flush an empty transcript entry (valid JSON with a UUID but notypefield) before the actual tool-use record was written.parse_entrynow rejects entries with an emptytype, preventing these phantom entries from corrupting the parsed session.Changes
src-tauri/src/parser/entry.rsforked_from: Option<Value>field;parse_entrynow filters entries with emptytypesrc-tauri/src/parser/session.rsTests
cargo test)vitest run)cargo clippy -- -D warnings)