Repository navigation
feat(a2a-agent): an atif/1 copy's media files wait on the agent's disk until the worker pulls them - #834
Open
earakely-scale wants to merge 3 commits into
Open
feat(a2a-agent): an atif/1 copy's media files wait on the agent's disk until the worker pulls them#834earakely-scale wants to merge 3 commits into
earakely-scale wants to merge 3 commits into
Conversation
…k until the worker pulls them An agent that serves atif/1 spools each media file its copies name to its disk, one file per sha256, instead of holding the bytes in memory, with a PNG, JPEG, GIF or WebP image's width and height read from its header when the adapter gives none. The trajectory extension gains a media call, listed on such an agent's card: given a context and an exact-object write grant per media/<sha256>.<ext> path, it uploads each file the context holds, 8 at a time, checking each upload against its name, and answers what it uploaded, the paths it holds no file for and the uploads that failed. An uploaded file leaves the disk, as do a context's files when it is evicted or restored over, and the rest when the server stops. atif.media_file and check_media take a part path only as media/<sha256>.<ext> and only with the bytes that name, and the scrub never takes a media file's name in a grant's URL for its token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k what they send - The media call is served by the SDK alone (`OperationDefinition.sdk_only`): an agent that serves its own trajectory reads keeps it, and binding it is refused. - Each spool hold has its own number, so an upload that outlives its context's copy releases only the hold it began with. - A spooled file is hashed before its upload; one that no longer matches its name is reported failed and never reaches the store. - A WebP header too short for its size fields gives no size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Y3 for FD-6077: an
atif/1copy's media files wait on the agent's disk until the worker pulls them at each turn's end. This is the SDK half only (Y3-8). The run's folder, the pull helper and theatif/1fetch that calls it land with Y4 (FD-6078), so each piece lands with its caller. Closes FD-6077.What changes
a2a_agent/_media_spool.py). An agent that servesatif/1writes each media file its copies name (media/<sha256>.<ext>) to its disk, one file per sha256, instead of keeping the bytes in memory for the context's life.atif/_image_size.py). A PNG, JPEG, GIF or WebP image's width and height are read from its header when the adapter gives none (Y3-6).agentextra still has no Pillow.mediacall on the trajectory extension (POST /ext/trajectory/media). It is listed on the card only of an agent that servesatif/1; old agents and native-only agents never get it.{context_id, objects: {path: write grant}}and uploads each file that context holds under its exact-object grant, 8 at a time, checking each upload against the file's name.objects(what it uploaded),missing(paths the context holds no file for) andfailed(uploads that failed, with why). Neither of the last two stops the rest.media/<64 hex>.<ext>paths are accepted.OperationDefinition.sdk_only). An agent that serves its own trajectory reads keeps it, and binding it is refused.failedand never reaches the store.atif.media_filetakes a part path only asmedia/<sha256>.<ext>in the document's own folder, never another path or a URL.atif.check_mediarefuses bytes that don't match their name. The validator now shares the same pattern..../media/<sha256>.png). The scrub then redacted every copy's media paths. A media file's name is never taken for a token now. Chaos found this as soon as it pushed media.Choices to review
get. It used to run on every trajectory call, and the media call carries no format.Testing
tests/test_a2a_atif_media.py(26 tests):TRAJECTORY_V1.getstill starts and servesmedia, and bindingmediais refused;atif/1listsmedia;Removing the spool, the header sizes, the release, the drop on eviction, the
sdk_onlyrefusal or its exemption from the override rule, the hold numbers, the pre-upload hash or the WebP length guard fails them.Integration: a new test in
test_prompt_agent_live_trajectory_local.py.atif/1copy's media path.mediacall.Serving chaos (the Y2b harness): after every task's final read it pushes the copy's new media and checks:
60 s locally at c7b8dc8: 4,095 seeds, no failures. 20 min on an x86 test host at c7b8dc8: 83,560 seeds, 313,159 tasks, 4.09M reads, 31,214 restarts and 31,152 restores, no failures.
On the test host at c7b8dc8, the live-trajectory integration tests pass (5/5, the media push among them). 2343d57 only names a constant.
All 2,033 protocol tests pass, and
ruff check .passes. Fourtst/unit/task_step/computer_exec_test.pytests fail on macOS only, because BSDbase64has other flags. They don't involve this change, and CI runs them on Linux.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issues were found.Summary
The SDK now keeps ATIF media on disk until the worker requests an upload. The latest change names the hash read size without changing its value.
Reviews (7) · Last reviewed commit: "refactor(a2a_agent): name the media hash..." · Reviewed by Greptile