From e2ad7f4ecbae91a9924e4cf6ba35b3d11c817a3d Mon Sep 17 00:00:00 2001 From: mkorwel Date: Sun, 15 Mar 2026 12:07:50 -0700 Subject: [PATCH] feat(offload): implement persistent container workstation model --- .gemini/skills/offload/scripts/orchestrator.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.gemini/skills/offload/scripts/orchestrator.ts b/.gemini/skills/offload/scripts/orchestrator.ts index 119acee386..c092c3713d 100644 --- a/.gemini/skills/offload/scripts/orchestrator.ts +++ b/.gemini/skills/offload/scripts/orchestrator.ts @@ -58,9 +58,16 @@ export async function runOrchestrator(args: string[], env: NodeJS.ProcessEnv = p `; spawnSync(`ssh ${remoteHost} ${q(setupCmd)}`, { shell: true, stdio: 'inherit' }); - // 4. Execution Logic (Persistent OS Mode) + // 4. Execution Logic (Persistent Workstation Mode) + // We use docker exec if container mode is enabled, otherwise run on host. const remoteWorker = `tsx ${persistentScripts}/entrypoint.ts ${prNumber} remote-branch ${remotePolicyPath} ${action}`; - const tmuxCmd = `cd ${remoteWorktreeDir} && ${remoteWorker}; exec $SHELL`; + + let tmuxCmd = `cd ${remoteWorktreeDir} && ${remoteWorker}; exec $SHELL`; + if (useContainer) { + // If in container mode, we jump into the shared 'gemini-sandbox' container + // We must use -i and -t for the interactive tmux session + tmuxCmd = `docker exec -it -w /home/node/dev/worktrees/offload-${prNumber}-${action} gemini-sandbox sh -c "${remoteWorker}; exec $SHELL"`; + } const sshInternal = `tmux attach-session -t ${sessionName} 2>/dev/null || tmux new-session -s ${sessionName} -n 'offload' ${q(tmuxCmd)}`; const finalSSH = `ssh -t ${remoteHost} ${q(sshInternal)}`;