Repository navigation
Description
Context
On a hosted 0.44.0 install, two PDF shares filed in one evening both ended with the Queue item still open and the original still in staging, even though the filing was complete. Each turn copied the PDF byte-identically to assets/documents/<name>.pdf, added a <!-- share-source:<id> --> marker to the filed note, linked the PDF from that note, and then called complete_share. Every call was refused:
Retained binary must be linked by the filed document
The check is a literal substring match on ](<disposition.path>) (complete, packages/ui-server/src/inbox/interactive-share-writes.ts:216). The filed notes live in nested folders (for example travel/<trip>/accommodation.md), so a working Markdown link to the asset is document-relative: [Confirmation](../../assets/documents/x.pdf). That is also the convention the brain already uses: in the affected brain, 29 asset links are ../-relative, 1 is /-rooted and none is a root-relative ](assets/...) link outside vendored workspaces. The only link form the check accepts, ](assets/documents/x.pdf) written inside travel/<trip>/, is a broken link when rendered.
The agent tried, in order, an Obsidian-style [[x.pdf|label]] link, ](../../assets/documents/x.pdf), and ](/assets/documents/x.pdf) plus the bare path in backticks. All three were refused with the same message, which does not say what form is expected. The tool description (packages/ui-sdk/src/tool-contracts/inbox.ts:23) and the share skill (packages/core/skills/share/SKILL.md:133) only say "a link in the filed document".
A second refusal compounds it. After editing the note again to fix the link, passing both the original and the new receipt fails with Filed content no longer matches its authoritative receipt (interactive-share-writes.ts:196), because the earlier receipt's content hash is superseded by the agent's own later edit of the same file. The agent has to guess that only the newest receipt per path is valid.
Net effect for the user: "sharing a PDF into the brain" files the content but never completes, the inbox item stays open, and the staged original is never cleaned up. Both turns told the user to "finish the PDF retention from a writable terminal".
Every refused turn also uses up a Queue attempt, and after three the share can never complete. Each turn in a bound share session claims the share's Queue item with a 10-minute lease (start, packages/ui-server/src/inbox/interactive-share-writes.ts:66-75). Once the turn ends, lease recovery fails that attempt (recoverLeases, packages/ui-server/src/inbox/lifecycle-writes.ts:17-31, then failInboxWork, packages/ui-server/src/inbox/actions.ts:159-169). After maxAttempts (3), the item stays failed and a "Queued work exhausted its retries" action is raised. From then on, complete_share would need failed -> done, which assertInboxTransition forbids (packages/ui-server/src/inbox/state.ts:21). start refuses to re-claim a failed item (interactive-share-writes.ts:74), and the lifecycle sweep skips unfinished interactive shares (actions.ts:182). So a share whose first three turns were refused, for example by the link check above, cannot be completed by any later turn, even after the link is fixed. One of the two production shares reached that state. An operator had to move it failed -> ready before it could complete.
Scope
- Accept a retained-binary link that resolves to
disposition.pathfrom the linking document's own location: document-relative (../../assets/x.pdf), brain-root-absolute (/assets/x.pdf) and root-relative (assets/x.pdfin a root-level document). Resolve against the path in the receipt'schange.path, normalise, and compare todisposition.path. URL-encoded paths (spaces) must resolve too. - Decide whether a wikilink embed/link to the asset (
[[x.pdf]],![[x.pdf]]) counts; the brain's renderer and validator are the reference for what resolves. - When the check refuses, say what it looked for: the expected target path and that the link must resolve to it from the filed document.
- When several receipts for the same path are passed, validate against the newest one instead of refusing on the superseded one; or refuse with a message naming which receipt is stale and that only the latest per path is needed.
- Update the tool description and the share skill to state the accepted link forms.
- A turn of an interactive share that ends without completing must not use up the share's attempts. Alternatively, a
failedinteractive share must stay recoverable by its bound session. Either way, a share whose filing is fixed later can still complete.
Out of scope
- The share-source marker check (
interactive-share-writes.ts:202) and its semantics. - Discard dispositions and their approval.
- Moving the original instead of copying it; how the PDF reached
assets/is not in question here (byte equality already passes). - Generic attachment intake (Epic: attach any file and route its contents through available capabilities #3150).
Acceptance criteria
- A filing whose document at
a/b/note.mdlinks](../../assets/documents/x.pdf)completes, proven by a test that fails on current main withRetained binary must be linked by the filed document. - The same for
](/assets/documents/x.pdf)and for](assets/x.pdf)from a root-level document. - A link that resolves elsewhere (for example
](../assets/documents/x.pdf)froma/b/note.md) is still refused. - A link only inside a code span or fenced block does not count.
- Passing an older receipt for a path that a newer receipt also covers either completes using the newer receipt or refuses with a message naming the stale receipt; a test covers whichever behaviour is chosen.
- The refusal message names the expected target path.
- A share session whose first three turns end without completing can still complete on a fourth turn once its filing is valid. The test fails on current main with
Forbidden queue transition: failed -> done, or withShare is not ready for recovery. Moving the item back toreadyis not enough either: the claim then fails withInbox attempt limit reached(packages/ui-server/src/inbox/store.ts:709-710). - Tool description and
packages/core/skills/share/SKILL.mdstate the accepted link forms.
Verification
bun run test packages/ui-server/tests for the interactive share suite, plus a mutation receipt: revert the resolver to the substring check and watch the document-relative case fail.
Contract impact
Tool description text for complete_share changes (wording only, the input schema is unchanged). Accepting more link forms is additive.
Updated 2026-11-02: added attempt exhaustion, found when one of the two production shares stayed stuck after its link was fixed.
Activity
schlessera commentedon Nov 2, 2026
Claiming this (claim token
wi-3353-75de). Branch:fix/3353-retained-file-share-pathfromorigin/main@ 3984040. Collision report for the cited files: closure-only overlaps with open PRs (test-graph), no path collisions.schlessera commentedon Nov 2, 2026
Implementation is in draft PR #3376 (head
91bcca2d1, baseorigin/main@3984040f1). Every acceptance criterion is covered by tests that fail on main, and there are mutation receipts in the PR.check:pr --base origin/mainpasses. The PR and this issue are on milestone 0.45.0.It isn't confirmed yet because main is red (incident #3361, fix #3366 declared), and
integrate.tsrefuses ordinary confirmation while main is red. Once main is green, run this from a checkout of currentorigin/main:Hosted CI must also provide the provider-history guard and native-runtime receipts. This sandbox can't run them, and they fail the same way on untouched main.