diff --git a/container/agent-runner/src/index.ts b/container/agent-runner/src/index.ts index a1af3e5..0be8353 100644 --- a/container/agent-runner/src/index.ts +++ b/container/agent-runner/src/index.ts @@ -407,23 +407,25 @@ async function runQuery( globalClaudeMd = fs.readFileSync(globalClaudeMdPath, 'utf-8'); } - // Discover additional directories mounted at /workspace/extra/* - // These are passed to the SDK so their CLAUDE.md files are loaded automatically + // Discover additional directories const extraDirs: string[] = []; - const extraBase = EXTRA_BASE; - if (fs.existsSync(extraBase)) { - for (const entry of fs.readdirSync(extraBase)) { - const fullPath = path.join(extraBase, entry); - if (fs.statSync(fullPath).isDirectory()) { - extraDirs.push(fullPath); - } - } - } + // When WORK_DIR is set, use it as cwd and include GROUP_DIR as additional directory const effectiveCwd = WORK_DIR || GROUP_DIR; if (WORK_DIR && WORK_DIR !== GROUP_DIR) { extraDirs.push(GROUP_DIR); log(`Work directory override: ${WORK_DIR} (group dir added to additionalDirectories)`); + } else { + // Only scan EXTRA_BASE when no WORK_DIR override (legacy container mount support) + const extraBase = EXTRA_BASE; + if (extraBase && fs.existsSync(extraBase)) { + for (const entry of fs.readdirSync(extraBase)) { + const fullPath = path.join(extraBase, entry); + if (fs.statSync(fullPath).isDirectory()) { + extraDirs.push(fullPath); + } + } + } } if (extraDirs.length > 0) { log(`Additional directories: ${extraDirs.join(', ')}`); diff --git a/src/db.ts b/src/db.ts index f3087f8..56304c3 100644 --- a/src/db.ts +++ b/src/db.ts @@ -130,9 +130,7 @@ function createSchema(database: Database.Database): void { // Add work_dir column if it doesn't exist (migration for per-group working directory) try { - database.exec( - `ALTER TABLE registered_groups ADD COLUMN work_dir TEXT`, - ); + database.exec(`ALTER TABLE registered_groups ADD COLUMN work_dir TEXT`); } catch { /* column already exists */ }