fix(observe): match interruption markers carried in text blocks - #46
Merged
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 changed
contentContainsMarkernow reads a text block'stextfield, not onlycontent, via a newblockTexthelper.src/observe/adapters/claudeUser.test.tscovering all four markers in three real record shapes: plain string,textblock, andtool_resultblock.Why
Claude Code carries interruption markers in
{ type: "text", text: "..." }blocks and denial markers in{ type: "tool_result", content: "..." }blocks. The matcher only inspectedcontent, so denials were found and interruptions were not.Measured on a real corpus of 461 transcripts: 1,033 interruption markers on disk, 4 reaching the index. Denials were unaffected at 447 of 465. The staleness guard in
src/signal/health.tscannot catch this because it requires interruptions and denials to both be zero.The existing fixture in
src/cli/learn.test.ts:56uses a stringcontent, which is the shape that already worked, so nothing covered the shape that actually occurs.How to verify
--dry-runruns a full fresh scan into an in-memory database and writes nothing. On the same corpus the mirror goes from 4 interruptions to roughly 1,100, broken down by what was interrupted:Data handling
redactSecretsNo new source and no new read. This changes which field of an already-parsed record is inspected. Marker classification happens before any
TextRefis resolved, so the redaction gate is untouched.