Repository navigation
feat(protocol): declare env write grant kinds and take a write_object on data/get - #149
Open
earakely-scale wants to merge 8 commits into
Open
earakely-scale wants to merge 8 commits into
earakely-scale wants to merge 8 commits into
Conversation
… on data/get A data/get handler may take a write_object (a WriteObject the caller names) and answer uploaded_object_part(uploaded, name=..., mime_type=...), read back with uploaded_object(part). Each grant parameter a handler takes is declared under urn:agentenv:transfers/v1 as the write grant kinds it uploads through: write_namespace adds http-post-policy, write_object adds http-put and http-put-parts. client.write_kinds(card) reads the declaration, taking a card without it to accept http-post-policy alone when it advertises data-objects/v1. client.get_data sends write_object. A test freezes the object-write wire shape: receivers refuse fields they do not know, so a new capability must be a new grant kind. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…objects default Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…' into edgararakelyan/env-write-object
…rts through the local grant server The items test server takes write_object: handed an object, data/get uploads its state as a zip bundle through it, and data/add loads such a bundle back. The new local-tier test hands the deployed server a 40-URL parts grant on the local grant server, then checks three things: the server used only the URLs its bundle's size takes, more than PARTS_IN_FLIGHT of them; each part is its range; and the parts put together are the bundle. The gateway test's exact-set check of the items card now includes transfers/v1, and the README example names its bundle github.zip. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The new parts test is the first in the run to start this process's grant server, inside its own state root. A later test's containers trust that test's root's CA, so the server must start afresh, as the prompt-agent tests' fixtures already do. Without this, the file-parts test failed after it in CI. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nv-write-object # Conflicts: # packages/agentenv-protocol/README.md # packages/agentenv-protocol/src/agentenv_protocol/__init__.py # packages/agentenv-protocol/src/agentenv_protocol/agent_env_environment.py # packages/agentenv-protocol/src/agentenv_protocol/client.py # packages/agentenv-protocol/src/agentenv_protocol/types.py # tst/data/agentenv_mcp/server.py # tst/integration/env/envs/server_env_local_test.py
…te_object A handler that takes only write_namespace keeps the card it had: a card without the declaration already reads as taking the namespace grant alone, so every existing card, the computer drivers' included, stays as it was and the conformance probe meets no new extension. write_kinds reads only the names a declaration lists, so a malformed card takes no kind instead of raising, and data/get's paths and both grants are pinned working together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… object as no kinds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Merged the updated #147 (and so One behaviour change, in the follow-up commits:
|
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.
Stacked on #147: review and merge that first, then this retargets to
main.Summary
An env service can now be handed one caller-named object to upload its
data/getexport to, and tell callers which write grants it takes. Thedata/getoperation itself is unchanged.write_objectparameter.@get_datahandler may take an optionalwrite_object: WriteObject._invoke_getvalidates it only for a handler that takes it, naming the failing fields and never their values, as forwrite_namespace.transfers.upload()(parallel parts for anhttp-put-partsgrant) and answersuploaded_object_part(uploaded, name=..., mime_type=...), read back withuploaded_object(part). The name must be relative.urn:agentenv:transfers/v1. A handler that takeswrite_objectdeclares the write grant kinds it uploads through as{"write": [...]}, derived from its signature:http-putandhttp-put-parts, afterhttp-post-policywhen it also takeswrite_namespace. A handler that takes onlywrite_namespacekeeps the card it had, data-objects/v1 alone, so every existing card (the computer drivers' included) is unchanged.client.write_kinds(card)reads the declaration. A card without it counts as acceptinghttp-post-policyalone if it advertises data-objects/v1, and nothing otherwise. A malformed declaration counts as the kinds it names by string, or none. A caller sends only a grant whose kind the card lists.client.get_data(..., write_object=)sends the grant, besidewrite_namespaceandpaths._invoke_getcheckspathsfirst, as before, so a handler without them refuses the call before any grant is used.Wire freeze.
test_the_object_write_wire_shape_is_frozenpins the field sets ofHttpPartsPutGrant,HttpPutGrant,WriteObjectandUploaded. Receivers refuse unknown fields, so a field added later must be negotiated rather than sent to everyone. A receiver can advertise it in itstransfers/v1entry, whose unknown params readers ignore, or it can be a new grant kind.Labelled
bump-version: this is the release env services pin to start receiving parts grants. No issuer sendswrite_objectyet; that lands in core separately.Tests
test_data_objects.pycovers:write_object-only and combined handlers, andwrite_namespace-only cards unchanged;write_kindsfor declared, data-objects-only, bare and malformed cards;pathsandwrite_objecthanded together, andpathsrefused before an object grant is used;Integration (local tier,
server_env_local_test.py). The items test server now takeswrite_object: it uploads its state as a zip bundle, anddata/addloads such a bundle back. The new test does the following:PARTS_IN_FLIGHTof them.It also checks that the card declares
http-put-parts.gateway_test.py's exact-set check of the items card now includestransfers/v1, and the README example names its bundlegithub.zip. Out-of-tree mutants are all killed: declaration dropped,write_objectignored,write_kindsprecedence, reply marker ignored, name unvalidated, client dropping the grant, and an error echoing the grant.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable defects were found.Summary
Adds
write_objectsupport todata/get, declares accepted grant kinds, and provides helpers for uploaded-object replies.Diagram
sequenceDiagram participant C as Caller participant E as Environment participant S as Object store C->>E: Read card E-->>C: Accepted write grant kinds C->>E: data/get with write_object E->>E: Check grant E->>S: Upload object or parts E-->>C: FilePart with Uploaded marker C->>C: Read marker with uploaded_objectReviews (5) · Last reviewed commit: "fix(protocol): write_kinds reads a decla..." · Reviewed by Greptile