Skip to content

fix(env): each configuration variable once, on a core that counts them once - #164

Open
antoinetoussaint-byte wants to merge 1 commit into
mainfrom
fix/env-once-core-counts-once
Open

antoinetoussaint-byte wants to merge 1 commit into
mainfrom
fix/env-once-core-counts-once

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Closes #162

What was wrong

CreateRunnerEnvironment put the service's full environment (EnvironmentVariables.All()) on the runner environment, and Start handed the same set to the process again. A native process receives the runner environment's entries plus its own, so every configuration variable went in twice. Core before v0.19.12 counted both copies against the 512 KiB process-environment limit. Local QA #3 (2026-10-31) hit this: runtime/worker on go agent 0.0.74 was refused at 1,012,847 bytes.

Change

  • pkg/runtime/runtime.go: the service environment is no longer added to the runner environment. Start delivers the complete set. That set includes everything Init's copy had, because the manager only adds entries after Init. Test and Lint already pass their environment explicitly.
  • go.mod: core v0.19.5 → v0.19.18-0.20261029150419-9d2348c460ae, the pin codefly CLI v0.1.233 uses. It contains 0772bc0da6 ("count effective environment before carrier delivery").
  • TestStartedProcessReceivesEachConfigurationVariableOnce (root package): runs a real Load and a native Init with a workspace configuration, and no pre-bound runner, so Init creates the runner the way production does. It checks that Start's set has each key once, and that a process spawned from the runner environment inherits no CODEFLY__ variable. With the old line put back it fails: the runner environment carries CODEFLY__WORKSPACE_CONFIGURATION__ROBIN__CHAT, CODEFLY__MODULE, and the other identity keys.

Same defect and same fix as codefly-dev/service-go-grpc#220 (released 0.1.72).

Classification

Fix, at the owner: this repo creates the runner environment and starts the process. Reused: core's EnvironmentVariableManager, the runner seams, and core's effective-environment count. Nothing new added.

Verified / not verified

  • go test -count=1 ./..., go vet ./..., go mod tidy -diff and CGO_ENABLED=1 go build . all pass locally.
  • Not run: TestPackageRealCGO (SERVICE_GO_PACKAGE_TESTS=required), the manifest guard locally, and a composed codefly run of runtime/worker on the new agent.
  • Toolchain commands (go build, go mod tidy, goimports) run in the runner environment and no longer see service configuration. None of them read it.
  • Pre-existing and not touched: gofmt -l flags pkg/code/callgraph.go (comment alignment) on main.

🤖 Generated with Claude Code

…m once

CreateRunnerEnvironment put the service's full environment on the runner
environment and Start handed the same set to the process again, so a native
process received every configuration variable twice. Cores before v0.19.12
counted both copies against the 512 KiB process-environment limit, which
refused runtime/worker at 1,012,847 bytes.

Start alone now delivers the set. Core moves from v0.19.5 to the pin
codefly CLI v0.1.233 uses (v0.19.18-0.20261029150419-9d2348c460ae), which
contains 0772bc0da6 (count the effective environment).

Closes #162

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native start counts superseded duplicate env entries against the 512 KiB limit (pins core v0.19.5; fixed in core 0772bc0da6 / v0.19.12)

1 participant