Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript

fix(byoa): make Gemini pairing and triage safe (#101)

LILACeb464b66af5a
diff --git a/docs/BYOA.md b/docs/BYOA.md
index f4c95ba..b3d96d3 100644
--- a/docs/BYOA.md
+++ b/docs/BYOA.md
@@ -212,7 +212,7 @@ interface EngineSession {
| One-shot fallback | `claude -p … --output-format stream-json` | `codex exec … --skip-git-repo-check` | `grok -p … --output-format streaming-messages-json` | `cursor-agent -p --output-format stream-json --force --trust [--resume <id>]` | `opencode run --format json --auto [--session <id>] [--model provider/model]` (prompt on stdin) | `pi <CUMORA_PI_ARGS> --session-id <id> -p` (print mode) | `gemini --output-format stream-json --yolo [--resume <uuid>] [--model X]` (prompt on stdin; `GEMINI_CLI_TRUST_WORKSPACE=true`) |
| Fallback triggers | `CUMORA_CLAUDE_ARGS` set | `CUMORA_CODEX_ARGS` set, `CUMORA_CODEX_NO_APP_SERVER=1`, Windows, or git-init failure | `CUMORA_GROK_ARGS` set, `CUMORA_GROK_NO_ACP=1`, or Windows | always one-shot; `CUMORA_CURSOR_ARGS` overrides flags | always one-shot; `CUMORA_OPENCODE_ARGS` overrides run flags | `CUMORA_PI_ARGS` set | always one-shot; `CUMORA_GEMINI_ARGS` overrides run flags |
| Memory / persona file | `CLAUDE.md` | `AGENTS.md` | `AGENTS.md` | `AGENTS.md` | `AGENTS.md` plus `.opencode/skills/` | `AGENTS.md` plus `.pi/skills/` (loaded via `--skill`) | `GEMINI.md` plus `.gemini/skills/` |
-| Triage (small brain) | `claude -p --model haiku --output-format json` | `codex exec --model gpt-5.4-mini` | `grok -p --model grok-4.5 --output-format json` | `cursor-agent --mode ask -p --output-format stream-json --trust` | `opencode run --format json --agent cumora-triage`; the injected agent denies every tool permission | `pi --mode json --no-session --no-tools --no-extensions --no-skills --no-context-files [--model $CUMORA_TRIAGE_MODEL]` (multi-provider — no fixed cheap model; unset → pi's default) | `gemini --output-format stream-json --model gemini-2.5-flash-lite` with a system-settings file setting `tools.core: []`, which registers no tool at all |
+| Triage (small brain) | `claude -p --model haiku --output-format json` | `codex exec --model gpt-5.4-mini` | `grok -p --model grok-4.5 --output-format json` | `cursor-agent --mode ask -p --output-format stream-json --trust` | `opencode run --format json --agent cumora-triage`; the injected agent denies every tool permission | `pi --mode json --no-session --no-tools --no-extensions --no-skills --no-context-files [--model $CUMORA_TRIAGE_MODEL]` (multi-provider — no fixed cheap model; unset → pi's default) | `gemini --output-format stream-json --model gemini-2.5-flash-lite` with system settings `tools.core: []` and `mcp.allowed: []`, blocking built-in and user/extension MCP tools |
Sessions carry a resume id (`~/.cumora/sessions/<agentId>.session`); a
failed resume falls back to a fresh thread instead of wedging the agent.
diff --git a/server/src/__tests__/agents-computer-engine-detect.test.ts b/server/src/__tests__/agents-computer-engine-detect.test.ts
index a57336c..95ed09b 100644
--- a/server/src/__tests__/agents-computer-engine-detect.test.ts
+++ b/server/src/__tests__/agents-computer-engine-detect.test.ts
@@ -45,11 +45,12 @@ after(async () => {
test('sanitizeDetectedEngines drops unknown ids and fills missing bins', () => {
const out = registry.sanitizeDetectedEngines(
[{ id: 'claude', bin: 'claude', path: '/usr/bin/claude' }, { id: 'bogus', bin: 'x', path: null }],
- ['claude', 'codex', 'bogus'],
+ ['claude', 'codex', 'gemini', 'bogus'],
)
assert.deepEqual(out, [
{ id: 'claude', bin: 'claude', path: '/usr/bin/claude' },
{ id: 'codex', bin: 'codex', path: null },
+ { id: 'gemini', bin: 'gemini', path: null },
])
})
diff --git a/server/src/__tests__/agents-computer-engine-gemini.test.ts b/server/src/__tests__/agents-computer-engine-gemini.test.ts
index f120680..7972539 100644
--- a/server/src/__tests__/agents-computer-engine-gemini.test.ts
+++ b/server/src/__tests__/agents-computer-engine-gemini.test.ts
@@ -298,12 +298,11 @@ test('triage runs tool-free on the cheap model', { skip: IS_WIN }, async () => {
assert.equal(call.argv[call.argv.indexOf('--model') + 1], 'gemini-2.5-flash-lite')
assert.ok(call.settingsPath, 'triage must point gemini at a settings file')
- // `tools.core` is an allowlist applied per tool as `coreTools.some(...)`. An
- // empty array is truthy and matches nothing, so NO core tool is registered —
- // and with no tool to confirm, a headless approval prompt that nothing would
- // answer cannot arise.
+ // Core tools and user/extension MCP tools are separate registries. Empty
+ // allowlists at system scope close both paths, including MCP servers inherited
+ // from the operator's user settings.
const settings = JSON.parse(await readFile(call.settingsPath as string, 'utf8'))
- assert.deepEqual(settings, { tools: { core: [] } })
+ assert.deepEqual(settings, { tools: { core: [] }, mcp: { allowed: [] } })
})
test('concurrent triage shares one cwd cleanly and leaves no staging files', { skip: IS_WIN }, async () => {
diff --git a/server/src/__tests__/computer-engine-redetect.test.ts b/server/src/__tests__/computer-engine-redetect.test.ts
index c04cdb1..c74d7c0 100644
--- a/server/src/__tests__/computer-engine-redetect.test.ts
+++ b/server/src/__tests__/computer-engine-redetect.test.ts
@@ -69,13 +69,13 @@ test('an unchanged empty list writes nothing', () => {
test('a detection of only unknown ids is treated as empty', () => {
// A newer daemon reporting an engine this server has no adapter for must not
// clear the list either.
- assert.equal(mergeDetectedEngines(['claude'], ['gemini', 'hermes']), null)
+ assert.equal(mergeDetectedEngines(['claude'], ['qwen', 'hermes']), null)
})
test('unknown ids are filtered out but known ones still apply', () => {
assert.deepEqual(
mergeDetectedEngines(['claude'], ['claude', 'gemini', 'opencode']),
- ['claude', 'opencode'],
+ ['claude', 'gemini', 'opencode'],
)
})
diff --git a/server/src/agents/computer/engine.ts b/server/src/agents/computer/engine.ts
index be4bf4d..1ed0ff2 100644
--- a/server/src/agents/computer/engine.ts
+++ b/server/src/agents/computer/engine.ts
@@ -3614,10 +3614,13 @@ async function spawnGeminiStream(
*
* `tools.core` is an allowlist, and the registry applies it as
* `coreTools.some(...)` per tool — an EMPTY array is truthy, matches nothing,
- * and so registers nothing. That is a stronger guarantee than triage gets on
- * other engines: with no tool to confirm, a headless approval prompt (which
- * nothing would answer) cannot arise, and the classifier stays a one-shot. */
-const GEMINI_TRIAGE_SETTINGS = JSON.stringify({ tools: { core: [] } })
+ * and so registers no built-in tools. User settings and installed extensions
+ * can also contribute MCP servers; the system-scope empty MCP allowlist joins
+ * every configured allowlist by intersection, so none of those servers can
+ * register tools either. With no tool to confirm, a headless approval prompt
+ * (which nothing would answer) cannot arise, and the classifier stays a
+ * one-shot. */
+const GEMINI_TRIAGE_SETTINGS = JSON.stringify({ tools: { core: [] }, mcp: { allowed: [] } })
const GEMINI_TRIAGE_SETTINGS_FILE = '.cumora-gemini-triage.json'
class GeminiAdapter implements EngineAdapter {
diff --git a/server/src/agents/computer/registry.ts b/server/src/agents/computer/registry.ts
index 0e76c74..a31551a 100644
--- a/server/src/agents/computer/registry.ts
+++ b/server/src/agents/computer/registry.ts
@@ -45,7 +45,7 @@ export async function announceComputerOnline(computerId: string, companyId: stri
}
/** Engines a paired (non-cloud) computer is allowed to advertise. */
-const PAIRABLE_ENGINES: ReadonlySet<string> = new Set(['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi'])
+const PAIRABLE_ENGINES: ReadonlySet<string> = new Set(['claude', 'codex', 'grok', 'cursor', 'opencode', 'pi', 'gemini'])
/** Merge a fresh PATH detection into a computer's advertised engine list.
*
@@ -85,6 +85,7 @@ const ENGINE_BINS: Record<string, string> = {
cursor: 'cursor-agent',
opencode: 'opencode',
pi: 'pi',
+ gemini: 'gemini',
}
/** Cached PATH snapshot from the daemon. The app reads this; it never probes. */
diff --git a/src/desktop/MeView.tsx b/src/desktop/MeView.tsx
index dd9964b..f6a56c7 100644
--- a/src/desktop/MeView.tsx
+++ b/src/desktop/MeView.tsx
@@ -853,7 +853,7 @@ function ComputersTab() {
// Engine for a NEWLY added computer's starter/assigned agents. Claude is the
// default (no flag → daemon auto-detects); every other pick is named
// explicitly, or the daemon auto-detects and engines[0] silently wins.
- const [engine, setEngine] = useState<'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi'>('claude')
+ const [engine, setEngine] = useState<'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini'>('claude')
// Default on: install the always-on service (auto-start/restart/update).
const [asService, setAsService] = useState(true)
// Per-computer re-pair (reconnect) command, keyed by computer id.
@@ -1172,7 +1172,7 @@ function ComputersTab() {
<div className="flex items-center gap-2.5 mb-2.5">
<span className="text-[12px] text-ink-500">{t('me.engineLabel')}</span>
<div className="inline-flex rounded-[9px] p-0.5" style={{ background: 'var(--ink-100)' }}>
- {([['claude', 'Claude Code'], ['codex', 'Codex'], ['grok', 'Grok Build'], ['cursor', 'Cursor'], ['opencode', 'OpenCode'], ['pi', 'pi']] as const).map(([id, label]) => (
+ {([['claude', 'Claude Code'], ['codex', 'Codex'], ['grok', 'Grok Build'], ['cursor', 'Cursor'], ['opencode', 'OpenCode'], ['pi', 'pi'], ['gemini', 'Gemini']] as const).map(([id, label]) => (
<button key={id} type="button" onClick={() => setEngine(id)}
className="px-3 py-1 rounded-[7px] text-[12px] font-semibold transition-colors duration-150"
style={engine === id
diff --git a/src/desktop/Onboarding.tsx b/src/desktop/Onboarding.tsx
index 936ce83..28563c0 100644
--- a/src/desktop/Onboarding.tsx
+++ b/src/desktop/Onboarding.tsx
@@ -21,7 +21,7 @@ export function Onboarding() {
// Claude is the default; ANY other pick must be named explicitly. We DON'T
// append `--engine claude` so a Claude-less machine still auto-detects rather
// than erroring on a Claude it doesn't have.
- const [engine, setEngine] = useState<'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi'>('claude')
+ const [engine, setEngine] = useState<'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini'>('claude')
// Default to installing the always-on service: it auto-starts at sign-in,
// auto-restarts on crash, and auto-updates — so the user isn't tied to a
// terminal that must stay open. Appends `--install-service` to the command.
@@ -87,7 +87,7 @@ export function Onboarding() {
<div className="flex items-center gap-2.5 mb-2.5">
<span className="text-[12px] text-ink-500">{t('onboard.engine')}</span>
<div className="inline-flex rounded-[9px] p-0.5" style={{ background: 'var(--ink-100)' }}>
- {([['claude', 'Claude Code'], ['codex', 'Codex'], ['grok', 'Grok Build'], ['cursor', 'Cursor'], ['opencode', 'OpenCode'], ['pi', 'pi']] as const).map(([id, label]) => (
+ {([['claude', 'Claude Code'], ['codex', 'Codex'], ['grok', 'Grok Build'], ['cursor', 'Cursor'], ['opencode', 'OpenCode'], ['pi', 'pi'], ['gemini', 'Gemini']] as const).map(([id, label]) => (
<button key={id} type="button" onClick={() => setEngine(id)}
className="px-3 py-1 rounded-[7px] text-[12px] font-semibold transition-colors duration-150"
style={engine === id