Repository navigation
fix(ingest): admit prepared rows against the parse-bound digest - #5694
Merged
Merged
Conversation
A prepared session's sink is lowered in place on the worker (derived tool outcomes, active-path normalization); the inline route applies the same lowering only while building rows, and both bind the digest of the parsed content. The revision replay re-hashed the lowered sink instead, so for any session with a tool call the writer's digest disagreed with the shard's: it declined the worker's prepared rows as content_hash_mismatch, rebuilt rows and identities itself, and stored a sessions.content_hash the inline route never produces for the same bytes. Resolve the replay's aggregate digest (and the ungoverned already-applied check) through the carried digest, as the projection and the other replay entry already do. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
|
You have reached your Codex usage limits for security reviews. Please try again later. |
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. |
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
The revision replay admits a worker's prepared rows against the session's parse-bound digest. The writer then copies rows it used to rebuild, and a prepared session stores the same
sessions.content_hashas the inline route.Problem (evidence)
Numbers come from
devtools bench fresh-build(#5678). Each run cold-builds a sealed 144-file (276 MiB) private sample of Claude Code, Codex and Gemini sources throughpolylogued run --cold-build-indexon a shared host (load 18-35). Only aggregate numbers are quoted. Wall times move with host load; writer holds, stage timers and CPU seconds move less.The writer's prepared-row dispositions recorded
content_hash_mismatchfor 126 of 148 sessions. A worker lowers a prepared session's sink in place (derived tool outcomes, active-path normalization). The inline route applies the same lowering only while building rows. Both bind the digest of the parsed content, butapply_raw_revision_replayre-hashed the lowered sink. Every session with a tool call therefore disagreed with its shard. The writer rebuilt rows and identities itself and stored a digest the inline route never produces. Probe over 12 Codex and 12 Claude Code files from the sample, same bytes through both routes:content_hashequal to inlineSolution
_carried_session_content_hashresolves the replay's aggregate digest, and the ungoverned already-applied check, throughbound_session_content_hashwhen one is carried. The projection and the other replay entry already do this.Verification
devtools test tests/unit/sources/test_prepared_jsonl.py tests/unit/sources/test_live_watcher_parse_stage_equivalence.py tests/unit/storage/test_prepared_row_dispositions.py tests/unit/storage/test_session_shards.py: PASSED.test_prepared_session_with_lowered_sink_keeps_identity_and_rows: a Codex tool call ingested inline and through the parse stage. On master it is red: the writer copies 0 shard sessions, andsessions.content_hashdiffers.sessions,raw_revision_heads,session_profilesandsession_usage_rollup_bindings. Those four carry the session digest. Insessions, 126 rows differ incontent_hash, and the code fingerprints differ as expected. Index plus materialize stage time fell from 71.6 s to 41.1 s.Residuals
revision_governance.pyis IN the derived schema-identity closure. Stored digests for prepared multi-tool sessions change to the inline-route value, so the change must land before the fresh build starts.prepared_merge) hash the merged session built from already-lowered chunk sinks, so they may still differ from the inline route. The sample did not exercise that path, and it is not verified.🤖 Generated with Claude Code
https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4