Skip to content

Linked computers: an answer with files waits for a computer that is away - #4010

Merged
backnotprop merged 4 commits into
mainfrom
feat/far-reply-files-held
Nov 24, 2026
Merged

backnotprop merged 4 commits into
mainfrom
feat/far-reply-files-held

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

An agent on one computer that answers in a thread on a linked computer with send_message and attachments was refused while that computer was away ("files go to it only while it is online"). Words alone were held and delivered later. Now an answer with files waits the same way, and words and files arrive together when the other computer is back.

What changed

  • packages/server/inbox-outbox-files.ts (new): when the agent sends, each file (read by the existing attachment rules) is kept on this computer as one of the Inbox's own pending uploads, the same record a window's reply keeps before Send, naming its blob in inbox/blobs/. The held outbox entry names them (OutboxEntry.files). The outbox file never holds bytes. The agent's own files can change or go afterwards: what goes is what it sent.
  • Refused at once, with the words the other computer's uploads route uses: folders, dotenv files and unreadable files (attachment rules, as before), names that route refuses, and files over 100 MB (upload_too_large).
  • PeerLink.send: before posting agent-reply, the sender loop sends each file to the other computer's uploads route and saves each id there on the entry as it lands (sent_files). A retry (the line went down, or this Inbox crashed between the files and the answer) sends only what was not sent yet, and the answer goes once under the existing key. If the other computer forgot those ids (away more than a day after taking them), they are sent again once.
  • Kept: the store's blob sweep after a deletion already keeps pending uploads' blobs. The hourly upload sweep now also keeps every held file an entry still needs, read from the outbox files on disk, so the first sweep at start keeps them too. An entry needs them while it waits and while its notice stands (not dismissed). After that the upload sweep forgets them once they are a day old and removes each blob nothing else uses.
  • Refused later (the thread deleted there, a file refused there, an older computer): the existing "Not delivered" notice under the thread, as for words alone.
  • Online, the agent waits up to 66 s (6 s, plus 60 s for the files) before it is told the answer waits. Before this change it waited for each upload, then 6 s.
  • No new mark, route or wire field: the other computer gets the same uploads and agent-reply requests as before. An older computer without tag-across is still refused at once.

Words agents read

  • Removed: FAR_REPLY_WORDS.filesAway, " cannot be reached now, and files go to it only while it is online. Nothing was sent: send it again when is back, or without the files." A held answer with files now gets the existing words-only line, "Waiting for : your message goes into thread when is back."
  • No new sentence. The refusals at hold time reuse existing text: the upload route's size refusal, inboxUploadNameRefusal, " could not be sent to ." (moved from the old upload helper) and " is no longer here." (from inboxUploadFromAttachment).

Tests

  • packages/server/inbox-far-reply-files.test.ts (new): held with files, then delivered once with words and files (the agent's files changed meanwhile); a crash or retry between files and answer; forgotten ids sent again once; a file refused there, with a notice and its files kept until it is dismissed, then swept; the thread deleted there; no sweep takes a held file (the day-old upload sweep, the store's sweep after a deletion); oversize, folder, dotenv and bad-name files refused at hold time; the words-only path unchanged; an older computer refused as before.
  • Updated: inbox-far-tags.test.ts, inbox-far-answers.test.ts.
  • Docs: docs/agent-guides/inbox-machines.md (a "Held files" bullet; the old files refusal and the gap removed), plus the outbox header.

An agent's send_message into a linked computer's thread with attachments
was refused while that computer was away. Its files are now kept on this
computer as the Inbox's own pending uploads, named on the held outbox
entry, and sent to that computer's uploads route by the sender loop just
before the answer, each id there saved on the entry so a retry sends no
file twice and the answer goes once under its key. The upload sweep keeps
them while the entry waits or its notice stands. A file that computer
would refuse (folder, dotenv, bad name, over 100 MB) is refused at once.
The agent hears the same waiting line as for words alone.
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 24, 2026
…wait under 60 s

- Each file goes to the other computer's uploads route with an
  idempotency_key in the query, which that door requires of a file (it
  answered every upload 422 before). The key is the entry's, the try of
  the files and the file's place, so a file that landed before its id
  was saved is answered with that id and never taken twice; a new try
  begins only after that computer forgot the ids. The test door refuses
  a keyless file with the door's own rawCommandKeyRefusal.
- A file ends only when no byte moves for 30 s, so a slow file that keeps
  moving completes. A stalled or failed file is a server error for its
  entry: the person's writes behind it go, the link's stream stays up,
  and after the outbox's tries it ends refused (Not delivered), never
  "may have been delivered".
- Files are sent again only when the refusal names the attachments; any
  other refusal is the notice.
- Size and name are checked before anything is copied, so a refused file
  leaves nothing in the blobs or pending uploads.
- With files, the agent waits 45 s at most (Codex's MCP tool limit is
  60 s by default), then hears it waits while the outbox sends it once.
- A file's request that fails by itself (Wi-Fi dropped, the lid closed)
  is unreachable again: not counted, tried again after a pause and when
  the link is back. Only an idle stall or a 5xx there counts, and only
  those end as "Not delivered" after the outbox's tries.
- Files go up in their own lane per linked computer (OutboxFileLane),
  outside the serial write queue. The queue passes an answer by while its
  files go, and with it only that agent's later answers in the same
  thread, so the person's writes, far wakes and other agents' answers
  never wait on a file. Once its files are there the answer takes its
  place in the queue.
- After a stall the next try of that file uses a new key, so it never
  waits behind a half-open upload still holding the old key at that door.
- A file that grows past 100 MB after the size check is cut off in the
  copy and refused, leaving nothing behind; a late pull can no longer
  restart the idle timer.
- The agent's 45 s wait with files counts from the start of its call,
  the copy and hash here included.
- A real-socket test: Bun's fetch drains a stream body whose pull
  answers at once into memory, but waits on an async pull as the lane's
  is, so the idle limit measures what the socket took.
@backnotprop
backnotprop marked this pull request as ready for review November 24, 2026 20:07
@backnotprop
backnotprop merged commit 7f285f4 into main Nov 24, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant