Skip to content
askdareDocumentation

    ADR-0037: Attachments in your own storage: the FileStore port and @boldare/askdare-s3

    • Status: Accepted on 2026-11-30: the maintainer settled every question as recommended ("Settled with the maintainer", below). The tasks that build it amend it where building shows otherwise; f1's amendments are under "As built in 0.8-f1", f2's under "As built in 0.8-f2", f3's under "As built in 0.8-f3".
    • Date: 2026-11-29
    • Extends: ADR-0024. Decision 6 there (files deleted with their conversation, and by sweep) reaches a file store too. ADR-0032, decision 4, keeps its order; only its last step changes.
    • Evidence: OpenAI's docs, read through the openaiDeveloperDocs MCP server on 2026-11-29 (below). No spike: the numbers are from the docs and askdare's own defaults, and the implementing task measures what they leave open (settled question 9).

    Context

    A visitor's images and PDFs go to OpenAI Files today: POST <basePath>/attachments checks the bytes (attachments/files.ts), uploads them with purpose user_data and a 30-day expires_after (openai/gateway.ts), and returns an encrypted handle that carries the file ID (security/tokens.ts). The turn then references the file by file_id (openai/items.ts), in both conversation modes. Deleting a conversation, or sweeping it, deletes its files through the gateway's deleteFiles.

    That is the last "kept at OpenAI" exception for an app on its own conversation store (own your data): /v1/files keeps application state until deleted and isn't eligible for Zero Data Retention, so a ZDR project has to leave attachments off. /v1/responses with store: false is eligible, and it accepts the same files inline. The bytes then need a home in the app's own infrastructure, which is what this ADR decides.

    What the Responses API takes (checked 2026-11-29)

    • File inputs: an input_file is a file_id, a Base64 data URL in file_data (with a filename), or an external file_url. PDFs give the model their text and page images; detail (auto, low, high) applies to the page images. Each file must be under 50 MB, and all files in one request together under 50 MB.
    • Images and vision: an input_image is an image_url (an https URL or a Base64 data URL) or a file_id. PNG, JPEG, WebP and non-animated GIF; up to 512 MB of payload and 1,500 images per request; at most 30,000 patches per image, rejected rather than resized above that.
    • Data controls: /v1/files keeps files until deleted (or expires_after) and is not ZDR-eligible; /v1/responses keeps no application state with store: false and is ZDR-eligible. Under every retention setting, image and file inputs that the CSAM classifier flags are kept for review. Data sent to third-party services over the network follows their retention.
    • Prompt caching: a cached prefix may include conversation history with images and documents. The prefix must be identical.
    • Replay: with store: false OpenAI keeps nothing between requests, so every turn that replays a message must carry its file again, in one of the three forms. The docs say nothing about caching fetched URLs between requests.

    The numbers that decide inline versus URL

    With askdare's defaults (attachments.maxBytes 4 MB, maxPerMessage 3, maxPdfPages 50; the widget re-encodes photos as JPEG of at most 2,048 px, usually well under 1 MB):

    Inline (Base64 in the request)Signed URL (OpenAI fetches it)file_id (today)
    Request bytes for one 4 MB PDF5.33 MB (Base64 adds a third)About 0.5 KBAbout 50 bytes
    Default maximum per message (3 × 4 MB)16 MB1.5 KB150 bytes
    PDFs one request can replay at 4 MB9 (50 MB limit, if it counts encoded bytes; 12 if decoded)12 (decoded size)12
    Input tokens for a 20-page PDFAbout 40,000 (askdare's 2,000 per page)The sameThe same
    Tokens on later turnsReplayed and cached, as any historyThe same, if the cache matches (unknown for URLs that change)The same
    Bytes moved over 20 turns, one 4 MB PDF80 MB read from the bucket, 107 MB sent to OpenAI80 MB fetched by OpenAI from the bucketNone
    Added time per turn per 4 MB file (estimate, not measured)0.04 s at 1 Gbit/s, 0.43 s at 100 Mbit/s upstream, plus a bucket readA fetch by OpenAI, undocumentedNone
    Money beyond tokens, 20 turnsIn-region bucket reads: none on S3 and R2S3 internet egress: 80 MB × about 0.09 USD/GB ≈ 0.007 USD; R2: noneNone
    Where the file goesOnly into the model requestA URL in the request, valid for anyone who has it until it expires; the bucket must be reachable from the internetOpenAI Files, kept until deleted
    Same request JSON on every replay (ADR-0024, decision 3)YesNo, unless one URL lives as long as the conversation (SigV4 presigned URLs last at most 7 days)Yes

    Tokens are the same however the file arrives: the model reads the same pages and pixels. The money that differs, egress, is about 0.01 USD per conversation against tens of thousands of input tokens. What differs in a way that matters is determinism, where the bytes travel, and whether the bucket must be public-facing. That decides it for inline (decision 2).

    One side note on tokens, not for this ADR: askdare sends images with detail: 'auto' and estimates 1,500 tokens each, but on the newest model families auto now means original, up to 30,000 patches per image. The estimate was checked separately, in 0.8-h2: images now go with detail: 'high' (see settled question 10).

    Decision

    1. A public FileStore port (names final in the implementing task):

      interface FileStore {
        /** Stores one file and returns its new ID. */
        put(file: StoredFileInput, options?: { signal?: AbortSignal }): Promise<string>;
        /** The file, or `undefined` when it is gone (deleted, swept or never existed). */
        get(id: string, options?: { signal?: AbortSignal }): Promise<StoredFile | undefined>;
        /** Deletes files. Unknown IDs are not an error; calling it twice is fine. */
        delete(ids: readonly string[], options?: { signal?: AbortSignal }): Promise<void>;
        /** Deletes up to `limit` files stored before `before`; resolves to how many it deleted. */
        sweep?(before: Date, limit: number, options?: { signal?: AbortSignal }): Promise<number>;
        diagnose?(options?: { signal?: AbortSignal }): Promise<FileStoreCheck>;
      }
      
      interface StoredFileInput { bytes: Uint8Array; mime: string; name: string }
      interface StoredFile extends StoredFileInput { storedAt: Date }

      What every store must guarantee, and the contract suite checks:

      • IDs are random and opaque: at least 128 random bits, letters, digits, _ and -, at most 128 characters. An ID and its object key reveal no bot, visitor, conversation or file name. The store chooses the ID, never the caller.
      • No public access: no public listing and no public reads. The port has no list, and askdare never hands a store's URL to the browser. Only sweep lists, inside the store.
      • Bytes come back exactly as stored, with their type and name.
      • Nothing in logs but IDs, counts and error codes (ADR-0004).

      Ownership stays where it is today: the attachment handle (a JWE for one bot and visitor, valid for 1 hour) carries the ID, so the client never sees or chooses one, and later turns reach a file only through the stored conversation that references it.

    2. Inline, not URLs. With a file store, every turn that sends a file sends its bytes: images as input_image with a Base64 data URL in image_url (detail as today), PDFs as input_file with filename and file_data. Core reads the files from the store and hands them to the gateway; only src/openai/ builds the request (ADR-0002). The same stored part always maps to the same JSON, so the prompt cache and ADR-0024's determinism hold. Nothing leaves the app but the model request, and the bucket can stay private, even on a network OpenAI can't reach.

    3. Only with an item store. A file store needs a conversation store that replays (memoryConversations(), postgresConversations()). With openaiConversations() the inline bytes would be stored in the OpenAI conversation, which isn't ZDR-eligible either, so createChatHandler refuses that combination at startup with a message saying why (settled question 3).

    4. A cap per conversation. Every turn replays every file still in the window, and OpenAI takes at most 50 MB of files per request. A new option, attachments.maxPerConversation (default 8: 8 × 4 MB × 4/3 = 42.7 MB, with room for the rest of the request), refuses one more upload with a clear message, as maxPerMessage does. It applies only with a file store; files before a compaction (ADR-0029) aren't replayed and don't count.

    5. The stored part says where the file is. A file part (StoredPart, ADR-0024) gains where its bytes live: OpenAI Files or the app's file store. A part without it is an OpenAI file, so conversations from before the switch keep working until their files expire there. The attachment handle's file ID check accepts both kinds, each only for its own place.

    6. Lifecycle.

      • DELETE <basePath>/conversation and the console's delete (0.8-a2) keep ADR-0032's order: the admin store, then conversations.delete(id), then the files it returns, now split by place: files.delete(ids) for the file store, the gateway's deleteFiles for OpenAI Files.
      • sweep() on the handlers deletes the files of the conversations it swept the same way, and then calls files.sweep(before, limit) with files.retentionDays (default 30, today's OpenAI expiry). That also removes files uploaded but never sent (their handle expired after an hour). sweep()'s result counts both.
      • A file older than the retention is gone even if its conversation lives on, as an OpenAI file is today after 30 days. Apps can add a bucket lifecycle rule with the same age as a backstop; the docs show one for S3 and R2.
      • A conversation whose file is gone keeps working. When get answers undefined, the turn sends a text part in its place, such as [Attachment "invoice.pdf" is no longer available.], the same every time, so only the turn that first misses it loses the cache. The history still shows the file's name, as today; only the model gets the placeholder.
    7. The add-on: @boldare/askdare-s3, exporting s3Files({ bucket, prefix?, endpoint?, region?, credentials, forcePathStyle? }). One client for AWS S3, Cloudflare R2 and MinIO, speaking the S3 API over fetch with SigV4: PutObject, GetObject, DeleteObjects (in batches of up to 1,000), ListObjectsV2 for sweep, and diagnose() writing, reading and deleting one test object. Object keys are <prefix><id>; the type and name go in the object's metadata. Server-side encryption is the bucket's setting, which the README tells apps to turn on. The client is a small SigV4 one, not the AWS SDK (settled question 4).

    8. Tests. fileStoreContract joins the suites in @boldare/askdare/testing (ADR-0024, decision 10), with the same (name, create, { describe, it, expect }) shape; it deletes everything it writes, also after a failed test. Core gets memoryFiles() for tests and local development, with the per-instance warning in production that memoryConversations() has. The S3 add-on runs the suite in CI against MinIO in a service container pinned by digest, with path-style URLs; a live smoke script (scripts/smoke-*.ts) runs it against AWS S3 and R2 before a release, as the Upstash stores were checked live for 0.7.

    9. Defaults. Without files, nothing changes: OpenAI Files, uploaded and deleted as today. askdare doctor says which store each bot's attachments use, and why it matters: "OpenAI Files (not eligible for Zero Data Retention)" or "your file store". With a file store, doctor runs its diagnose() and uploads no test file to OpenAI, so a ZDR project's doctor run touches /v1/files no more.

    10. Public surface (added to ADR-0006 when this is built): the FileStore port and its file and check types, memoryFiles, the files option of createChatHandler (the store and retentionDays), attachments.maxPerConversation, fileStoreContract in @boldare/askdare/testing, and @boldare/askdare-s3's s3Files. A minor changeset for core, a new package for the add-on. The protocol doesn't change: the widget uploads and sends handles as before.

    11. What stays out:

      • Virus and malware scanning. askdare checks types by their bytes, refuses SVG, animated images and encrypted PDFs, and counts PDF pages; anything more is the app's, for example a bucket event that scans new objects.
      • Resizing on the server. The widget already downsizes photos to 2,048 px.
      • Files that the bot's tools produce, and a download link for visitors' own files: the store holds model input only, and no route serves its bytes.
      • Uploads straight from the browser to the bucket (presigned PUT). Files still pass through the handler, which checks them; 4 MB fits Vercel's 4.5 MB body limit.
      • Other providers' file blocks. The port is provider-free, so a native adapter (ADR-0026) can read from it later; how it sends files is decided with that adapter.

    Consequences

    • An app on its own conversation store, with a file store, keeps nothing at OpenAI beyond abuse-monitoring logs, and with ZDR not even those, except flagged CSAM. The table in own your data loses its last "Not eligible" row for such apps, once built.
    • Each turn of a conversation with files reads them from the bucket and sends them again: about 5.3 MB more request per 4 MB PDF, on every turn. Conversations with several large PDFs are slower to start answering than with file_id, by roughly 0.04 to 0.4 s per such file, to be measured (settled question 9). Most attachments are photos under 1 MB.
    • Requests get large. The SDK's timeout and the app's function memory must allow the 42.7 MB worst case at the default cap.
    • One more service to run: a bucket, its credentials, its encryption and lifecycle settings. The docs cover AWS S3 and R2.
    • Mixed conversations are possible during a switch: old files at OpenAI, new ones in the bucket, both deleted with the conversation.
    • The OpenAI default path, the protocol, the widget and the React entry are unchanged: no bytes reach the chat bundles.

    Alternatives considered

    • Signed URLs (image_url and file_url pointing at the bucket): small requests, but the request changes on each replay unless one URL outlives the conversation (at most 7 days with SigV4), whether OpenAI's cache survives a new URL is undocumented, the URL works for anyone who has it until it expires, it lands in abuse-monitoring logs, and the bucket must be reachable from the internet, which rules out a private MinIO. Its saving is egress-sized: under a cent per conversation.
    • Keep OpenAI Files and only delete sooner: still not ZDR-eligible, which is the gap.
    • Files in the conversation store (Postgres bytea, Upstash values): no new service, but megabytes in rows that every page and replay reads near, Upstash's request size limits, and backups that grow with files. A database-backed FileStore is still possible behind the port, by anyone.
    • Inline once, then refer to the earlier response: needs previous_response_id or stored responses, which store: false rules out.
    • Text extracted from PDFs instead of the file: loses page images, which the model reads for scans, tables and charts.
    • A @boldare/askdare-postgres file store first: most apps that need ZDR for files already have a bucket, and S3-compatible storage is one API for three hosts.

    Settled with the maintainer (2026-11-30)

    The questions left open in the draft, all settled as recommended. The alternative each one weighed is kept here.

    1. Inline or URL?
      • Settled: inline (decision 2). The URL's only gain is request size, and it costs determinism, privacy and a reachable bucket.
      • The alternative, signed URLs, is under "Alternatives considered".
    2. How is the replay kept under OpenAI's 50 MB of files per request?
      • Settled: a count, attachments.maxPerConversation, default 8 (decision 4). Whether the 50 MB counts encoded or decoded bytes isn't documented; 8 fits either.
      • The alternatives: a byte budget, more exact but harder to explain; or dropping old files from the replay, which silently changes what the model sees.
    3. A file store with openaiConversations()?
      • Settled: refused at startup (decision 3). Allowing it would store the bytes in a conversation that isn't ZDR-eligible while the app believes they are in its bucket. It can be allowed later without breaking anyone.
    4. The S3 client?
      • Settled: a small SigV4 client, aws4fetch (one file, no dependencies, MIT) pinned, or the same in about 150 lines of our own over WebCrypto; the implementing task picks between the two. credentials also takes an async function, so an app on IAM roles passes the AWS SDK's provider itself.
      • The alternative, @aws-sdk/client-s3, has the AWS credential chain built in, but is many packages and slower cold starts for four calls.
    5. Uploads that are never sent?
      • Settled: deleted by age only, with files.retentionDays (decision 6).
      • The alternative: mark a file when its first turn sends it (an S3 object tag, which a lifecycle rule can match), so unsent files go after a day, at one more request per file. Later, if someone asks.
    6. Configured on the handler or per bot?
      • Settled: on the handler, createChatHandler({ files }), server-only like conversations, and outside bot/define-bot.ts, a hot file in 0.8. Only maxPerConversation is per bot, next to the other attachment limits.
    7. The missing-file placeholder for OpenAI files too?
      • Settled: not in this work. An item store that replays an expired OpenAI file_id likely fails the turn today, and only OpenAI's answer says the file is gone, not our store. Its own task, 0.8-h1, built it: OpenAI answers a replayed file that is gone with 404 Files [<ids>] were not found (verified live on 2026-11-30), and the turn and compaction retry once with this decision's placeholder in its place, nothing stored rewritten. Both paths use one text, missingAttachmentText in attachments/missing.ts.
    8. MinIO in CI?
      • Settled: the last community image, pinned by digest (decision 8). MinIO's community edition stopped publishing prebuilt images in 2025 (to be confirmed by the implementing task); a digest pin keeps working for a test emulator. If it can't be pulled, another S3-compatible server in a container takes its place, with path-style URLs.
    9. Evidence before accepting, or as built?
      • Settled: as built. The port task's live smoke run sends a 4 MB PDF inline over 10 turns on the model in examples/starter, and records the added time per turn, the cached share of input, and whether OpenAI's 50 MB counts encoded bytes. This ADR is amended with those numbers, as ADR-0024 and ADR-0032 were.
      • The alternative, a spike first, would measure the same thing without the code.
    10. The image token estimate (noticed while reading the vision docs, not part of this decision):
      • Settled: a Hygiene task, 0.8-h2. IMAGE_TOKENS (1,500) assumes high detail, but auto means original on the newest model families.
      • Done (2026-11-30): images are sent with detail: 'high' (IMAGE_DETAIL in openai/items.ts, at most 2,500 patches) and reserve 3,100 tokens; PDFs stay without a detail and reserve 4,000 per page; the default maxPdfPages is 40, which the maintainer approved on 2026-11-30. The inline mapping (decision 2) must use the same IMAGE_DETAIL. The measurements are in Attachments.

    As built in 0.8-f1

    Amended on 2026-11-30 (task f1, the port), where the code differs from or adds to the decision above:

    • Decision 1, the names: FileStore, StoredFile, StoredFileInput, FileStoreCheck and memoryFiles from @boldare/askdare, as drafted. Every method takes { signal } in an options object, as drafted, and sweep takes a Date; the options type is not exported.
    • Decision 1, diagnose: it resolves to readonly FileStoreCheck[], not one check, as ConversationStore and AdminStore do, so doctor lists each finding. FileStoreCheck has their check's shape: status (ok, warn or fail), title and an optional fix.
    • Decision 8, the suite: fileStoreContract also takes sweepGapMs (default 1,100 ms, the pause around the sweep test's cutoff, for S3's LastModified kept to the second), largeBytes (default 4 MB) and timeoutMs, exported as FileStoreContractOptions. It checks 128 random bits as far as a test can: IDs of at least 22 characters, unique, and at least 22 characters each past any prefix they share, such as a time. The sweep test deletes everything stored before its cutoff, so the suite runs against a prefix of its own, one test at a time.
    • Decision 8, the warning: memoryFiles() warns once per store created in production, as memoryConversations() does, and copies bytes in and out.
    • Not yet (when f1 merged; both done in 0.8, below): the handler's files option, maxPerConversation, the stored part's place and the inline request are 0.8-f3; s3Files is 0.8-f2. docs/custom-store.md says so until f3.

    As built in 0.8-f2

    Amended on 2026-11-30 (task f2, @boldare/askdare-s3), where the code differs from or adds to the decision above:

    • Settled question 8, MinIO in CI: confirmed on 2026-11-30 that MinIO publishes no community images any more: minio/minio is gone from Docker Hub (pull denied, not listed under the minio organization) and quay.io/minio/minio answers every tag, latest and old RELEASE.* ones alike, with "no such manifest". CI and the package's docker-compose.yml run bitnamilegacy/minio:2025.7.23-debian-12-r5, Bitnami's last build of MinIO (server 2025-07-23), frozen in Bitnami's legacy repository since August 2025, pinned by its index digest sha256:6dabb4a2088c9a79908de3bc05f4586c23ad2182c8908e7e3acbf61c1467fb20 (amd64 and arm64). It is still MinIO, so the suite runs against the server the ADR meant, configured by environment variables alone (a service container can't take a command), with the test bucket created by the image. If Bitnami removes the legacy repository, the next choice is another S3-compatible server that verifies SigV4 and is configured by environment variables, such as RustFS (rustfs/rustfs, not tried in f2); not Adobe's S3Mock, which doesn't check signatures.
    • Settled question 4, the client: our own SigV4 (packages/askdare-s3/src/sigv4.ts, about 80 lines), not aws4fetch: no dependency in the code that holds the secret key, and only header signing for four calls. It signs with node:crypto rather than WebCrypto, synchronous and simpler, since askdare runs on the Node.js runtime only. Its tests are AWS's three published S3 examples (GET Object, PUT Object, list objects), matched to the signature, and the contract run against MinIO, which checks every signature. Every body is signed with its SHA-256 (no UNSIGNED-PAYLOAD), which also checks it arrived whole.
    • Decision 7, the calls: DeleteObjects carries Content-MD5, the checksum S3 requires on that call and every S3-compatible server takes; an integrity check, not security. It runs in Quiet mode, and throws when S3 reports keys it couldn't delete. Every request has a 30-second timeout besides the caller's signal, and refuses redirects.
    • Decision 7, keys and metadata: keys are <prefix><id>, the prefix by default askdare-files/ (letters, digits, ., _, - and /; no . or .. segments). The type is the object's Content-Type; the name is x-amz-meta-name, percent-encoded (S3 metadata is ASCII), which keeps ASCII names readable in a bucket console. get and delete refuse IDs that aren't 22 base64url characters before any request, and sweep lists with delimiter=/ and deletes only keys of that shape directly under the prefix, so it never touches another object in the bucket.
    • Decision 7, diagnose: besides writing, reading and deleting a test file, it reads the deleted file again and lists one key. Without s3:ListBucket, S3 answers a missing object with AccessDenied instead of NoSuchKey, which would fail a conversation whose file had expired instead of sending decision 6's placeholder; doctor says so. Failures give the S3 error code and a fix, never the error's message.
    • Decision 8, the live smoke: a *.smoke.ts file run by pnpm smoke (packages/askdare-s3/src/s3.smoke.ts), as the other live checks are, rather than a scripts/smoke-*.ts. It runs the contract and diagnose() against AWS S3 and R2, each when its variables are in .env.smoke.local (docs/live-testing.md); RELEASING.md asks for it before a release that changes the add-on. Not run in f2: the maintainer's buckets are needed, so it is a checkbox for 0.8-y1.
    • forcePathStyle: off by default, as in the AWS SDK. It is required, not guessed, for an endpoint on localhost or an IP address (no subdomains there) and for a bucket name with dots over https (<a.b>.s3.amazonaws.com doesn't match the certificate). The prefix must not be empty, so sweep never scans a bucket's root.

    As built in 0.8-f3

    Amended on 2026-11-30 (task f3, the handler), where the code differs from or adds to the decision above:

    • Decision 2, the request: an image goes as { type: 'input_image', image_url: 'data:<type>;base64,…', detail: IMAGE_DETAIL }, the detail 0.8-h2 reserves tokens for; a PDF as { type: 'input_file', filename, file_data: 'data:application/pdf;base64,…' }, without a detail, as with file_id. Core reads the window's files (TurnFiles in gateway.ts, at most 8 at once) and hands bytes to the gateway; src/openai/ encodes each file once per turn and reuses the string on every step, so every replay sends the same JSON. Core checks each file's type again from its bytes, and builds the file name again from the stored one: a store, or anyone who can write to its bucket, can't change the type the model is told. A file whose bytes are no longer an image or PDF counts as missing.
    • Decision 3: createChatHandler refuses files with a provider store (one marked as such, as openaiConversations() is) with a TypeError that says why. It also refuses a bot whose maxPerConversation × maxBytes, Base64-encoded, would pass 50,000,000 bytes, so a maxBytes raised to 20 MB can't build a conversation that every turn fails, and a maxPerConversation below maxPerMessage, which would refuse a new conversation's first message. A store without sweep gets a startup warning: retentionDays then deletes nothing, and the bucket's lifecycle rule is the only retention. The gateway refuses file-store attachments in a provider conversation as a second line.
    • Decision 4, the cap: checked inside the turn, on the window the turn replays (the stored items from the latest compaction of the bot's model on, and the opening message), before the opening message is stored. That append expects the version the window was read at, so two turns that both pass the check can't both store their files: the cap holds without a lock. One more file is refused as invalid_input with the key error.conversationFiles, "This conversation can have up to {max} files. Start a new one to attach more.", in every locale; it arrives as the stream's error, not as a 400 on POST /messages, since only the turn reads the conversation. A file counts once however often it was sent; a message without files is never refused. The cap counts OpenAI files in the window too, so a conversation mid-switch is held to the same number. maxPerConversation is 1 to 50 and stays on the server: the widget's config doesn't carry it, so the protocol doesn't change.
    • Decision 5, the place: the file part gains location?: 'file-store'; absent is an OpenAI file. The attachment handle carries it as loc, and checks the ID by place: file-… for OpenAI, the port's shape (22 to 128 letters, digits, _ and -, not starting with file-) for the file store. A file store's handle sent to a handler without files is refused like an expired one.
    • Decision 6, deleting by place: ConversationStore.delete and sweep keep returning plain file IDs, so stores written for 0.7 and the Postgres add-on need no change. askdare tells the places apart by the ID: OpenAI's start with file-, and putAttachment makes sure a store's never do (a random 22-character ID does so about once in 10⁹ puts; askdare deletes it and puts again, at most three times), and an ID outside the port's shape fails the upload. The file store's delete failing is reported to onError with a count, never the store's message, and the OpenAI files are still deleted; the store's retention removes what is left. A file-store ID left over after files was taken out of the config is logged as a count.
    • Decision 6, sweep(): after the idle conversations and their files, files.sweep(before, limit) runs in batches of 500, up to ten times limit per call, as the admin records do; more says when it stopped at that cap. files in the result counts both. The admin records come last; a file store that fails there is reported to onError by its error's class name and more is set, and the admin records are still swept.
    • Decision 6, missing files: a replayed file the store no longer has goes in as missingAttachmentText (0.8-h1's text, without a name: the stored part has none, and the conversation store keeps no file names). A file attached in the turn itself that is already gone fails the turn with error.attachmentExpired, as h1 does for OpenAI files. A store that fails (rather than answering undefined) fails the turn before the visitor's message is stored, and before a visitor's answer to an approval card runs the tool (ADR-0038), so a retried approval never runs it twice. A conversation replayed without files (the handler lost its file store) sends such parts as their placeholder.
    • Decision 9, doctor: with files, the gateway's check skips the test upload, each bot with attachments reports "Attachments go to your file store, up to N per conversation; nothing is kept at OpenAI Files.", and the store's diagnose() joins the store checks (10-second deadline). Without files, the OpenAI check now says "Attachments go to OpenAI Files (not eligible for Zero Data Retention)".
    • Compaction (ADR-0029) reads the window's files the same way and sends them inline, so its request starts like the turn's and reads its cache.
    • Not covered: the console's playground and askdare eval don't get the file store: their conversations carry no attachments.
    • Settled question 9, the live smoke run: not run. The smoke project was out of credit on 2026-11-30 (h1 hit 429 credit_balance_exhausted the same day), so the added time per turn, the cached share of input over 10 turns with a 4 MB PDF, and whether OpenAI's 50 MB counts encoded bytes are still open. The cap holds either way (42.7 MB encoded at the defaults). The next funded run records them here; until then, docs/deployment.md gives the estimate from the table above.
    • Settled question 9, run at the release (y1, 2026-12-01, gpt-6-luna): a 4 MB PDF from memoryFiles() sent inline (5.3 MB of Base64 per request) over 10 turns: first text after 4.1 to 10.6 s per turn (median about 6.7 s), with no turn failing. The PDF reaches the model (it answered the secret word); a text-only page costs luna about 30 tokens, too few for the prompt cache, so caching was measured with a 4 MB PDF carrying about 3,100 tokens of text over 4 turns: 0% cached on the first turn, then 98 to 99% from the second, so inline bytes don't break the cache. The 50 MB probe sent ten 4 MB PDFs in one request, 39.9 MB decoded and 53.2 MB as Base64: accepted, so OpenAI's limit counts decoded bytes (or is higher). The cap of 8 files fits either way; it could allow 12 at 4 MB, left as is.