perf: anonymize traces inline during extraction instead of a second pass#25
Merged
armand0e merged 2 commits intoJul 10, 2026
Merged
Conversation
teich extract wrote every trace to disk and then re-read and rewrote the whole output directory with anonymize_path. Extraction now threads an optional inline anonymizer through the copy and write helpers, so each trace is anonymized as it is first written — one read and one write per file instead of two. Scoping is unchanged: one TraceAnonymizer per output file. extract_local_sessions gains an anonymize flag and reports totals on ExtractResult; the CLI and studio extraction flows use it and drop their post-pass. teich anonymize is untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bc627e496
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
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.
teich extract(and the studio extraction flow) wrote every trace to disk, thenanonymize_path(output, output, in_place=True)re-read and rewrote the entire output directory. Every trace was read twice and written twice.This threads an optional inline anonymizer through extraction's copy/write helpers so each trace is anonymized as it is first written — one read, one write:
extract_local_sessionsgainsanonymize: bool = False;ExtractResultgainsanonymize_totalsfor the CLI/studio summary lines_copy_provider_jsonl) streams source → anonymized destination instead ofshutil.copy2+ rewriteTraceAnonymizerper output file (consistent within a trace, fresh across traces)teich anonymizeand its--in-placebehavior are untouched;--no-anonstill skips everythingOne test fake updated to accept the new keyword.
Testing
pytest— same results asmain(the handful of pre-existingtest_runner.py/integration failures reproduce on a clean checkout; everything else passes, 530+)anonymize=Truescrubs seeded key/email/home-path and reports correct totals;anonymize=Falseleaves data raw and totalsNone🤖 Generated with Claude Code