Route prepared images through the attachment store (#46065)

## What changed

Upload prepared images from messages and tool outputs through the session's `AttachmentStore` before recording history. Use the returned inline bytes or file reference, and fall back to the prepared inline image if upload fails.

Keep history replay on `InlineAttachmentStore` so it does not upload recorded images, and preserve existing file references. Reuse image resizing directly for guardian review comparisons without uploading.

## Testing

Add coverage for upload failure preserving resized inline images. Extend rollout coverage to verify that only new images are uploaded, uploaded bytes have the expected dimensions, and file references and resize notices survive replay.

GitOrigin-RevId: e9966297c3579ef1e52376f0235fe3a7e3ec7ecc
This commit is contained in:
Krish Chainani authored and copyberry committed 2026-09-17 00:49:12 +00:00
1 parent 08663cc91b
commit 5e636ea760
10 files changed
+370 -134

No files matched your search

+2
View File
@@ -158,6 +158,7 @@ impl fmt::Debug for UploadResult {
pub struct InlineAttachmentStore;
impl AttachmentStore for InlineAttachmentStore {
#[tracing::instrument(level = "trace", skip_all)]
fn upload(&self, request: UploadRequest) -> UploadFuture<'_> {
Box::pin(async move {
Ok(UploadResult::Inline {
@@ -166,6 +167,7 @@ impl AttachmentStore for InlineAttachmentStore {
})
}
#[tracing::instrument(level = "trace", skip_all)]
fn resolve<'a>(&'a self, request: ResolveRequest<'a>) -> ResolveFuture<'a> {
let file_id = request.file_id;
Box::pin(async move {