From aed051fb9678646b2e999d8e410f99a1fc1230e0 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Wed, 11 Mar 2026 16:49:09 +0900 Subject: [PATCH] fix: sync ~/.claude/.credentials.json to per-group session dirs Without this, per-group credentials become stale when the home credentials are refreshed elsewhere, causing 401 auth errors. --- src/container-runner.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/container-runner.ts b/src/container-runner.ts index 4ebaa90..a22f8b5 100644 --- a/src/container-runner.ts +++ b/src/container-runner.ts @@ -62,6 +62,14 @@ function prepareGroupEnvironment( '.claude', ); fs.mkdirSync(groupSessionsDir, { recursive: true }); + + // Sync credentials from user's home ~/.claude/ so per-group sessions stay fresh + const homeClaudeDir = path.join(os.homedir(), '.claude'); + const credsSrc = path.join(homeClaudeDir, '.credentials.json'); + if (fs.existsSync(credsSrc)) { + fs.copyFileSync(credsSrc, path.join(groupSessionsDir, '.credentials.json')); + } + const settingsFile = path.join(groupSessionsDir, 'settings.json'); if (!fs.existsSync(settingsFile)) { fs.writeFileSync(