diff --git a/.gemini/skills/workspaces/scripts/orchestrator.ts b/.gemini/skills/workspaces/scripts/orchestrator.ts index 4fd6dfe857..cd7f54a804 100644 --- a/.gemini/skills/workspaces/scripts/orchestrator.ts +++ b/.gemini/skills/workspaces/scripts/orchestrator.ts @@ -77,18 +77,19 @@ export async function runOrchestrator(args: string[], env: NodeJS.ProcessEnv = p if (check.status !== 0) { console.log(` - Provisioning isolated git worktree for ${prNumber}...`); - // We run these on the host. We use the current remote user to ensure ownership is correct. + // We run these on the host. Since setup might have left the repo root-owned, we use sudo. const gitFetch = isShellMode - ? `git -C ${hostWorkDir} fetch --quiet origin` - : `git -C ${hostWorkDir} fetch --quiet upstream pull/${prNumber}/head`; + ? `sudo git -C ${hostWorkDir} fetch --quiet origin` + : `sudo git -C ${hostWorkDir} fetch --quiet upstream pull/${prNumber}/head`; const gitTarget = isShellMode ? 'FETCH_HEAD' : 'FETCH_HEAD'; const setupCmd = ` - git -C ${hostWorkDir} config --add safe.directory ${hostWorkDir} && \ - mkdir -p ${hostWorkspaceRoot}/worktrees && \ + sudo git config --global --add safe.directory ${hostWorkDir} && \ + sudo mkdir -p ${hostWorkspaceRoot}/worktrees && \ ${gitFetch} && \ - git -C ${hostWorkDir} worktree add --quiet -f ${hostWorktreeDir} ${gitTarget} 2>&1 + sudo git -C ${hostWorkDir} worktree add --quiet -f ${hostWorktreeDir} ${gitTarget} 2>&1 && \ + sudo chown -R 1000:1000 ${hostWorkspaceRoot} `; const setupRes = await provider.getExecOutput(setupCmd); if (setupRes.status !== 0) { diff --git a/.gemini/skills/workspaces/scripts/setup.ts b/.gemini/skills/workspaces/scripts/setup.ts index 59b2886291..bd850e0d6a 100644 --- a/.gemini/skills/workspaces/scripts/setup.ts +++ b/.gemini/skills/workspaces/scripts/setup.ts @@ -288,8 +288,8 @@ and full builds) to a dedicated, high-performance GCP worker. const setupRes = await provider.setup({ projectId, zone, dnsSuffix: '.internal.gcpnode.com' }); if (setupRes !== 0) return setupRes; - // Use the direct mount path to avoid symlink race conditions - const workspaceRoot = `/mnt/disks/data`; + // Use the unified path to ensure host and container match perfectly + const workspaceRoot = `/home/node/.workspaces`; const persistentScripts = `${workspaceRoot}/scripts`; const remoteConfigDir = `${workspaceRoot}/gemini-cli-config/.gemini`; @@ -297,7 +297,7 @@ and full builds) to a dedicated, high-performance GCP worker. console.log(`\n📦 Synchronizing Logic & Credentials...`); // Ensure the directory structure exists on the host await provider.exec(`sudo mkdir -p ${workspaceRoot}/main ${workspaceRoot}/worktrees ${workspaceRoot}/policies ${workspaceRoot}/scripts ${remoteConfigDir}`); - await provider.exec(`sudo chown -R $(whoami):$(whoami) ${workspaceRoot}`); + await provider.exec(`sudo chown -R 1000:1000 ${workspaceRoot}`); await provider.exec(`sudo chmod -R 777 ${workspaceRoot}`); // 1. Sync Scripts & Policies @@ -371,7 +371,7 @@ and full builds) to a dedicated, high-performance GCP worker. // Final Repo Sync console.log(`🚀 Finalizing Remote Repository (${userFork})...`); const repoUrl = `https://github.com/${userFork}.git`; - const cloneCmd = `sudo rm -rf ${workspaceRoot}/main && sudo git clone --quiet --filter=blob:none ${repoUrl} ${workspaceRoot}/main && sudo git -C ${workspaceRoot}/main remote add upstream https://github.com/${upstreamRepo}.git && sudo git -C ${workspaceRoot}/main fetch --quiet upstream && sudo chown -R $(whoami):$(whoami) ${workspaceRoot}`; + const cloneCmd = `sudo rm -rf ${workspaceRoot}/main && sudo git clone --quiet --filter=blob:none ${repoUrl} ${workspaceRoot}/main && sudo git -C ${workspaceRoot}/main remote add upstream https://github.com/${upstreamRepo}.git && sudo git -C ${workspaceRoot}/main fetch --quiet upstream && sudo chown -R 1000:1000 ${workspaceRoot}`; await provider.exec(cloneCmd); console.log('\n✨ ALL SYSTEMS GO! Your Gemini Workspace is ready.');