Add redact-history for the store written before masking - #63
Merged
Merged
Conversation
Masking guards writes, so event bodies from before v0.10.0 and titles and turn errors from before v0.12.4 are still in the clear. agentlens redact-history reports what is left; --apply masks it after copying the database. Safe over every row, repeatedly: masking is idempotent, verified for all twenty-two patterns. [REDACTED:bearer-token] trips the hint gate, since it contains "earer", but the pattern needs whitespace and finds a hyphen. seq is left alone. A shipper already sent these events without content, so bumping it would resend tens of thousands of rows for nothing. On the local store: 17 events, no titles, no errors, integrity clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NZDHk4yVYP4jMZkTUMQ1Lw
gengwg
added a commit
that referenced
this pull request
Sep 8, 2026
Add redact-history for the store written before masking
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.
Masking guards writes, so anything stored before it existed is still in the clear: event bodies from before v0.10.0, session titles and turn errors from before v0.12.4.
agentlens redact-historyreports what is left;--applymasks it after copying the database first.Safe to run over every row, repeatedly, which is what makes it usable without tracking which rows are old. Masking is idempotent: a mask literal contains no pattern, so re-masking returns the text byte for byte. Verified for all twenty-two. The one case that looks like it should bite does not —
[REDACTED:bearer-token]contains "earer" and trips the cheap hint gate, but the bearer pattern needs whitespace after it and finds a hyphen.seqis deliberately left alone. A shipper has already sent these events with their content stripped, so there is nothing for a shared server to catch up on, and bumping it would resend tens of thousands of rows to no purpose. A test pins that.Run against the real local store: 17 events, no titles, no errors; integrity check clean, row counts identical, second pass finds nothing.
The backup is named
<db>-bak-before-redactso the existing*.db-*ignore rule covers it — a database backup should not be commit-able by accident..gitignorealso gains*.db.bak*and*.bak-*.96 tests pass.
https://claude.ai/code/session_01NZDHk4yVYP4jMZkTUMQ1Lw