A session's pod gets the environment gc set for the agent #50

Merged
mikluko merged 3 commits from server-env into main 2026-11-16 07:46:32 +00:00
Owner

Item 1 of specs-18's request for 0.3.3, and the part of item 2 that needs no decision. guest failed every start with "Configuration value not found: GOOSE_PROVIDER" because only GC_* of gc's start environment reached the Job.

  • The pod gets everything gc set for the agent (sc.Env: the supervisor's variables and the workspace's, provider's and agent's env, merged by gc, per gc's reference "Session environment"), less what a pod has of its own: PATH, HOME, USER, LOGNAME, SHELL, PWD, OLDPWD, TMPDIR, TMP, TEMP, HOSTNAME, TERM, and by prefix XDG_ and KUBERNETES_. It is a list of what cannot be true in the pod, not of prefixes that gc's next provider falls outside of. A variable that is not a name is left out, and so is an empty value (gc asking for an unset, which a pod that lacks it satisfies). What the server sets (ROOMCITY_*) wins, and a ROOMCITY_* in gc's environment (the supervisor's ROOMCITY_RUNTIME_URL) is left out.
  • GC_DOLT_PASSWORD, a secret gc itself sets, is not written into the Job's spec: held back by its full name, as specs-18 decided, not by a pattern. bd in the pod reads its credentials from the file BEADS_CREDENTIALS_FILE names (#42). The start logs once, by name and never by value, what it left out.
  • Test: a start config with goose's provider environment, the supervisor's own variables, a ROOMCITY_TOKEN of someone else's and GC_DOLT_PASSWORD yields a Job spec that has the provider's and has none of the others, no value of the secret anywhere in it, and a log that names what was left out.

Item 2 as a whole (any secret value gc passes, ROOMCITY_TOKEN among them, kept out of the Job's spec) waits for the owner: per-session Secret read with envFrom, which grants the server create/get/update/delete on Secrets of its namespace (recommended by me and by specs-18), or a rule by name, which specs-18 ruled out. It will be its own pull request, with saraksh/kube's Role.

Not covered, and I did not look at: variables the supervisor sets that name its disk besides those above (CITY_* of the supervisor's start script, for one). They are passed; none broke a start so far.

Assisted-By: Claude noreply@anthropic.com

Item 1 of specs-18's request for 0.3.3, and the part of item 2 that needs no decision. `guest` failed every start with "Configuration value not found: GOOSE_PROVIDER" because only `GC_*` of gc's start environment reached the Job. - The pod gets everything gc set for the agent (`sc.Env`: the supervisor's variables and the workspace's, provider's and agent's `env`, merged by gc, per gc's reference "Session environment"), less what a pod has of its own: `PATH`, `HOME`, `USER`, `LOGNAME`, `SHELL`, `PWD`, `OLDPWD`, `TMPDIR`, `TMP`, `TEMP`, `HOSTNAME`, `TERM`, and by prefix `XDG_` and `KUBERNETES_`. It is a list of what cannot be true in the pod, not of prefixes that gc's next provider falls outside of. A variable that is not a name is left out, and so is an empty value (gc asking for an unset, which a pod that lacks it satisfies). What the server sets (`ROOMCITY_*`) wins, and a `ROOMCITY_*` in gc's environment (the supervisor's `ROOMCITY_RUNTIME_URL`) is left out. - `GC_DOLT_PASSWORD`, a secret gc itself sets, is not written into the Job's spec: held back by its full name, as specs-18 decided, not by a pattern. bd in the pod reads its credentials from the file `BEADS_CREDENTIALS_FILE` names (#42). The start logs once, by name and never by value, what it left out. - Test: a start config with goose's provider environment, the supervisor's own variables, a `ROOMCITY_TOKEN` of someone else's and `GC_DOLT_PASSWORD` yields a Job spec that has the provider's and has none of the others, no value of the secret anywhere in it, and a log that names what was left out. Item 2 as a whole (any secret value gc passes, `ROOMCITY_TOKEN` among them, kept out of the Job's spec) waits for the owner: per-session Secret read with `envFrom`, which grants the server create/get/update/delete on Secrets of its namespace (recommended by me and by specs-18), or a rule by name, which specs-18 ruled out. It will be its own pull request, with saraksh/kube's Role. Not covered, and I did not look at: variables the supervisor sets that name its disk besides those above (`CITY_*` of the supervisor's start script, for one). They are passed; none broke a start so far. Assisted-By: Claude <noreply@anthropic.com>
Give a session's pod the environment gc set for the agent
All checks were successful
test / changelog (pull_request) Successful in 6s
image / image (pull_request) Successful in 17s
test / go (pull_request) Successful in 1m25s
f3d15d0264
Only the GC_* variables of gc's start environment reached the Job, so a
provider's env from city.toml never did: guest failed every start with
"Configuration value not found: GOOSE_PROVIDER". The pod now gets what gc
set, less what a pod has of its own (PATH, HOME, USER, LOGNAME, SHELL,
PWD, OLDPWD, TMPDIR, HOSTNAME, TERM, XDG_*, KUBERNETES_*), with the
server's ROOMCITY_* winning. GC_DOLT_PASSWORD, a secret gc itself sets, is
held back by its full name and not written into the Job's spec; there is no
rule by pattern. The start logs what it left out, by name.

Assisted-By: Claude <noreply@anthropic.com>
Test that the Job never makes a second pod for a failed start
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 1m0s
2b43753862
On 0.3.2 the cluster showed a Job of one name with pod after pod, and the
events say why it is not a retry: each pod's Job ends with
BackoffLimitExceeded before the next SuccessfulCreate, and the Job at that
moment is two seconds old. gc starts the session again after each failure,
the server deletes the failed Job and makes a new one under the same name.
The Job's spec already allows no retry; the test now holds it there:
backoffLimit 0, restartPolicy Never, no pod failure policy, one pod.

Assisted-By: Claude <noreply@anthropic.com>
Author
Owner

Read at 2b43753: the suite is green here under -race, internal/operate and internal/kube ten times with GOMAXPROCS=1. The list agrees with what gc sends (ProviderProcessPassthroughEnv in internal/processenv/provider.go: PATH, HOME, USER, LOGNAME, TZ, the locale, two XDG_ directories, a few Claude Code settings, the provider credentials of gc's own environment, then GC_* and the configured env). gc does not send its whole environment, so the supervisor's CITY_* never arrive and the description's last paragraph has nothing to worry about.

One variable before it merges: the locale. gc sends LANG=en_US.UTF-8 whenever its own environment names none, which is the case in the city's pod, and the image has no such locale (locale -a in a session's pod: C, C.utf8, POSIX; LANG is unset there today). Passed on, it leaves the pod in the C locale as before and adds a warning to every perl run in the agent's shell, tried in the running host pod:

$ LANG=en_US.UTF-8 perl -e 1
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings: ...

Which locales exist is the image's, so LANG, LANGUAGE and LC_* belong with what the pod has of its own, with a line in the test. Add it as a commit on top, so that #52 keeps its base.

A small one: the log line says "that the pod has of its own" and its list also carries the known secret and the names that are no names.

Read at 2b43753: the suite is green here under `-race`, `internal/operate` and `internal/kube` ten times with `GOMAXPROCS=1`. The list agrees with what gc sends (`ProviderProcessPassthroughEnv` in internal/processenv/provider.go: `PATH`, `HOME`, `USER`, `LOGNAME`, `TZ`, the locale, two `XDG_` directories, a few Claude Code settings, the provider credentials of gc's own environment, then `GC_*` and the configured `env`). gc does not send its whole environment, so the supervisor's `CITY_*` never arrive and the description's last paragraph has nothing to worry about. One variable before it merges: the locale. gc sends `LANG=en_US.UTF-8` whenever its own environment names none, which is the case in the city's pod, and the image has no such locale (`locale -a` in a session's pod: `C`, `C.utf8`, `POSIX`; `LANG` is unset there today). Passed on, it leaves the pod in the C locale as before and adds a warning to every perl run in the agent's shell, tried in the running `host` pod: $ LANG=en_US.UTF-8 perl -e 1 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: ... Which locales exist is the image's, so `LANG`, `LANGUAGE` and `LC_*` belong with what the pod has of its own, with a line in the test. Add it as a commit on top, so that #52 keeps its base. A small one: the log line says "that the pod has of its own" and its list also carries the known secret and the names that are no names.
Leave the locale to the pod
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 15s
test / go (pull_request) Successful in 57s
145c6e4133
gc sends LANG=en_US.UTF-8 whenever its own environment names no locale,
and the image has only C, C.utf8 and POSIX, so passed on it made every perl
run in the agent's shell print "perl: warning: Setting locale failed". LANG,
LANGUAGE and LC_* are the pod's own, as PATH and HOME are.

Assisted-By: Claude <noreply@anthropic.com>
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!50
No description provided.