fix(setup): new agent types don't get credentials seeded until operator runs just agent-env-sync manually #257
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#257
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?
Bug
When a new agent type lands in
config/agents.json(e.g.,foremanfrom #217), the container reconcile (just agents-sync) creates the container/registry, but does not seed.credentials.jsoninto the agent's bind dir. The first dispatch fails with:Only
just agent-env-syncorjust agent-env-sync <name>fans out the shared creds from~/.config/claude-hooks/claude-credentials/.credentials.jsoninto each type'scontainer.credentials_host_dir. Operators don't know to run it.Repro (2026-04-21)
#217renamedarchitect→foreman. The type's bind dir is~/.config/claude-hooks/agent-env/foreman/.mkdir -p) per the Forgejo-identity runbook I gave.just agents-syncregistered the foreman-default container + worker./app/planner.66f21f3dfailed in 1 turn withNot logged in(SDK API error:authentication_failed).ls ~/.config/claude-hooks/agent-env/foreman/→ no.credentials.json.just agent-env-sync foreman→ seeded the file; next dispatch worked.Acceptance criteria
Option A (preferred) —
agents-syncseeds credsjust agents-sync(or theapps/server/src/container-reconcile.tspath it invokes) detects anycontainer.credentials_host_dirthat's missing.credentials.jsonand copies from the shared dir BEFORE the container starts..credentials.jsonis newer than the shared source (mtime-guard parity withagent-env-syncper the 2026-04 token-rotation fix).[agent-env] seeded credentials for <name>.Option B (fallback, lighter) — loud boot-time warning
loadWebhookConfig, walk every type withcontainer.credentials_host_dirand stat its.credentials.json.[agent-env] WARNING: <name> has no credentials — run 'just agent-env-sync <name>'AND emit astartup_warningSSE envelope so the dashboard can paint a banner.Operator docs
CLAUDE.md§"Container credentials" with: "Adding a new agent type that declarescontainer.credentials_host_dir: after creating the bind dir, runjust agent-env-sync <name>to seed the shared credentials.just agents-syncalone doesn't do this (today)."just setupso fresh clones never hit this.Verification
~/.config/claude-hooks/agent-env/foreman/.credentials.json, restart the service, send a foreman chat turn — should either work (Option A) or surface the missing-creds warning in the dashboard (Option B).Out of scope
just agent-env-sync --forceper the 2026-04 fix.References
justfile::agent-env-sync— the recipe that does the fan-out correctly when asked.justfile::agents-sync— the recipe that creates containers but skips cred seeding.apps/server/src/container-reconcile.ts— the code path behindagents-sync.CLAUDE.md§"Container credentials" — current doc that misses this step for new types.66f21f3dfailed with SDKauthentication_failedbecause the bind dir was empty post-#217.