Per-run instance HOME with credential copy/wipe #202
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#202
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
Give every run a private HOME at
<state-dir>/instances/<run>/home, still spawning on the host (HOME= in the session env). This is the isolation seam the container runner will mount later, de-risked without podman:~/.claude.json, onboarding flags) against the instance HOME instead of the shared one.~/.claude/projects/..., codex~/.codex/sessions/...), and the chat tailer + deep-link capture read those per-run paths. One credentialInjector seam per provider so a server-side proxy can replace the copy later.Acceptance criteria
~/.claude*/~/.codexof the master store are no longer read or written by instance processesBlocked by
None - can start immediately
Agent Brief
Category: enhancement
Summary: Give every run a private HOME under
<state-dir>/instances/<run>/homewith provider-credential copy at spawn and wipe at stop, still spawning on the host.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:
Instance processes share the service user's HOME. Provider trust seeding (the claude provider's
SeedTrust, which writes the per-directory folder-trust entry and the machine-globalhasCompletedOnboardingflag into~/.claude.json) targets that shared HOME. Providers resolve transcript/session paths under the shared~/.claude/projects/...and~/.codex/sessions/..., and the chat tailer and deep-link capture read those shared paths. Provider model credentials live in a master store in the service HOME. Per-run git credentials already have the lifecycle this issue mirrors: the vault materializes per-(cred, op)files under the runtime dir, cleans up per op, and sweeps orphans on boot.Desired behavior:
Per the issue body: instance HOME created at spawn with the provider's model credentials copied in; trust seeding targets the instance HOME; transcript/session paths resolve per-run for both providers and the tailer + dialog/deep-link capture follow them; wipe on stop and on launch rollback; boot-time sweep for orphaned instance dirs;
HOMEset in the session env.Key interfaces:
spawnEnv/ the session env — carries the per-run HOME (and anything derived from it).SeedTrustand the codex equivalent) — must accept a home root instead of assuming the process HOME.Acceptance criteria: the checklist in the issue body.
Out of scope:
The autoland validator's CONCERN on PR #209 (claude credential-isolation asymmetry vs codex) is addressed in
24ab1b0on afk/202 — with one deviation from the suggested fix.Concern confirmed, and slightly worse than stated: live probe of claude 2.1.214 shows CLAUDE_CONFIG_DIR outranks HOME for all state — credentials,
.claude.json, andprojects/(transcripts) — so an inherited value would leak the master store and break per-run transcript locate. Latent today: nothing in-repo sets it and the deployed server env (inherited by this very session through the tmux path in question) doesn't either.Suggested one-liner rejected: pinning
CLAUDE_CONFIG_DIR=<home>/.claudewould relocate the CLI's.claude.jsonto<home>/.claude/.claude.json(live-probed), away from the<home>/.claude.jsonthe trust seed and oauthAccount mirror write — regressing PR #209's live-verified onboarding/trust suppression.Shipped instead: the injector now unconditionally returns
CLAUDE_CONFIG_DIR=(empty). The CLI treats empty as unset and stays on HOME resolution (live-probed), so the defense is codex-symmetric without relocating anything. Both load-bearing CLI facts are pinned in compat.md §3a + opt-in live testTestCompat_Live_configDirResolution; tmux delivery of the empty-valued-eentry probe-verified. Build, full test suite, and golangci-lint 2.12.2 green (tmux integration tests fail in this sandbox identically on the untouched tree — CI is their home).