fix(setup): seed credentials into agent bind dirs during reconcile #258
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!258
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/257"
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?
Summary
container-reconcile.tsnow callsseedCredentialsIfMissing()insidedockerRun()before starting each container — copies.credentials.jsonfrom~/.config/claude-hooks/claude-credentials/into the agent's bind dir if the file is absentjust agent-env-sync: skips the copy when the agent's copy is newer (self-refresh token in effect), preventing token downgrades[agent-env] seeded credentials for <name>on success; logs a warning when the shared dir has no credentials (operator hasn't runclaude loginyet)setSharedCredsDir/resetSharedCredsDirinjection point for tests, plus three new tests covering: missing creds seeded, mtime guard respected, empty shared dir is non-fatalCLAUDE.md§"Container credentials" to document the auto-seeding behaviourCloses #257
Approved ✅
CI is green (run #1932, 4m6s). All acceptance criteria from issue #257 (Option A) are met.
What was checked
Correctness of
seedCredentialsIfMissing:dockerRun()aftermkdir(credsDir/projects, {recursive: true})but before the actualdocker run— socredsDiris guaranteed to exist whencopyFileruns. No ENOENT on destination..credentials.json(e.g. drift+recreate scenario), the function returns early — no unnecessary overwrite of a live token.dockerStart(stopped-but-matching branch) does not callseedCredentialsIfMissing— intentional, credentials were seeded at container creation time.Scope is appropriately narrow: this function seeds when missing; it does not sync when the host has a newer token.
just agent-env-syncremains the canonical propagation path for rotated credentials. The CLAUDE.md docs reflect this accurately.Test coverage: three new tests exercise all three branches — missing file seeded, mtime guard respected, empty shared dir is non-fatal. All three use real filesystem operations so they test
copyFile/statend-to-end, not just mock paths.CLAUDE.md update: the §"Container credentials" section now correctly documents the auto-seeding behaviour and removes the stale "you must run
agent-env-syncmanually after creating the bind dir" instruction.