Scrub inherited environment from host-mode agent panes #204
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#204
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
tmux panes currently inherit the lab process's entire environment because the tmux server is a child of the service — so anything in the unit's EnvironmentFile (e.g. a
LAB_DBPostgres DSN with password) is readable by every agent. Fix at the tmux seam: spawned sessions must receive only the explicit allow-listed env (the current-eset: cred env, LAB_URL/LAB_TOKEN, git author vars) plus a minimal baseline (PATH, HOME, TERM, locale). Host mode survives through the container migration, so this matters independently of the container runner.Acceptance criteria
Blocked by
None - can start immediately
Agent Brief
Category: enhancement
Summary: Spawned tmux panes must receive only the allow-listed spawn env plus a minimal baseline — not the lab service's full inherited environment.
The issue body's "What to build" and acceptance-criteria checklist are the authoritative spec (grilled 2026-07-22). This brief adds the interface map and scope fences.
Current behavior:
The tmux server is a child of the lab service, so every pane inherits the unit's entire environment — including EnvironmentFile secrets such as a
LAB_DBPostgres DSN with password. The-eflags emitted by the session-args builder in the tmux wrapper package only add the explicit set (spawnEnv: cred env, LAB_URL/LAB_TOKEN, git author vars); nothing subtracts the inherited remainder.Desired behavior:
A spawned session's environment is exactly: the explicit
spawnEnvallow-list, plus a minimal baseline (PATH, HOME, TERM, locale). Any other variable present in the lab process env is absent from the pane. This must hold for regular agent runs and for login sessions, and agent CLIs must keep working. State the scrub as a property of the tmux/session-runner seam — the mechanism (env-clearing wrapper around the pane command, tmux environment controls, etc.) is the agent's choice.Key interfaces:
Tmux.Start/ its session-args builder) — the seam where the scrub belongs, composing with the existing prlimit pane wrapper.spawnEnv— stays the single source of truth for the allow-list; this issue must not grow it.Acceptance criteria: the checklist in the issue body — the regression test asserting a planted lab-process-only variable is invisible in a pane is the core deliverable.
Out of scope:
-eanyway; this issue is the host-mode fix, which must survive independently since host mode remains break-glass after the migration.spawnEnvcontains (that set is #201/#202 territory).