Skip to content

Sandboxed Claude keeps its login in a relay-owned config folder (#181) - #503

Merged
barelyworkingcode merged 3 commits into
mainfrom
fix/181-login-store
Oct 19, 2026
Merged

barelyworkingcode merged 3 commits into
mainfrom
fix/181-login-store

Conversation

@barelyworkingcode

Copy link
Copy Markdown
Owner

Closes #181

Sandboxed Claude launches (a claude session and a sandboxed claude-code terminal) now run with CLAUDE_CONFIG_DIR set to a relay-owned folder, <user config dir>/relay/sandbox-claude. The profile grants that folder read-write, so Claude Code keeps and refreshes its login there instead of hitting the keychain write the sandbox refuses. Unsandboxed and SSH-host launches are unchanged. A key the template's env sets still wins.

Relay creates the folder at launch, mode 0700, and seeds it with links to ~/.claude's settings.json, CLAUDE.md, skills, agents, commands, projects and sessions. It never links .credentials.json or .claude.json, and never overwrites an entry that is already there. A path that isn't a real directory refuses the launch with sandbox_unavailable, and the message names the path. The keychain grants are unchanged.

What you'll notice: every sandboxed Claude is logged out once. Run /login once in any sandboxed Claude. The folder is shared, so that one login covers Relay.app, every verify stack and the nightly. The folder does not move with --config-dir. Until that login, the nightly's five sandboxed-Claude screen journeys (session-agent-state, session-drop-in, session-drop-in-tool-refused, chief-of-staff-send, cos-start) fail. That is a known limitation, not a regression in this code.

Not proven here, by owner decision: a live /login in the sandbox and a refresh past the 8-hour token lifetime. The owner verifies those through daily use.

Roll back: revert this PR's merge commit. Sandboxed Claude then reads the keychain login again. The folder can stay or be deleted by hand.

Docs: docs/session-host.md (new subsection and grant row), docs/FEATURES.md row G1.44, docs/testing.md.

Fix attempts: 1 (plus one comment-only round from review). Tokens: about 0.6M across subagents.

Review: no blocking findings (default model, round 1; two comment nits fixed in 80db98c; two theoretical items logged in the run report)
Red on main: TestBug181SandboxedClaudeSessionConfigDir fails on main 448d6e1 at bug181_sandboxed_claude_login_test.go:91 (CLAUDE_CONFIG_DIR = ""); TestBug181SandboxClaudeDirSeeded fails at :179 (folder missing)
Real-app check: relay sandbox claude-code on the head's bundle (stack r181) started a real sandboxed Claude, which wrote .claude.json, cache and backups into the new folder; links seeded, no credentials file; before (main): no such folder, CLAUDE_CONFIG_DIR unset
Journey: n/a: the change is reached only by a logged-in sandboxed Claude, which the nightly's existing screen journeys cover; the stack's api phase ran unchanged (pass=5 fail=0 blocked=0 notrun=2)
Break-and-restore: dropped the folder's read-write grant in sandboxSpecForLaunch; TestBug181SandboxClaudeDirWritable went red (write inside the folder exit 1); restored byte for byte

Run report: barelyworkingcode/claude-process#55

🤖 Generated with Claude Code

barelyworkingcode and others added 3 commits October 19, 2026 08:11
…older

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@barelyworkingcode

Copy link
Copy Markdown
Owner Author

Verified: 80db98c · repo-suite: ok relaye2e/features 490.389s · devboxverify: SUMMARY pass=5 fail=0 blocked=0 notrun=2 (stack r181, --phase api) · real-app: PASS (relay sandbox claude-code; real Claude wrote into the new folder, links seeded, no credentials file) · log: devbox:/tmp/r181-stack.log

@barelyworkingcode
barelyworkingcode merged commit b1d0e2f into main Oct 19, 2026
@barelyworkingcode
barelyworkingcode deleted the fix/181-login-store branch October 19, 2026 15:38
@barelyworkingcode

Copy link
Copy Markdown
Owner Author

Merged under merge-check: approved, target, verified, contract, evidence, owner and weakening PASS; ci NA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sandboxed Claude session loses login after token expiry; auto-update fails

1 participant