Repository navigation
Description
Summary
Replacing a product's image, or deleting the product, deletes the old image's stored bytes even when a task lists that image as an attachment. The task keeps showing the file, but its bytes are gone. Per #4085, every run start for that task then fails as input_missing.
This is the class of #4104 in one more lane. #4109 moved deleteFile, the abandoned-upload sweep and the rejected-upload reclaim onto one holder rule, blobRefHeld, whose docstring says it is "ONE predicate for every lane that deletes bytes outside the release seam". The product image release still keeps its own copy, which knows file rows and documents only, not tasks.
Agent #2 found this from source in the #4109 review (TALE-487, MEDIUM follow-up, "UI reach unverified"). This issue confirms it on a native local stack and shows an API reach path.
Source and environment
- Source:
origin/main3b23bd2cb3bc5a247895c7e7423c82deceefc901(fix(platform): reclaim a rejected upload only when nothing holds it #4109). - Local native stack, owned by the TALE-358 local-qa occurrence 2026-10-03 08:15 Zurich, run
bab9f790-2159-4a21-88a7-4b46daffdf28:- Database: PostgreSQL 16.15 (PGDG bookworm) with pg_search 0.22.6 and pgvector 0.8.6, initialized like
tale-db, on127.0.0.1:55372. - App:
bun scripts/dev.ts(backend127.0.0.1:3676, Vitelocalhost:3671), with egress to a dead proxy. - Object store: a local S3 test double on
127.0.0.1:59072that logs every request, so each DELETE the backend sends is visible. - Data: synthetic owner and organization
proof-e1-mus07drs.
- Database: PostgreSQL 16.15 (PGDG bookworm) with pg_search 0.22.6 and pgvector 0.8.6, initialized like
Root cause
All references are to services/platform at 3b23bd2cb.
- The product release keeps its own holder copy.
releaseManagedImage(backend/domains/products/service.ts:292-337) returns the old image's ref for deletion unless another file row or a document still serves it (:325-336). It never asksblobRefHeld(backend/domains/files/blob-holders.ts:29), so it also missestaskHoldsBlobRefand a document's retainedhistory_files. - Both product routes then delete what it returns.
POST /products/:productIdandDELETE /products/:productIdcalldeleteOrgBlobRefson the released refs (backend/domains/products/routes.ts:276,:289). - A task can hold the image's ref. The task door's ownership proof (
ownsUploadedBlob, file-row arm) accepts a ref whose file row names the caller as uploader. The product image upload registers exactly such a row.
Reach
The path is API-only. The product image URL names the image's file ID, and GET /api/app/files/:fileId returns {file: {storageRef}} to the uploader (backend/domains/files/access.ts:82). POST /api/app/tasks then accepts that ref as an attachment.
The shipped task UI uploads fresh files rather than picking existing ones, and REST v1 carries no task attachments. So no UI path was observed.
Deterministic reproduction
The probe is scripts/e1-product-image-holder.ts, retained in the TALE-358 evidence archive TALE-358-local-qa-r20261003T0815-evidence.tar.gz with its log and the S3 double's request log. All steps go through the session doors under /api/app, as one synthetic owner.
| Case | Steps | DELETEs of the old image's key | Bytes after | Task still lists the ref |
|---|---|---|---|---|
| C, control | POST products/images → product with that image → upload another image → POST products/:id {imageUrl: new} |
1 | gone (expected: nothing else holds it) | — |
| H | as C, but before the replace: GET files/:fileId → storageRef (200), then POST tasks with it as an attachment (200) |
1 | gone | yes |
| H2 | as H, but DELETE products/:id instead of the replace |
1 | gone | yes |
On the same build, DELETE files/:fileId on a task-held ref keeps the bytes (#4109's deleteFile lane; case C4 of TALE-358's #4104 recheck, run bab9f790). Only the product lane still deletes them.
Expected
A product image's bytes go only when nothing holds them, by the same blobRefHeld rule the files lanes use. In H and H2 the bytes stay while the task lists the ref.
Observed
In H and H2, the store receives DELETE /tale358-r0815/proof-e1-mus07drs/<key> for a key the task's attachments still lists.
Acceptance checks
- One rule:
releaseManagedImagedecides withblobRefHeld, covering file rows, documents (file_refandhistory_files) and tasks, instead of its own copy. The "ONE predicate" docstring then holds. - Regression lanes: H and H2 keep the bytes (
backend:integration, with an object store so a DELETE would be seen), and control C still reclaims an image nothing holds. - No other lanes left: sweep the remaining
deleteOrgBlobRefscallers, for exampledocuments/project-text.ts, connectorsblob-sink.tsand video links. Each either holds a ref nothing else can name, or asks the shared rule.
Limits
- Object store: a test double that ignores authentication, not MinIO.
- Database differences from
tale-db: bookworm PostgreSQL 16.15 vs the image's trixie build, and pgvector 0.8.6 vs 0.8.1. - Not exercised: the
history_filesarm and a document holder (both from source only). - No UI path observed.
Activity
fix(platform): keep a product image's bytes while anything holds them
fix(platform): keep a product image's bytes while anything holds them (…
yannickmonney commentedon Oct 3, 2026
QA recheck of the product-image lane after #4115 (TALE-358 local-qa, run
dd5617f2-d498-4388-8c13-d636315118b7,maina7efe1c51). This replays this issue's own probe e1 natively, with a logging S3 test double; I didn't write #4115.3b23bd2cb)a7efe1c51)The product lane is fixed. This issue stays open for its other lanes (video-link cleanups, staged skill and automation bundles), per the manager; those weren't exercised here.
yannickmonney commentedon Oct 4, 2026
Post-merge recheck of #4110's remaining lanes (#4129) on
main74758294b: passes for the two lanes driven live. The other two hold by CI and source. #4129 closed #4110 on 2026-10-03 at 13:54:57Z. The product-image lane (#4115) was already rechecked in issuecomment-5968305304.--chat-max-widthCSS variable #3 (4aec6e61-0328-4213-9719-02d387dee65d), runsbe852ac8(static sweep, 2026-10-04 20:15 Zurich) and91313a43-bf7b-4e9e-8ba6-84ef6dd5831d(live, 2026-10-05 00:15 Zurich). Agent add--chat-max-widthCSS variable #3 filed bug(platform): replacing or deleting a product's image deletes bytes a task lists #4110 and wrote neither fix(platform): keep a product image's bytes while anything holds them #4115 nor fix(platform): delete cleanup bytes only when nothing holds them #4129.Live, against this occurrence's own stack
Each case lists its controls.
tasks/retire.tsreleaseUnlistedTaskBlobRefs; probek1).POST /products/images) and create a product with it. Put the image's storage ref on a task, then edit the task's attachments to[].file_metadatarow stays active (source = 'product-image',lifecycle_statusNULL).200, and the product'simage_urlis unchanged.files/blob-upload→ PUT →files/register), listed by a task and then dropped.204) about 2 s after the drop, and its row is reaped.files/upload-intents.ts:226; probek2).skill_bundleand anautomation_bundlethroughPOST /files/upload?purpose=…, then put eachstorageIdon a new task.403 TASK_ATTACHMENT_NOT_OWNED. All staged bytes stay in place.purpose=fileupload is accepted by the same door (200).Not driven live: the two video-link lanes
The cancel/retry/watchdog cleanup and the 7-day unbound GC need an engine-produced transcript row.
feb13bf04), the Backend integration job (111200343229) passed "a cancelled video link keeps the bytes a task or a document holds…" and "the unbound video-link GC keeps the bytes a task or a document holds and a document's row…", among 1503/1503 checks.main: the byte-deletion call sites are line-for-line identical to fix(platform): delete cleanup bytes only when nothing holds them #4129's merge (5ee043679), apart from line numbers. fix(platform): keep bytes a pending mail or a chat message lists #4157 has since widenedblobRefHeldwith pending outbound mail and chat user messages.Environment
origin/main74758294bf9f9fb9bac80098a13fba3517d00131, in a clean detached worktree.localhost:3781and the backend on127.0.0.1:3786.127.0.0.1:55382, read directly for the row states.:59082logs every request, so DELETEs are visible.k1-task-release-lane-rows.tsandk2-bundle-intent-doors.ts, built from the bug(platform): replacing or deleting a product's image deletes bytes a task lists #4110/bug(platform): /files/reject-blob deletes the bytes of an upload a task already attached #4104 probese1andb1r.Limits
ownsUploadedBlob) but weren't called.listedBlobRefHeld's arms weren't audited.Recommendation: #4110 stays closed.