Repository navigation
fix: Bind the message content identity into the session input projection - #5176
Conversation
#5103 gave an id-less message a content-derived identity: `message_id` is now generated from `content_identity` and `content_occurrence` rather than from position. Two declarations still describe the world before that. The load-bearing one is `SESSION_INPUT_PROJECTION_COLUMNS`. Its digest decides whether a stored session-input binding is still VALID, and the derived profile outputs embed `message_id`. Neither new column was projected, and neither is covered by the projected `content_hash`: that hash's field set is strictly narrower, omitting `is_aborted_mid_stream`, `parent_message_provider_id`, `paste_spans` and `timestamp`, all of which `content_identity` hashes. Change `parent_message_provider_id` on an id-less message and `message_id` moves while every projected column holds still -- the binding reports VALID over a moved output. `content_occurrence` is reachable independently: it is offset-continued on append, so a re-ingest ordering change renumbers it alone. Excluding them instead was not available. `message_id` is itself excluded, on a reason that #5103 made false; excluding its inputs as well would leave the whole message identity unbound. The second is a test-side mirror. `test_lineage_validation`'s hand-built index is the only hand-written `messages` DDL in the tree -- production builds it from the specs -- so its omission was a stale fixture, not a route that could drop columns. Its `identity_source` default was stale from the same PR. `SESSION_INPUT_RECIPE_VERSION` is not bumped: the projection itself moved, so every stored binding already compares unequal. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 52 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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. |
Summary
#5103 made an id-less message's identity content-derived. Two declarations still describe the world before it. One is a latent correctness gap in the session-input binding; one is a stale test fixture.
Evidence
Receipt
.cache/verify/runs/20260914T233651Z-all-207009-89ddea6b(verify_all, job 1699, 22,540 selected, 29 failed).Caveat on that receipt: its
run.jsonrecordsgit_head: f7964acd12b25134c0e2e4cd8f73f9e6557a4a4f— the tip of branchrebase-5165, notmasterand not an ancestor of it — andfinal_git_head: 724d17535. The shared checkout advanced across 7 merged PRs during the run, so it is not evidence of a frozen tree. I re-ran all 29 node ids at truemasterHEAD: 17 reproduce, 12 do not. These 2 are among the 17.Per-failure classification
test_session_partition_convergence::test_the_partition_input_columns_are_projected_or_declared_excludedcontent_identity/content_occurrenceneither projected nor excluded inSESSION_INPUT_PROJECTION_COLUMNS; the binding digest can report VALID over a moved outputtest_lineage_validation::test_hand_built_index_declares_every_production_column_of_route_backed_tablesmessagesDDL mirror not updated for #5103Problem
SESSION_INPUT_PROJECTION_COLUMNSis hashed into the session-input binding digest; a stored binding compares unequal only when a projected value moves. It is a freshness/invalidation digest, and the derived profile outputs embedmessage_id.After #5103,
message_idfor an id-less message is generated fromcontent_identity || '.' || content_occurrence. Neither column was classified.They are not covered by the projected
content_hash. I verified the two field sets directly rather than assuming:content_identityhashes_HASHED_FIELDS["ParsedMessage"]:blocks, delivery_status, end_turn, is_aborted_mid_stream, material_origin, message_type, model_effort, model_name, occurred_at_ms, parent_message_provider_id, paste_spans, provider_message_id, recipient, role, sender_name, stop_reason, text, timestamp, user_context_text._message_content_hash(storage/sqlite/archive_tiers/write.py:2559+) hashes a strict subset — it omitsis_aborted_mid_stream,parent_message_provider_id,paste_spans,timestamp.Concrete counterexample: change
parent_message_provider_idon an id-less message.content_identitymoves →message_idmoves → derived rows carry new message ids.content_hashdoes not move (that field is not among its inputs) andparent_message_idis itself declared-excluded. Every projected column is unchanged, so the binding reports VALID over a moved output.content_occurrenceis reachable independently: it is offset-continued on append, so a re-ingest ordering change renumbers it without touching any other projected value.Solution
Project, do not exclude. Exclusion was not actually available:
message_idis itself excluded, on a reason #5103 made false ("generated from session_id, position, variant_index and native_id"). Excluding its inputs as well would leave the entire message identity unbound by the digest. That stale reason is corrected here too.Both options are AST-visible changes to
input_binding.pyand move the schema identity identically, so the cheaper-looking option was not cheaper.The second change is a pure test fixture.
grep -E "CREATE TABLE (IF NOT EXISTS )?messages"overpolylogue/,devtools/,tests/returns exactly one production DDL site, generated from the specs — so no production route could have silently dropped these columns. Itsidentity_sourcedefault ('positional'vs production'content') was stale from the same PR and is corrected.SESSION_INPUT_RECIPE_VERSIONis not bumped: the projection tuple itself moved, so every stored binding already compares unequal.Verification
Because the projection is closure-bearing, I also ran every declared consumer of the binding and the derived-identity gates:
Schema closure
IN. This PR moves the derived schema identity and requires full reconvergence. Land it before any rebuild begins.
Anti-vacuity
The completeness test goes red on any
messagescolumn that is neither projected nor declared-excluded — removing either new entry reproduces the failure exactly. The lineage fixture test goes red by name if either column is dropped from the hand-built DDL.Honest residual on the projection specifically: that completeness check proves the columns are classified, not that projecting them was the right classification. The existing role differential at
test_session_partition_convergence.py:965is not parameterized over these columns, so it does not cover them. The non-vacuous test would be a differential on a session of id-less messages that movesparent_message_provider_id(orpaste_spans) socontent_identitymoves whilecontent_hashand every other projected column hold still: the binding must change with the columns projected, and must not with them monkeypatched out. I have not added it — flagging it as follow-up test work rather than claiming coverage this PR does not have.Residuals
CLAUDE.md's identity section still documents the retiredp:positional fallback; fix: Derive id-less message identity from content, not position #5103 replaced it withc:. Not corrected here — separate concern, and it is doc text rather than a closure input.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK