Repository navigation
feat(env): an infra env put can name the version it writes - #370
Merged
earakely-scale merged 3 commits intoOct 28, 2026
Conversation
put_gateway_env, put_service_db_env and put_website_browser_env take an optional version, passed to Env.put, which stores exactly that version when it's the env's next and raises ConcurrentModificationError otherwise. A promotion that read an env at one version then writes nothing over a version someone put meanwhile. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The puts typed their metadata as strings only, though an env stores any JSON value there. A promotion keeps a record of what it checked on the version it writes, which is a mapping. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The store reads version 0 as "the next free version", so a put naming 0 wrote whatever version came next instead of refusing. The puts now raise ValueError for a version below 1 before writing any image. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
earakely-scale
deleted the
edgararakelyan/fd-4550-agentenv-framework-infra-env-puts-write-only-the-next
branch
October 28, 2026 18:24
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.
Summary
put_gateway_env,put_service_db_envandput_website_browser_envtake an optionalversion=. When given, the env is stored as exactly that version, which must be the env's next one. Otherwise the put raisesConcurrentModificationErrorand writes no env. A version below 1 raisesValueErrorbefore anything is written, since the store reads 0 as "the next free version". Withoutversion=they behave as before.Their
metadatais also typedMapping[str, Any]rather than strings only, asEnv.metadataalready is. The promotion keeps a record of what it checked, which is a mapping, on the version it writes.Why
AgentEnvHub is going to promote the gateway and service-db images from each release, as it already does for the agents. A promotion reads
defaultat one version and writes the next. If someone runsagent-env env gateway putin the meantime, the promotion should write nothing and report itself busy, not overwrite what they put. The sdk'sput_publishedalready works this way for agents.Env.puthas enforced a named version since #327, so the change only passesversionthrough. As withput_published, the image artifacts are still written first under their own next versions. An env write that loses the race leaves those image versions unreferenced, and nothing reads them.Testing
test_a_put_that_names_a_version_writes_only_that_next_one, for each of the three kinds against local stores. It registers published digests, writes v2 by name, and checks that a second write naming v2 raises and leaves the env at v2.test_a_put_keeps_metadata_that_isnt_a_string.test_a_put_refuses_a_version_below_1_before_writing_anything, for each kind with 0 and -1.tst/unit/env/bootstrap_test.py: 45 passed after the last two commits.tst/unit/andpackages/agentenv-protocol/tests/: 11,138 passed, 66 skipped.ruff checkpasses.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; the earlier zero-version issue is fixed.Summary
The three infrastructure env helpers accept an optional
versionand allow non-string metadata.Reviews (2) · Last reviewed commit: "fix(env): an infra env put refuses a ver..." · Reviewed by Greptile