Repository navigation
run: --output-env carries a structured document, naming the run environment its reader derives the key from - #1206
Merged
Conversation
…environment its reader derives the key from A configuration document — a workspace group that is one YAML or JSON document rather than key/value pairs — is carried under a key that hashes its origin, its name AND the environment (resources.ConfigurationDocumentKey), which is how the SDK finds it again. The two --output-env writers built their EnvironmentVariableManager without SetEnvironment, so core's carrier refused: "configuration document requires origin, name and environment". The agent's own Init request has always carried the environment, which is why no run without --output-env ever met this. What surfaced it: the composition root's merged fixture-composition.yaml (`codefly generate fixture-composition`, cli#1197) is a root-owned document and so is handed to EVERY service of the run; platform-core's composition gate passes --output-env for saas/auth-gateway and refused at the first Init on 0.1.219 (platform-core#117, b514028c). Reproduced on 0.1.219 with a one-module workspace carrying a root fixture-composition.yaml; the same run passes with this change and the file carries the document under CODEFLY__CONFIGURATION_DOCUMENT_V1__… with origin, name and environment "local", read back by resources.DecodeConfigurationDocument. The writers now take the run's environment from the world (runner.world.Env, as the Init request does) and refuse by name when they are handed none, rather than failing on the first document with the contract's generic error. Core's contract is right: a document without its environment is unreadable by the SDK, so inventing an origin in the composition would not have worked either. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ments are keyed on Same-PR docs for the writer fix: the file's contents, its owner-only mode and the secrets in it, the Start-only dependency write, and that a structured configuration document is carried under a key hashing origin, name and the selected run environment — the key the SDK derives — for the normal and the excluded-root file alike. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
The bug
platform-core's
compositiongate fails on 0.1.219 atcodefly run … --output-env, first Init:A configuration document — a workspace group that is one YAML/JSON document rather than key/value pairs — is carried under a key that hashes its origin, its name and the environment (
resources.ConfigurationDocumentKey); that is how the SDK finds it again. The two--output-envwriters (AppendServiceProcessConfigurationsToFile,AppendEnvironmentVariablesToFile) built theirEnvironmentVariableManagerwithoutSetEnvironment, so core's carrier refused. The agent's own Init request has always carried the environment, which is why no run without--output-envever met this.What surfaced it: the composition root's merged
fixture-composition.yaml(codefly generate fixture-composition, #1197) is a root-owned document and so is handed to every service of the run. platform-core#117 (b514028c) added that generation and passes--output-envforsaas/auth-gateway; the whole run refused at the first Init. Diagnosed, not inferred: the failing call isrunner.go:375→AppendServiceProcessConfigurationsToFile→ coreconfigurationAsEnvironmentVariables(conf, holder.environment.GetName(), …)with a nilholder.environment.Core's contract is right. A document without its environment is unreadable by the SDK, so inventing an origin in the composition (the question the coordinator asked) would not have worked either; the writer was the owner.
The fix
The writers take the run's environment from the world (
runner.world.Env.Proto(), exactly what the Init request carries) and set it on the manager. A writer handed no environment refuses by name before writing anything, instead of failing on the first document with the contract's generic error. Three call sites (Init, Start, excluded root) updated.Evidence
configurations/local/fixture-composition.yamlis the schema line,run service gateway/edge --init-only --output-env …→configuration document requires origin, name and environment, no file written.gateway/edge: Stoppedcleanly, and the file carriesCODEFLY__CONFIGURATION_DOCUMENT_V1__5023386cb168…whose carrier reads"origin":"_workspace_origin","name":"fixture-composition","environment":"local".ConfigurationDocumentKey(workspace, fixture-composition, local)is written and thatDecodeConfigurationDocumentreads it back forlocal; a new test proves a writer with no environment refuses by name and leaves no file.go test ./pkg/orchestration/ ./cmd/run/green;golangci-lint run ./pkg/orchestration/...clean.Fix or hack
Fix at the owner (the CLI's writer). Goes in v0.1.220 with #1205.
🤖 Generated with Claude Code
Docs (same PR)
docs/commands.md, undercodefly run: what--output-envwrites (own, runtime, workspace groups; dependencies once at Start after the barrier), its owner-only mode and the secrets in it, and that a structured configuration document is carried under a key hashing origin, name and the selected run environment — the key the SDK derives — for the normal and the excluded-root file alike; a writer handed no environment refuses by name.