2026-03-15 09:54:27 -07:00
# Maintainer Onboarding: High-Performance Offload System 🚀
Welcome to the Gemini CLI maintainer team! This guide will help you set up your
remote development environment, which offloads heavy tasks (reviews, fixes,
preflight) to a dedicated GCP worker.
## Prerequisites
2026-03-16 15:42:23 -07:00
1. **Google Cloud Access ** : You will need a Google Cloud Project with billing enabled. You can use a shared team project or, **ideally, your own personal GCP project ** for maximum isolation.
2026-03-16 15:40:59 -07:00
2. **GCloud CLI ** : Authenticated locally (`gcloud auth login` ).
3. **GitHub CLI ** : Authenticated locally (`gh auth login` ).
2026-03-16 15:42:23 -07:00
4. **IAP Permissions ** : Ensure you have the `IAP-secured Tunnel User` role on your chosen project.
2026-03-16 15:40:59 -07:00
5. **Corporate Identity ** : Run `gcert` (or your internal equivalent) recently to ensure SSH certificates are valid.
2026-03-15 12:13:11 -07:00
2026-03-16 15:40:59 -07:00
## Architecture: Hybrid VM + Container 🏗️
2026-03-15 12:13:11 -07:00
2026-03-16 15:40:59 -07:00
The offload system uses a **Worker Provider ** architecture to abstract the underlying infrastructure:
2026-03-15 12:13:11 -07:00
2026-03-16 15:40:59 -07:00
1. **GCE VM (Host) ** : A high-performance machine running **Container-Optimized OS (COS) ** .
2. **maintainer-worker (Container) ** : A persistent Docker container acting as your remote workstation.
3. **Resilient Connectivity ** : A dual-path strategy that uses **Fast-Path SSH ** by default and automatically falls back to **IAP Tunneling ** if direct access is blocked.
2026-03-15 12:13:11 -07:00
2026-03-16 15:40:59 -07:00
---
2026-03-15 09:54:27 -07:00
## Setup Workflow
2026-03-16 15:40:59 -07:00
### 1. Initial Configuration (Discovery)
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
This interactive script configures your local environment to recognize the remote worker.
2026-03-15 09:54:27 -07:00
``` bash
2026-03-16 15:40:59 -07:00
npm run offload:setup
2026-03-15 09:54:27 -07:00
```
2026-03-16 15:40:59 -07:00
* **What it does ** : Generates `.gemini/offload_ssh_config` , verifies project access, and establishes the initial identity handshake.
* **Connectivity ** : If direct internal SSH fails, it will attempt to verify access via an IAP tunnel.
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
### 2. Provisioning Your Worker (Infrastructure)
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
Spin up your dedicated, high-performance VM. If it already exists, this command will verify its health.
2026-03-15 09:54:27 -07:00
``` bash
2026-03-16 15:40:59 -07:00
npm run offload:fleet provision
2026-03-15 09:54:27 -07:00
```
2026-03-16 15:40:59 -07:00
* **Specs ** : n2-standard-8, 200GB PD-Balanced disk.
* **Self-Healing ** : It uses a COS startup script to ensure the `maintainer-worker` container is always running.
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
### 3. Remote Initialization
Once provisioned, return to the setup script to finalize the remote environment.
2026-03-15 09:54:27 -07:00
``` bash
2026-03-16 15:40:59 -07:00
npm run offload:setup
2026-03-15 09:54:27 -07:00
```
2026-03-16 15:40:59 -07:00
* **Auth Sync ** : Pushes your `google_accounts.json` to the worker.
* **Scoped Token ** : Generates a magic link for a GitHub PAT and stores it securely on the worker.
* **Repo Clone ** : Performs a filtered (shallow) clone of the repository onto the remote disk.
---
2026-03-15 09:54:27 -07:00
## Daily Workflow
2026-03-16 15:40:59 -07:00
### Running an Offloaded Job
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
To perform a deep behavioral review or an agentic fix on your remote worker:
2026-03-15 09:54:27 -07:00
``` bash
2026-03-16 15:40:59 -07:00
# For a review
2026-03-15 09:54:27 -07:00
npm run offload <PR_NUMBER> review
2026-03-16 15:40:59 -07:00
# For an automated fix
npm run offload <PR_NUMBER> implement
2026-03-15 09:54:27 -07:00
```
2026-03-16 15:40:59 -07:00
* **Isolation ** : Each job runs in a dedicated **Git Worktree ** (`~/dev/worktrees/offload-<id>` ).
* **Persistence ** : Jobs run inside a `tmux` session on the remote host. You can disconnect and reconnect without losing progress.
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
### Monitoring "Mission Control"
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
View the real-time state of your worker and all in-flight jobs:
2026-03-15 09:54:27 -07:00
``` bash
npm run offload:status
```
### Stopping Your Worker
2026-03-16 15:40:59 -07:00
To save costs, shut down your worker when finished. The orchestrator will automatically wake it up when you start a new task.
2026-03-15 09:54:27 -07:00
``` bash
npm run offload:fleet stop
```
2026-03-16 15:40:59 -07:00
---
## Resilience & Troubleshooting
### "SSH Connection Failed"
If the setup or orchestrator reports a connection failure:
1. **Check Identity ** : Run `gcert` to refresh your SSH credentials.
2. **IAP Fallback ** : The system should automatically attempt IAP tunneling. If it still fails, verify your GCP project permissions.
3. **Waking Up ** : If the worker was stopped, the first command may take ~30 seconds to wake the VM.
2026-03-15 09:54:27 -07:00
2026-03-16 15:40:59 -07:00
### "Worker Not Found"
If `offload:setup` can't find your worker, ensure you have run `npm run offload:fleet provision` at least once in the current project.