Repository navigation
Open
Labels
Description
These are follow-ups from agent #2's independent post-merge review of #4157 (record 5974610832). #4157 merged at 8a88ffd10 (squash of 089fe9426) after root's acceptance (5973250800). The reviewer re-verified both MEDIUMs in the merged source, and its real-Postgres lane run (with moto S3) at the head passed the #4111 checks. The fleet manager (TALE-357) filed this so the follow-ups are tracked in one place.
MEDIUM 1: bytes kept for a mail or chat holder are never reconsidered when that holder ends, so they stay in the store forever
- What happens:
deleteFiledeletes the row, sees the ref held, and returns (domains/files/service.ts:690-697). Nothing records that these bytes now have no row. - How a holder ends without a release:
- a mail is sent, undone or discarded (
send.ts:1177,:835,:1061); - an API source is removed (
api-sync.ts:464); - a conversation is deleted: its release lists only conversation-bound file rows, not
metadata.attachments(message-corpus.ts:62-128); - a chat thread is purged (
retention/service.ts:1088,1171).
- a mail is sent, undone or discarded (
- Nothing reclaims them later: the intent was consumed at registration, the sweep drops consumed intents, and there is no bucket reconcile. Tasks already have this closure (
tasks/retire.ts:177-200queues a release when a task drops a ref); mail and chat don't. - Scenario: reply with file F, delete F during the undo window (the bytes correctly stay), and the reply sends. F's bytes now have no row, no holder and no intent, permanently. The same happens to a chat-attached file deleted before its thread is purged. An explicit delete by the user then never removes the bytes, which matters for privacy and retention.
- Why the tests miss it: the lane checks
keptonly while the holder lives, and the sent control turnssentbefore the delete. - Fix direction (from the review): when a holder ends, after commit, run
deleteUnheldOrgBlobRefson the refs it listed. Don't use the release seam, which treats a trashed, still-restorable row as dead. Decide whether undo, which hands the refs back to the composer, is excluded.
MEDIUM 2 (privacy and compliance; needs an owner decision): any reader can keep a file's bytes alive past its owner's delete, a document's purge or a retention destruction
- Why: the chat door admits any readable, non-trashed file row, including document-bound ones (
domains/chat/shim.ts:540-575). The chat arm holds anyusermessage's ref, with no ownership or thread-status condition (files/blob-holders.ts:99-112). The mail and task doors, by contrast, require the sender's own upload. - Scenario:
- A reader of document D posts a chat turn with D's ref attached.
- Retention destroys D. The release seam (
liveness.ts:121, which now includes the listed holders) keeps the bytes while the rows are deleted, and a destruction is recorded (retention/service.ts:1047-1061). - The reader's turns keep replaying the image.
- Once that chat is purged, the bytes are orphaned (MEDIUM 1).
- Before fix(platform): keep bytes a pending mail or a chat message lists #4157, the purge deleted those bytes.
- Fix options: have the chat arm hold only the author's own or thread-bound uploads, or let destruction lanes override the listed holders. Choosing between them is a retention-policy decision for root.
LOW
sweepUploadIntentsstatement 2 has no LIMIT. On every upload it evaluatesintentBlobHeld, which now includes the chat scan, for every expired backlog row (upload-intents.ts:317-323,files/routes.ts:150). With a store that refuses deletes, the backlog grows, and so does the cost of every mint. The docstring "pay this once per ref" (blob-holders.ts:87-88) is inaccurate.
INFO
- Email path: the in-transaction proof runs under READ COMMITTED (
send.ts:212). Two sends by one user that name the same files in opposite order can deadlock on intent rows, becausefirstForeignUploaditerates in client order. The result is a 500 with no retry; sorting the refs avoids it. - Failed mail: a
failedmail holds its bytes until it is retried or discarded. This is by design.
Acceptance
- MEDIUM 1: when a mail or chat holder ends, bytes left with no row, holder or intent are reclaimed. Test this with a real-Postgres lane: delete during the undo window, then send, purge, delete the conversation and remove the API source.
- MEDIUM 2: carry out root's retention decision, with a lane that shows a destruction or owner delete is honoured, or the chosen exception is documented.
- The LOW and INFO items: each is fixed or recorded as a decision.
- An independent review by a distinct agent.
Activity
fix(platform): bound upload-intent sweeps and order ownership locks
tale-review-bot commentedon Nov 2, 2026
Waits for a person: a maintainer of
tale-project/taleconfirms that the agents are to work what #4208 still asks, its MEDIUM 1 and MEDIUM 2.What happened.
bugandservice: platform. It carried noagent-readyfor four weeks.tale-review-botaddedagent-ready, according to the issue's timeline. The Lead and the Reviewer share that account, so the label is not a maintainer's. No run of the Lead's was active at that time.8e6b739a2bb9ca7bb6628ef0ed6eb3ac7a3e4039totrain: "fix(platform): bound upload-intent sweeps and order ownership locks",Refs #4208. It covers the LOW item (a limit on the sweep) and the INFO deadlock (the refs are now sorted).Why it waits.
agent-readyis the maintainers' first decision. An agent's account applies it only to parts split off an issue that already carries it, and Follow-ups from the #4157 review: bytes kept for a mail or chat holder are orphaned when it ends, and a chat attachment can outlive a retention destruction #4208 is no such part. The Lead decided the same way on TALE-372 (tale#5280).domains/files/blob-holders.tsandupload-intents.ts.The one act.
agent-readyapplied again from the maintainer's own account.Decided now, so nothing else waits.
bug. Line: stable, because it corrects whatmainships;8e6b739a2went totrainas well. Priority p1. The kept bytes stay reachable only to people who could already read the file, so nothing new is exposed. But a deletion or a recorded destruction must remove them.firstForeignUpload, for example atservices/platform/backend/domains/conversations/api-sync.ts:420.mainatf8eb4613f7c525a52d55d21548d4a4cda44a9bfe,listedBlobRefHeldinservices/platform/backend/domains/files/blob-holders.tsholds the attachment of anyrole = 'user'message, with no condition on who uploaded it.spec.mdstates the holding rule.Closes #4208, since8e6b739a2covers the LOW and INFO items.What happens after. The Lead's next run moves TALE-427 to To do with all of the above.
Triage keeps TALE-427 in Backlog until a maintainer has done the act above.
fix(platform): bound upload-intent sweeps and order ownership locks
yannickmonney commentedon Nov 3, 2026
The LOW and INFO items from #4238 and #4270 are on the stable
trainas "fix(platform): bound upload-intent sweeps and order ownership locks" (24286d63c; it reachesmainwith the next train pull request): the boundedsweepUploadIntentsbacklog and the sorted refs infirstForeignUpload, with two real-Postgres checks in thereject-bloblane that fail without the fix.Still open here: the MEDIUM items, that is bytes kept for a mail or chat holder are never reclaimed, and any reader can keep bytes alive past an owner's delete. Both drafts are closed and their branches deleted; the heads stay at
refs/pull/4238/head(372353a61) andrefs/pull/4270/head(d24091c79). The second item needs a retention-policy decision before anyone builds it, and the last native proof of the first was 53 of 58 cases with five stale-fixture failures (diagnosed 2026-10-05, never repaired).tale-review-bot commentedon Nov 3, 2026
Waits for a person: a maintainer of
tale-project/taleconfirms that the agents are to work MEDIUM 1 and MEDIUM 2 of #4208, or says that a maintainer will do them.What changed. yannickmonney commented on Follow-ups from the #4157 review: bytes kept for a mail or chat holder are orphaned when it ends, and a chat attachment can outlive a retention destruction #4208 at 09:19:54 UTC today (comment). The comment says where the issue stands, but not who works its two MEDIUM items, so the act below is still open. Its facts, checked:
trainas24286d63c38a72cefb4c3420043bf68ca218005f, which replaces the8e6b739a2named in the Lead's last comment.trainwas 4 commits ahead of it, and 0 behind, at 10:12 UTC (GitHub's compare API). It reachesmainwith the next train pull request.refs/pull/4238/head(372353a61, "persist holder retirement and chat custody") andrefs/pull/4270/head(d24091c79, "retire unheld chat and mail blobs").The retention rule for MEDIUM 2 is decided. The comment says that this item needs a retention-policy decision before anyone builds it. The Lead made that decision on 2026-11-02 (comment):
The one act, unchanged.
agent-readyapplied again from the maintainer's own account. Theagent-readythe issue carries now was added bytale-review-botat 17:57:08 UTC on 2026-11-02, the account the Lead and the Reviewer share, so it is no maintainer's decision.What happens after. The Lead's next run moves TALE-427 to To do: kind
bug, Line: stable, priority p1, done as the Lead's last comment says. The two draft heads and the five stale fixtures are the Coder's starting points. The squash message ends withCloses #4208.Triage keeps TALE-427 in Backlog until a maintainer has done the act above.
fix(platform): bound upload-intent sweeps and order ownership locks
yannickmonney commentedon Nov 14, 2026
Decision
Rule. A chat message does not keep a file's content alive. Content stays only while one of these still uses it:
An owner's delete, a document or trash purge, and every retention destruction remove the content, even when an earlier chat turn lists it. The turn then shows the attachment as removed, and the assistant is told the file is unavailable. When a mail holder ends, a durable job reclaims the content it listed, judged by the same rule plus an explicit open-upload check. A failure fails the job, so it is retried.
Answers.
listedBlobRefHeld. This replaces both options in the issue.files.reclaim_unheldjob in the same transaction. The ends are a send or delivery, an undo, a discard, an API source removal, and a conversation delete, which must also collect the refs inmetadata.attachments. The job judges withblobRefHeldplus an explicit open-intent check, never the release seam. It deletes through a strict helper, because the existingdeleteUnheldOrgBlobRefsswallows check and store failures. Undo is included.Rationale. The chat door admits only refs with a live file row. So the chat arm only matters after that row is deleted on purpose, and each time it made the deletion or the recorded destruction false. The narrower rule still fails the most common case: user temp-file retention destroys exactly the files people upload in chat. Replay already handles a missing image, so dropping the arm costs only a visible placeholder. The reclaim needs a strict helper and an explicit intent check.
deleteUnheldOrgBlobRefsnever reports a failure, andblobRefHelddoes not look at upload intents.Units.
Closes #4208. (S, after 1 and 3)Cross-issue amendments (decisions taken together with #5303, #5298, #5303):