Repository navigation
fix: include inherited attachments in library session pages - #5990
Merged
Merged
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
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
Include inherited prefix attachment references in session-filtered library pages, preserving physical ownership and the branch cut.
Problem
Original polylogue-5gj19 42.F117 (PR #5454 discussion 4078842400) reports
/api/attachments?session=<child>omitting an attachment on an inherited parent message although the child's session read shows it. Both current library readers filter physicalr.session_id, selecting only the child's retained tail.Solution
Use the existing sync composed transcript plan and async lineage segments under their existing pinned snapshot owners. One shared SQL selection joins segment metadata to coordinate-bounded messages and their physical attachment refs before LIMIT/OFFSET. Preserve reference/session/message/native attribution and the existing newest-session/transcript/attachment/reference ordering. The pinned HTTP reader now uses that same SQL instead of its predecessor lexical order.
Refuse incomplete lineage through the existing typed DatabaseError boundary, preserving canonical cycle, dangling branch-point and content-witness decisions. Missing profiles remain readable. No message IDs or full sessions are materialized to filter the page; no writer, acquired Raw ref or durable schema changes.
Verification
agentctl job start polylogue pytest_focused --workspace /home/sinity/.codex/worktrees/attachment-coordinate-evidence/polylogue -- tests/unit/storage/test_attachment_library_lineage.py tests/unit/api/test_attachment_library_page.py tests/unit/daemon/test_http_attachment_library.py tests/unit/storage/test_attachment_first_class_ids.py: job 9065 SUCCESS0, 20 passed / 20 collected, receipt20261005T023847Z-focused-test-2025061-673e4d51. Real API, daemon renderer and pinned HTTP read owner qualify inherited-before-cut, excluded-after-cut/foreign, physical ownership, limit-one offsets, zero-profile readability and missing/content-skew refusal.agentctl job start polylogue verify_quick --workspace /home/sinity/.codex/worktrees/attachment-coordinate-evidence/polylogue: job 9067 SUCCESS0, all 12 gates passed, receipt20261005T024055Z-quick-2028261-5b0303e4. Initial 9066 failed only test object-field typing; final delta adds identity-preserving casts, leaving production and assertions unchanged.devtools schema closure polylogue/storage/sqlite/queries/attachment_records.py: IN. Land before reconvergence; no live rebuild.20261005T023540Z-focused-test-2017013-16737746preserved.Self-review
Reviewed the coherent six-path delta once, then the annotation-only correction. The initial correlated membership predicate was replaced before final qualification by the direct canonical segment/message/ref join.
Residuals
Broader polylogue-5gj19 remains open. Existing canonical planning retains metadata proportional to lineage depth and can count session messages; SQL sorting/offset work can scale with the selected relation. This does not claim constant-time pages. No live rebuild, model/fresh-agent trials, acquired-reference writes or shared Native/Runtime worktree edits.