Repository navigation
fix(gateway): preserve attachment order in chat history - #121980
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Land-ready proof for Root cause and owner: Gateway attachment persistence reconstructed durable media through an image-only ordinal ( Canonical fix: Removed policy: the image-first/non-image-last reconstruction and durable path projection are gone. A failed inline durable save remains nonfatal to the live turn but records Scope and size: production Focused proof:
History behavior: current main's producer groups saved inline images and image offloads by image ordinal, then appends remaining non-image media, so order is already wrong before transcript or display consumers see it. The repair records the authoritative fact at parsing time instead of compensating in history readers. Historical rows are intentionally not migrated; the existing ClawSweeper: the only published review comments are Native review artifacts validate in PR-head mode with |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where mixed chat attachments could be reordered in durable history: a turn submitted as video then image was persisted as image then video. The same producer could assign the image layout to the wrong media fact, retain host-local paths beside managed claims, or silently lose an inline image from history when its durable save failed.
Why This Change Was Made
Gateway attachment persistence now carries each attachment's original request index through the byte-to-managed-media boundary, combines saved inline images with existing offloads, and sorts once before writing transcript facts. Durable facts are projected from trusted media-store IDs as claim-only
media://inbound/...references; live/plugin path ownership remains transient and separate. Failed inline-image persistence remains nonfatal to the live turn but records a visible durable omission instead of disappearing silently.This is the ordered-media durability slice extracted from the native-video work. It does not enable provider video input or widen agent, plugin, worker, protocol, config, or storage schemas.
AI-assisted; implementation and review were performed with coding agents under maintainer supervision.
User Impact
Chat history and
sessions_historypreserve the original order of mixed managed attachments. Operators no longer get a misleading attachment order after reload, and new transcript rows do not retain local media paths or signed/original URLs. If an inline image works for the live turn but cannot be durably saved, history says so explicitly.Evidence
[video, image]persisting as[image, video].chat.historyandsessions_historypreserve[video, image], use imagefactIndex: 1, and expose managed claims only.tbx_01kzr1f84x7dd8b2sgncfs1rsx.git diff --checkpassed.+120/-125, net-5; tests:+412/-112; generated/docs/lockfiles: zero.Known scope boundary: historical rows are not migrated; the existing history privacy projection continues to sanitize them.