Repository navigation
Linked computers: an answer with files waits for a computer that is away - #4010
Merged
Merged
Conversation
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.
…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.
…pause, stop an upload taken back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An agent on one computer that answers in a thread on a linked computer with
send_messageand 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 ininbox/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.uploadsroute 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 postingagent-reply, the sender loop sends each file to the other computer'suploadsroute 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.uploadsandagent-replyrequests as before. An older computer withouttag-acrossis still refused at once.Words agents read
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."inboxUploadNameRefusal, " could not be sent to ." (moved from the old upload helper) and " is no longer here." (frominboxUploadFromAttachment).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.inbox-far-tags.test.ts,inbox-far-answers.test.ts.docs/agent-guides/inbox-machines.md(a "Held files" bullet; the old files refusal and the gap removed), plus the outbox header.