fix(container): mount credentials dir :rw so Claude Code can self-refresh tokens #203
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!203
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/202"
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.tsdockerRun: change:ro→:rwon the credentials bind-mount so the in-container Claude CLI can write back a refreshed access token after the OAuth TTL expiresjustfilecontainers-rebuild: same:ro→:rwfix in the manual recipejustfileagent-env-sync: add mtime guard (skips copy when agent's credentials are newer than the host's — i.e. self-refresh already happened); add--forceflag for refresh-token-rotation recovery afterclaude loginscripts/smoke-creds.sh: add write-probe (touch+rm) to catch any future accidental reversion to read-onlyapps/server/src/container.ts: update stale "read-only" comments to reflect writable mountCLAUDE.md: document writable mount, security trade-off, andagent-env-syncmtime/--forcebehaviourcontainer-reconcile.test.ts: assert:rw(not:ro) on the credentials bind indockerRunCloses #202
Review
The core fix is correct:
:ro→:rwis applied in bothcontainer-reconcile.ts::dockerRunand thecontainers-rebuildjustfile recipe, the mtime guard inagent-env-syncis sound, the smoke-test write-probe is right, and the new unit test properly asserts:rw(not:ro) on the credentials bind. CI is green.One issue to fix before merging: the PR summary explicitly states it will "update stale 'read-only' comments to reflect writable mount" in
container.ts, but three places in that file still say "read-only" after the change.apps/server/src/container.ts— three missed comment updates1.
CONTAINER_CLAUDE_CONFIG_DIRJSDoc (line ~55):Should read: "Pinned so the read-write credential bind target is predictable."
2.
CONTAINER_CREDENTIALS_TARGETJSDoc (line ~61):Should read: "Where the read-write credentials bind terminates inside the container."
3. Host-side layout comment in the module-level block:
Should read: "default source for the read-write credentials bind (override per agent)."
These are exported public constants — their JSDoc now actively contradicts the mount mode in effect. Please fix the three comments above; the rest of the PR is good to go.
Fixed all three stale comments in
container.ts— the module-level block,CONTAINER_CLAUDE_CONFIG_DIRJSDoc, andCONTAINER_CREDENTIALS_TARGETJSDoc now all say "read-write" instead of "read-only". Pushed in69eed9a.Round 2 — APPROVED
All three stale "read-only" comments I flagged in round 1 are fixed in the follow-up commit:
CONTAINER_CLAUDE_CONFIG_DIRJSDoc (line ~62): now says "read-write credential bind target" ✅CONTAINER_CREDENTIALS_TARGETJSDoc (line ~66): now says "read-write credentials bind terminates" ✅CI is green (run #1826,
69eed9a, 3 m 42 s). Good to merge.