Repository navigation
perf(evidence): reuse sealed bundle reads in compare and export - #2715
Merged
Merged
Conversation
`rea compare`, the compare_bundles MCP tool and `rea evidence-export` read bundles through the mutable reader, so each consumer re-authenticated every record again: compareBundles parsed both bundles a second time and bundleDigest's serializeEvidenceBundle a third time; export's writer parsed the source once more before serializing. These consumers only read the bundle, so read it through the existing sealed reader (readImmutableEvidenceBundle). Later parses hit the immutable bundle cache. Ordinary mutable reads, kept deliberately by #1721, are unchanged. Output is byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
Node timers can fire while performance.now() is still a fraction of a millisecond short of the monotonic deadline. ProviderStartupDeadline then reported interruption "timeout" and an aborted signal while remainingMs() returned ceil(0.x) = 1, so polling loops guarded by remainingMs() > 0 (Hopper and Ghidra startup) could run past an elapsed deadline, and the real-timer test "aborts a bounded wait when its real monotonic deadline expires" failed intermittently in CI (expected 1 to be 0). Once the deadline's own timer has classified a timeout, report zero remaining time. A deterministic regression test fires the timer with the monotonic clock 0.4 ms short of the deadline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
Comparing or exporting a large Evidence bundle re-authenticates every record several times. I exported an MCP session that ran
inspect_artifacton Keynote.app (85 MB bundle, 2 records) and profiledrea compare bundle.json bundle2.json. About 5.4 s of its 8.7 s went toparseEvidenceBundle, and another 2.6 s tobundleDigest→serializeEvidenceBundle.Each bundle is authenticated three times:
readEvidenceBundle→parseEvidenceBundle(mutable, uncached)compareBundles→parseEvidenceBundleagainbundleDigest→serializeEvidenceBundle→parseEvidenceBundlea third timerea evidence-exportdoes the same once more:writeEvidenceBundlere-parses the source it just read.Fix
These consumers only read the bundle. They now load it through the existing sealed reader,
readImmutableEvidenceBundle(added in #1721 for session import). The sealed bundle is registered in the immutable bundle cache, so steps 2 and 3, and the export writer's check, reuse the first authentication. Changed call sites:compareEvidenceBundlesCommand(CLIrea compare)compare_bundlesMCP toolexportEvidenceBundleCommand(CLIrea evidence-export)readEvidenceBundledeliberately stays mutable for ordinary file reads; #1721 tests that. Results, bundle digests and exported bytes are unchanged.Measurements
Same 85 MB bundle, three warm runs each with
/usr/bin/time -l, main and the branch built from the same base. Outputs are byte-identical (same SHA-256 for compare stdout and for the exported file).rea compare a.json b.jsonrea evidence-export a.json out.jsonThat is about 44% less wall time for compare and 27% less for export. Peak RSS is dominated by reading the file and is noisy across runs: compare 2.0–2.6 GB on both, export about 960 MB → 920 MB. Token cost is unchanged. The MCP
compare_bundlespath shares the change but wasn't timed separately.Validation
npm run test:focusedon the bundle comparison, import/export, cancellation and MCPcompare_bundlessuites (14 files): 102 passed.npm run check:fastpasses;npm run jscpdis at 2.99%.🤖 Generated with Claude Code