Skip to content

fix(platform): keep task attachment bytes alive and name a gone one - #4085

Merged
larryro merged 3 commits into
mainfrom
fix/task-attachment-blob-liveness
Oct 2, 2026
Merged

larryro merged 3 commits into
mainfrom
fix/task-attachment-blob-liveness

Conversation

@larryro

@larryro larryro commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What

A task attachment whose bytes left the object store made every run start fail with http_502 and a "Try again" hint, for ever, and three automatic retries burned on it. Clicking the attachment chip 404'd too. Three root causes, each fixed and locked with a regression test:

  1. The blob door collapsed the store's 404 into 502. /api/sandbox-blob now passes a missing object through as 404, so the in-sandbox daemon reports http_404 and the task host can tell "file gone" from "store down". Every other store failure stays 502.
  2. Staging treated every skipped input as an infra fault. partitionTaskInputSkips reads the skips: a gone attachment fails the start by the file's shown name as the new input_missing failure code (never auto-retried, steer restart included); the task shows The agent couldn't finish this task with "An attachment on this task is no longer in storage" (en/de/fr, plus the bell/e-mail body); a gone earlier deliverable leaves the brief instead of failing the run; any other skip keeps the generic, listed failure.
  3. No blob-liveness check knew that tasks hold blob refs. app.tasks.attachments / outputs list refs with no file row of their own, so deleting the file row (files API, trash purge, a chat thread's file row sharing the ref) deleted the task's bytes. One predicate, domains/tasks/blob-holders.ts#taskHoldsBlobRef, now sits in the knowledge release seam (assessRefLiveness blobLive), deleteFile, both abandoned-upload sweep statements and the task door's own release in retire.ts, which held the only copy before.

Docs: the task-automation "When the agent can't finish" table gains the row (EN/DE/FR). Manual layer: one automation.md row naming the owning suites.

Proof

Gate Result
@tale/platform server vitest, touched areas 175 files / 2179 tests
tests/guards 14 files / 155 tests
component test (task-agent-run-failure-notice), @tale/docs test (222), tsc, oxlint, oxfmt, lint:manual, lint:links green
backend:integration full run on a throwaway Postgres + MinIO 1322/1322 checks, 215/215 lanes

Real Postgres caught what the unit doubles could not: the predicate's parameter form failed with could not determine data type of parameter (jsonb_build_object takes "any"); the fragment casts ::text, and the file-delete lane plus the two new lanes pass.

Out of scope

  • A "file missing" state on the attachment chip; the failure notice and the run's Details name the file.
  • User erasure still deletes the subject's uploads even where a task lists them (legal lane, unchanged).

Recovery for an affected task: remove the attachments, upload them again, Start.

A task attachment whose bytes left the object store made every run start
fail with `http_502` and a "Try again" hint, for ever, and three automatic
retries burned on it. Three root causes:

- `/api/sandbox-blob` collapsed the store's 404 into 502, so the daemon could
  not tell "file gone" from "store down". A missing object now answers 404.
- `stageTaskInputs` treated every skipped file as an infra fault. A gone
  attachment now fails the start by the file's shown name as `input_missing`
  (never auto-retried, steer restart included) and the task reads "An
  attachment on this task is no longer in storage"; a gone earlier deliverable
  leaves the brief instead of failing the run; every other skip stays the
  generic, listed failure.
- No blob-liveness check knew `app.tasks.attachments` / `outputs` hold blob
  refs, so deleting the file row deleted the task's bytes. One predicate,
  `tasks/blob-holders.ts#taskHoldsBlobRef`, now sits in the knowledge release
  seam, `deleteFile`, the abandoned-upload sweep and the task door's own
  release, which held the only copy before.

Locales en/de/fr, unit tests per seam, and two real-Postgres/MinIO lanes:
`checkSandboxBlobDoor` asks a signed never-written key for its 404, and
`checkTaskHeldBlobOutlivesFileRow` deletes a file row under a task, finds the
bytes kept, and sees the release queued once the task lets go.
The task-automation page's table of final failures gains the row for an
attachment that is no longer in storage: whoever can change the task removes
it or uploads it again, Details names the file. EN, DE and FR.
One automation.md row for the 404 pass-through, the `input_missing` start
failure, the dropped deliverable and the task-held blob liveness, naming the
unit suites and the two `backend:integration` lanes that own them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant