From f2b6e380398de74f4b4f5c9fa0f368d4a3e569f8 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Mon, 2 Nov 2026 18:43:40 +0000 Subject: [PATCH 1/9] CONTRACT: feat(ui-server): admit generic composer files as durable server-owned originals (#3153) Add the neutral composer-upload route POST /api/drafts/:draftId/files. It streams one file into .brain-ui/attachments//, routes on the stored bytes (signature, strict UTF-8, then the shared track parser) and reserves room in a configurable host attachment pool (BRAIN_UI_ATTACHMENT_POOL_BYTES, default 1 GiB). It creates no inbox, queue or triage work. Drafts bind originals by fileIds, and a held send's files by one outgoing snapshot, in the operational database. Both survive a reload and a restart. chat_message.attachmentRefs sends them: the host resolves each against its own records and verifies the bytes on disk before any backend runs. It gives the agent read-only paths in a quoted block and never injects the contents. Acceptance writes the conversation's reference before it consumes the draft revision. GET /api/attachments/:fileId reads an original back after a digest check. Cleanup removes never-bound uploads after an hour. Formerly referenced originals go seven days after their last reference. Deletion is two-phase (mark, then unlink) and reconciled at boot. Governed workers mount the store read-only, and reads taint the session as chat_attachment. Additive contract change; documentation, decision records and a minor changeset are in this commit. Refs #3153 Co-Authored-By: Claude Opus 5.5 --- .changeset/composer-file-attachments.md | 5 + docs/decisions/chat-attachments.md | 59 ++- .../design-kit/sessions-and-drafts.md | 13 +- docs/decisions/governed-writable-workers.md | 20 +- docs/http-api.md | 83 ++++- docs/integration-contract.md | 16 + docs/integration-contract/package-api.md | 16 + docs/integration-contract/wire.md | 72 +++- docs/plans/chat-attachments.md | 22 +- docs/supported-inputs.md | 2 +- packages/ui-sdk/src/protocol.ts | 145 +++++++- packages/ui-sdk/src/schemas.ts | 26 +- .../ui-sdk/src/server/worker-protection.ts | 15 +- packages/ui-sdk/src/track-schemas.ts | 15 + packages/ui-server/README.md | 1 + .../migrations/075_chat_attachments.sql | 67 ++++ .../ui-server/src/activity/ingestion-taint.ts | 8 +- packages/ui-server/src/app.ts | 25 +- packages/ui-server/src/attachments/context.ts | 52 +++ packages/ui-server/src/attachments/detect.ts | 92 +++++ packages/ui-server/src/attachments/files.ts | 125 +++++++ packages/ui-server/src/attachments/resolve.ts | 52 +++ packages/ui-server/src/attachments/routes.ts | 218 +++++++++++ packages/ui-server/src/attachments/store.ts | 212 +++++++++++ packages/ui-server/src/attachments/sweep.ts | 64 ++++ packages/ui-server/src/attachments/track.ts | 27 ++ packages/ui-server/src/config/env.ts | 12 +- packages/ui-server/src/drafts/store.ts | 337 +++++++++++++++++- packages/ui-server/src/drafts/writes.ts | 25 +- packages/ui-server/src/governance/events.ts | 2 +- packages/ui-server/src/routes/drafts.ts | 25 +- packages/ui-server/src/routes/tracks.ts | 14 +- packages/ui-server/src/ws/bridge.ts | 6 +- packages/ui-server/src/ws/connection.ts | 6 +- packages/ui-server/src/ws/dispatch.ts | 32 +- packages/ui-server/src/ws/drafts.ts | 3 +- packages/ui-server/src/ws/handoff.ts | 2 +- packages/ui-server/src/ws/host.ts | 10 + packages/ui-server/src/ws/message-sources.ts | 45 ++- packages/ui-server/src/ws/run-session.ts | 23 +- .../src/ws/session-catalog-writes.ts | 2 +- packages/ui-server/src/ws/session-catalog.ts | 2 +- packages/ui-server/src/ws/turns.ts | 9 +- .../ui-server/tests/attachment-detect.test.ts | 48 +++ .../tests/attachment-ownership.test.ts | 251 +++++++++++++ .../ui-server/tests/attachment-routes.test.ts | 147 ++++++++ .../ui-server/tests/attachment-sweep.test.ts | 160 +++++++++ .../tests/helpers/attachment-fixture.ts | 33 ++ 48 files changed, 2537 insertions(+), 109 deletions(-) create mode 100644 .changeset/composer-file-attachments.md create mode 100644 packages/ui-server/migrations/075_chat_attachments.sql create mode 100644 packages/ui-server/src/attachments/context.ts create mode 100644 packages/ui-server/src/attachments/detect.ts create mode 100644 packages/ui-server/src/attachments/files.ts create mode 100644 packages/ui-server/src/attachments/resolve.ts create mode 100644 packages/ui-server/src/attachments/routes.ts create mode 100644 packages/ui-server/src/attachments/store.ts create mode 100644 packages/ui-server/src/attachments/sweep.ts create mode 100644 packages/ui-server/src/attachments/track.ts create mode 100644 packages/ui-server/tests/attachment-detect.test.ts create mode 100644 packages/ui-server/tests/attachment-ownership.test.ts create mode 100644 packages/ui-server/tests/attachment-routes.test.ts create mode 100644 packages/ui-server/tests/attachment-sweep.test.ts create mode 100644 packages/ui-server/tests/helpers/attachment-fixture.ts diff --git a/.changeset/composer-file-attachments.md b/.changeset/composer-file-attachments.md new file mode 100644 index 0000000000..b301e3fba3 --- /dev/null +++ b/.changeset/composer-file-attachments.md @@ -0,0 +1,5 @@ +--- +"@schlessera/brain-ui-sdk": minor +"@schlessera/brain-ui-server": minor +--- +Store any file attached in the composer as a real, read-only original the agent can open (#3153). `POST /api/drafts/:draftId/files` streams one file into `.brain-ui/attachments//`, detects its kind from the bytes and reserves room in a configurable host attachment pool (`BRAIN_UI_ATTACHMENT_POOL_BYTES`, default 1 GiB). It creates no inbox work. Drafts bind originals with `fileIds` and keep a held send's files in an `outgoing` snapshot, and both survive a restart. `chat_message.attachmentRefs` sends them: the host verifies each against its records and its bytes on disk, and gives the agent its read-only path in a `` block without reading the contents. Accepting the message transfers the originals to the conversation. `GET /api/attachments/:fileId` reads one back after a digest check. Unbound uploads are removed after an hour and formerly referenced ones seven days after their last reference went, with race-safe cleanup. `server_hello` advertises `capabilities.composerFiles` and `attachmentLimits`; `SessionDraftLimits` gains the per-draft file envelope (10 files, 25 MB each, 50 MB together), and `maxDraftBytes` now bounds text and legacy images only. Governed workers see the originals read-only, and reading them taints the session as `chat_attachment`. diff --git a/docs/decisions/chat-attachments.md b/docs/decisions/chat-attachments.md index bc89a7baff..c9884e6309 100644 --- a/docs/decisions/chat-attachments.md +++ b/docs/decisions/chat-attachments.md @@ -1,12 +1,12 @@ # Generic chat attachments -**Decided by the maintainer on 2026-10-29 and 2026-11-02**, before runtime -implementation. The rulings are linked in each section below. This record -holds approved policy only. Nothing in it is implemented yet. The -[source-backed design](../plans/chat-attachments.md) turns the rulings into -routes, schemas, bounds and proof briefs. Its numbered recommendations are not -rulings until they are confirmed at review. Open work is epic #3150 in the -tracker. +**Decided by the maintainer on 2026-10-29 and 2026-11-02.** The rulings are +linked in each section below. The +[source-backed design](../plans/chat-attachments.md) turns them into routes, +schemas, bounds and proof briefs; its six §13 recommendations were approved +at review on 2026-11-02. Admission, storage, ownership and cleanup are built +([what #3153 built](#what-3153-built)); content reading and the composer are +open work in epic #3150. ## Sources and one pipeline @@ -104,6 +104,51 @@ and [desktop menu A](https://github.com/schlessera/brain-kit/issues/3155#issueco and reduced motion gets static glyphs. #3281 owns the shared component ([ruling](https://github.com/schlessera/brain-kit/issues/3155#issuecomment-6575242784)). +## What #3153 built + +The server side of admission, storage, ownership and cleanup, as the design's +§4 and §6 describe, with these concrete choices: + +- **Records and transactions.** The `attachment_files`, `attachment_refs`, + `attachment_reservations` and `attachment_receipts` tables sit in the + operational database beside the drafts, and every mutation runs on the + draft store's write channel. A save, an acceptance and a sweep mark + therefore see one serialized state. Reference owners are `draft` and + `outgoing` (both keyed by the draft id; a draft has at most one outgoing + snapshot) and `message` (keyed by the session id). The design's compound + owner ids were simplified this way because a draft id may itself contain + `:`, and one reference per session protects a file as well as one per turn. +- **References on the wire.** A message names its originals in a new optional + `chat_message.attachmentRefs` field, not as a new variant of the existing + `files` union the design sketched. Adding a variant would retype + `ChatFileAttachment[]` for TypeScript readers, which the contract counts as + breaking. The separate field is additive and carries the same reference. +- **What the provider sees.** The `` block says the + contents have not been read and that the agent may open an original at its + path. It does not name `read_attachment`, because that tool belongs to + #3154 and is not registered yet. Once it is, new messages may name it; + recorded messages keep the text they were sent with. +- **Accounting.** The pool charges recorded originals in every state, + reservations and legacy draft image BLOBs. A save charges the draft + sub-limit only for originals no live draft or snapshot already references. + A reservation is the declared `Content-Length`, or 25,000,000 bytes without + one, and the commit replaces it with the real size in the same transaction + that re-checks the pool. +- **Cleanup safety.** The sweep's mark re-selects by clock and requires no + reference; a reference insert requires `stored` in its own transaction. + Rebinding also clears the clock, so two independent guards keep a rebound + file. The mutation proof in the PR breaks each. +- **Governed read-only mount.** `.brain-ui/attachments/` is mounted read-only + for governed workers through the same resolver that mounts protected paths, + but it is not a protected path: no policy names it, the turn manifest does + not list it, and nothing is quarantined when the host writes it during a + turn. The ordinary profile relies on the digest check alone. +- **Session deletion.** The store's `releaseSession` removes a chat's + `message` references and starts their seven-day clocks. Calling it from chat + deletion belongs to #3231's flow. +- **Kept as before.** `/share`, `/track-upload`, staged-track references, + inline images and D52's tab-only legacy track path behave as they did. + ## Rejected alternatives The rejected options were offered in the rulings above: diff --git a/docs/decisions/design-kit/sessions-and-drafts.md b/docs/decisions/design-kit/sessions-and-drafts.md index fcb0ecc3f4..09aa44a086 100644 --- a/docs/decisions/design-kit/sessions-and-drafts.md +++ b/docs/decisions/design-kit/sessions-and-drafts.md @@ -341,7 +341,7 @@ event deletes the whole set. Draft content never enters this record (§5). null, no time is printed. - **`lastActiveAt` and `lastTouched` are never read.** A newer `lastActiveAt` can mean that a new turn started - (`export interface ChatSession`, `packages/ui-sdk/src/protocol.ts:1576-1606`), + (`export interface ChatSession`, `packages/ui-sdk/src/protocol.ts:1634-1664`), and `lastTouched` is LRU bookkeeping for buffer eviction. **Merging snapshots and live frames.** @@ -644,7 +644,7 @@ question-answer rules are independent. > **2026-11-02 — Generic attachment originals, maintainer amendment (#3150).** -> Approved, not yet implemented. For the new generic composer path, staged +> Approved; the host side is implemented by #3153. For the new generic composer path, staged > files stop being tab-only. Every attachment, images included, is a > filesystem original owned by the exact acknowledged draft revision, then by > the conversation that accepted the send. A saved draft and its file bindings @@ -659,7 +659,14 @@ question-answer rules are independent. > this record is unchanged. The rulings are in > [chat-attachments.md](../chat-attachments.md), and the proposed schema and > lifecycle in [the design](../../plans/chat-attachments.md#6-admission-storage-and-ownership-3153). -> The implementation records what it built here. +> #3153 built it this way: a save's `fileIds` bind originals to that exact +> revision and its `outgoing` snapshot owns a held or unconfirmed send's +> files, both in the host's operational database, so they survive a reload, +> a closed tab and a restart. `Draft.files` lists only bound files that are +> still stored, so nothing restores as saved that the host does not hold. An +> accepted send gives the conversation its own reference before the revision +> is consumed; newer revisions and other drafts are untouched. Nothing is +> resent automatically. The composer that uses this is #3155's. > **2026-10-07 — Drafts kept on this device across a reload, implemented by > #1014.** Every draft in the root's store, with its images, and the work diff --git a/docs/decisions/governed-writable-workers.md b/docs/decisions/governed-writable-workers.md index 80076ee763..c0820a09e8 100644 --- a/docs/decisions/governed-writable-workers.md +++ b/docs/decisions/governed-writable-workers.md @@ -176,7 +176,7 @@ still holds. **Voice.** Ruling 1 makes voice `governed` too. Voice keeps its narrower membership (`VOICE_ALLOWED_TOOLS`, `packages/ui-backend-claude/src/tool-policy.ts:120`): no Bash, no raw `Write`/`Edit`, no archive, and approval returns false -(`const apply = createBrainApplication`, `packages/ui-server/src/ws/bridge.ts:666-671`). +(`const apply = createBrainApplication`, `packages/ui-server/src/ws/bridge.ts:668-673`). A voice turn therefore writes only through curated capture and update, now with a journal behind it. The writable mount gives voice no tool it lacked. Pi still refuses voice turns. @@ -641,7 +641,11 @@ makes in the brain. - **`CLAUDE.md`, `AGENTS.md`, `.claude/skills/`, `.agents/`.** Changing them as you go is exactly the flexibility ruling 1 restores. The journal records those changes and can revert them. -- **`.brain-ui/`.** Agents file staged shares from it. +- **`.brain-ui/`.** Agents file staged shares from it. One subtree is + mounted read-only in the governed profile without becoming a protected + path: `.brain-ui/attachments/`, where the host keeps chat attachment + originals (#3153). No policy names it, and the host keeps writing it during + a turn without a quarantine. ### How the mounts enforce it @@ -1405,7 +1409,7 @@ from worker transcripts, and no extension of the observed-shell guarantee. **Where the next request waited.** The bridge never awaits an observation: it starts one per result and carries on -(`void host.journal?.toolEnded`, `packages/ui-server/src/ws/bridge.ts:226`). +(`void host.journal?.toolEnded`, `packages/ui-server/src/ws/bridge.ts:227`). The wait is the observation's hold. `held` takes it synchronously, before it queues the capture (`function held`, `packages/ui-server/src/brain/turn-journal.ts:232-253`), @@ -1520,7 +1524,7 @@ unmet rather than relaxed. **Why.** Every governed turn queues an automatic index refresh after it (`host.governedTurns?.refresh(host.workerLock)`, -`packages/ui-server/src/ws/run-session.ts:934`). The refresh usually finishes +`packages/ui-server/src/ws/run-session.ts:938`). The refresh usually finishes while the next turn runs, so that turn's finish observation found a rewritten `brain.db` and copied a whole new version of it into retained objects, inside the observation's worker hold. #2831 measured 36 versions of a ~120 MB index in @@ -2431,9 +2435,9 @@ coordinator. The server checks the handle's mount ID against the worker's own mount table: it must be the top mount at the brain path. It then runs the unchanged comparison of brain, pins, empty masks and the private index relative to the handle (`function requireWorkerBrainMount`, -`packages/ui-sdk/src/server/worker-protection.ts:344-351`; +`packages/ui-sdk/src/server/worker-protection.ts:353-360`; `export function verifyWorkerFolderMounts`, -`packages/ui-sdk/src/server/worker-protection.ts:354-392`). +`packages/ui-sdk/src/server/worker-protection.ts:363-401`). The server returns the handle before release, and the coordinator refuses to release the start gate, or open a second view, while one is held (`if operation == 'release':`, @@ -3020,7 +3024,7 @@ that runs in it can rewrite that account. The load set is therefore not computed. It is enforced by what the worker can see: the brain path is an empty tmpfs with only the policy's protected paths bound back read-only (`WorkerProviderMasks.visible`; `if (masks.visible)`, -`packages/ui-sdk/src/server/worker-protection.ts:207-227`). An import, a +`packages/ui-sdk/src/server/worker-protection.ts:216-236`). An import, a local module, a `tsconfig.json` alias or a data file outside them is simply absent, so the configuration loads only from what no governed turn can change, or does not load, and its own error, which names the file, becomes @@ -3792,7 +3796,7 @@ document reader whose normalized path is under `.brain-ui/inbox/` or outside the brain and the strict area root counts any such segment); a fetching or unclassified Bash call; and any MCP tool whose server is not brain-kit's own `brain` or `brain-ui` -(`inputTaintSource`, `packages/ui-server/src/activity/ingestion-taint.ts:51-61`). +(`inputTaintSource`, `packages/ui-server/src/activity/ingestion-taint.ts:53-63`). The fixed list of external-content MCP sources is therefore "every other MCP server", following the rule above that erring towards taint costs only tighter rules (maintainer ruling, 2026-10-22). The first source is the session's one diff --git a/docs/http-api.md b/docs/http-api.md index 2a5decfa32..48d2485758 100644 --- a/docs/http-api.md +++ b/docs/http-api.md @@ -1004,6 +1004,87 @@ each with `limit` and `bound`; 428 `DRAFT_PRECONDITION_REQUIRED` when `Content-Length` says. A refused or failed request leaves the committed draft unchanged. + + +## Composer file attachments (additive, 0.45.0, #3153) + +Advertised by `server_hello.capabilities.composerFiles`; the frame rules are +in the [integration contract](integration-contract/wire.md#composer-file-attachments-additive-0450-3153). +Both routes sit behind the same authentication and same-origin rules as the +draft routes, and answer `Cache-Control: no-store`. The upload creates no +inbox item, queue job or triage. `/share` and `/track-upload` are unchanged. + +### `POST /api/drafts/:draftId/files` + +The raw bytes of one file, streamed; nothing is buffered whole. Headers: +`Idempotency-Key` (required, 1-128 of `A-Za-z0-9._:-`), `Content-Type` (a +hint), `X-File-Name` (a hint, percent-encoded UTF-8, at most 1,024 bytes +encoded) and `Content-Length` (optional, used for early refusal and as the +pool reservation; without it the reservation is 25,000,000 bytes). + +The host reserves pool room, streams the bytes to a partial directory while +counting and hashing them, detects the kind from the stored bytes and +publishes the file read-only at `.brain-ui/attachments//` by one +atomic rename. Detection is by signature first (`%PDF-`; JPEG, PNG, GIF, +WebP; HEIC/HEIF; ZIP, gzip, 7z, RAR), then strict UTF-8 text, then the shared +track parser for text up to 20 MiB. Anything else is `binary`. A name or MIME +type is only a hint: it never makes a file a track or a PDF. +`trackRejected: true` says a track hint did not parse. Upload never claims the +contents were read. + +`201` returns an `AttachmentFile`. Repeating a key with the same draft, name +hint, media hint and bytes returns `200` with the same file, without storing a +second copy. + +| Status | `error` | `bound` / meaning | +| --- | --- | --- | +| 413 | `ATTACHMENT_TOO_LARGE` | `file` (25,000,000), `draftFiles` (50,000,000), `draftCount` (10) | +| 507 | `ATTACHMENT_CAPACITY` | `pool` (the configured `BRAIN_UI_ATTACHMENT_POOL_BYTES`) | +| 410 | `DRAFT_DELETED` | the draft was deleted or sent | +| 400 | `ATTACHMENT_INVALID` | an empty file, a malformed header, or an `X-` header claiming authority, a path or a kind | +| 409 | `ATTACHMENT_KEY_REUSED` | the key named a different upload | +| 503 | `busy` | three composer uploads are already running; retry | + +`draftCount` and `draftFiles` count everything the draft's revision and +outgoing snapshot reference, plus uploads for the same draft that no save has +bound yet and that are under an hour old. The pool counts every recorded +original in any state, every live reservation and the legacy draft images. +Reservations are taken in one immediate transaction, so concurrent uploads +cannot multiply the cap. At capacity nothing is removed to make room. + +`PUT /api/drafts/:draftId` accepts `fileIds` (at most 10) and `outgoing` +(`{ requestId, text, fileIds, state: "held" | "dispatched" }`, `null` to +clear, absent to keep). A save binds exactly the listed files to the revision +and the snapshot's files to the snapshot. Each listed file must be `stored` +and minted for this draft, or the save is 400 `ATTACHMENT_INVALID`. At most +10 attachments are listed, legacy images included, and at most 50,000,000 +original bytes together (413 `DRAFT_TOO_LARGE`, `bound` `draftCount` or +`draftFiles`). The old `maxDraftBytes` ceiling bounds text and legacy images +only. `GET` returns `files` (only files still stored) and `outgoing`. + +### `GET /api/attachments/:fileId` + +Streams one original up to 25,000,000 bytes, after checking its recorded size +and SHA-256 through no link. Any live reference authorizes the read: a draft +revision, an outgoing snapshot or a sent message. Answers carry +`Content-Security-Policy: default-src 'none'`, `X-Content-Type-Options: +nosniff`, and `Content-Disposition: attachment` for every kind except an image +preview. `404 ATTACHMENT_NOT_FOUND` for an unknown, unreferenced or missing +file; `409 ATTACHMENT_CHANGED` when the bytes no longer match, with none of +them served. The raw file route keeps its 10,485,760-byte cap. + +### Lifetime + +An upload no save or message ever bound is removed an hour after upload. An +original that was referenced is removed seven days after its last reference +went; rebinding cancels that. A sweep runs at boot and every ten minutes. It +marks eligible files in one transaction and only then unlinks them, so a +rebind that loses the race is refused rather than binding a deleted file. At +boot, reservations and partial uploads of an earlier process are discarded, a +record whose directory is gone becomes `missing`, and a directory with no +record is adopted, charged, with a fresh seven days. Clocks are the server's +stored wall clock, never file times. + ## Session recovery (additive, #964) **GET /api/sessions/:id/recovery** is protected and read-only: it never @@ -1244,7 +1325,7 @@ read by any authenticated principal. | `strict_fallback` | 1 | `path`, `reason` | A turn ran under `strict` instead of `governed` because a protected path is a `symlink`, a `hardlink` or a `mount_point`. | | `revert_conflict` | 1 | `conflicts`, `restored` | A revert skipped paths that changed after the reverted turn. Each conflict is `{ path, state }`, with `state` one of `changed`, `deleted`, `created` or `type_changed`; `restored` counts the paths it did restore. | | `outward_action` | 1 | `tool`, `input`, `inputTruncated`, `action`, `target`, `historyRewrite`, `tainted`, `decision`, `rule` | An action outside the brain in the user's name, allowed or not. `action` is `git_push`, `gh_write`, `mcp_tool`, `http_write` or `outward_host_connect`; `decision` is `policy_allowed`, `approved`, `declined` or `refused`; `rule` is the matching `outward.allow` rule or `null`. | -| `taint` | 1 | `source`, `tool`, `detail` | The untrusted input that tainted the session. `source` is `web_fetch`, `web_search`, `staged_share`, `workspace_read`, `mcp_document`, `user_marked`, `egress_connection`, `fetching_command` or `unclassified_command`. | +| `taint` | 1 | `source`, `tool`, `detail` | The untrusted input that tainted the session. `source` is `web_fetch`, `web_search`, `staged_share`, `chat_attachment`, `workspace_read`, `mcp_document`, `user_marked`, `egress_connection`, `fetching_command` or `unclassified_command`. | | `provider_unavailable` | 1 | `provider`, `capability`, `command`, `degradedTo` | A worker command needed a provider whose key the host withheld from the worker. Recorded from the token the CLI prints ([CLI contract](integration-contract/cli.md#withheld-provider-keys-additive-0440-1666)), one event per distinct token in a tool result and at most 20 per turn. `capability` is `embeddings`, `completions`, `reranking` or `image`; `command` is the shell command, or the tool's name for any other tool; `degradedTo` names the fallback used (`keyword_search`, `keyword_index`, `lifecycle_order`) or is `null`. The token is text in tool output, so the event is a diagnostic, not proof. | | `resource_limit` | 1 | `limits`, `fatal` | A worker hit a resource limit. Each limit is `{ limit, source, value, events }`: `limit` is `processes`, `memory`, `pids`, `file_size`, `data`, `cpu` or `open_files`; `source` is `rlimit` or `cgroup`; `value` is the configured limit; `events` counts the hits the source reported, or is `null`. `fatal` says whether the worker died of it. | | `roadblock` | 1 | `category`, `family`, `signature`, `failures`, `resolution`, `remedy`, `waste`, `eventIds` | One classified roadblock episode, written when its turn ends ([classification](decisions/governed-writable-workers.md#roadblocks)). An episode opens at a failed step and closes at the next successful call of the same `family`, or at turn end. `family` is the tool family: `shell:` (with the subcommand for multi-command programs, such as `shell:git push`), `file_write`, `file_read`, `search`, `web`, `brain_write`, `subagent`, `mcp::` or `tool:`; a governance event with no call has `budget`, `scope`, `network`, `policy` or `outward`. `category` is `tool_error`, `shell_nonzero`, `fs_denied`, `permission_denied`, `policy_block`, `budget`, `scope_cap`, `network_refused` or `retry`. It is `retry` when the episode repeated a near-identical failed input, and otherwise the first failure's category. `signature` is the grouping key `\|\| ` of the first failure, for example `file_write\|.brain/*\|fs_denied EROFS .brain/*`. The target is the command's program and, for multi-command programs, its subcommand (`