Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): make a failed agy probe visible and stop lying about clamped effort

[._.]/ Adam Eivy8664148e5d51
diff --git a/client/src/components/cos/EffortSelect.jsx b/client/src/components/cos/EffortSelect.jsx
index 3a4139657e..65731bb05c 100644
--- a/client/src/components/cos/EffortSelect.jsx
+++ b/client/src/components/cos/EffortSelect.jsx
@@ -1,5 +1,5 @@
import { useId } from 'react';
-import { effortLevelsForProvider } from '../../utils/providers';
+import { effortLevelsForProvider, resolveCliEffort } from '../../utils/providers';
import { FormField } from '../ui/FormField';
/**
@@ -39,6 +39,17 @@ export default function EffortSelect({
const levels = effortLevelsForProvider(provider);
if (!levels) return null;
+ // A stored effort can sit outside this provider's ladder — a task/stage
+ // pinned to claude `max` whose provider was later switched to Antigravity
+ // (which stops at `high`). The server CLAMPS rather than drops it, so the run
+ // still gets an `--effort`. Render an explicit option naming both the stored
+ // value and what it resolves to, or the select would hold a value matching no
+ // option, render blank (reading as "Default effort"), and hide the fact that
+ // the run uses the clamped level. Mirrors the stale-model option the pipeline
+ // stage's Model select already renders.
+ const outOfLadder = value && !levels.includes(value) ? value : null;
+ const clamped = outOfLadder ? resolveCliEffort(outOfLadder, provider) : null;
+
const select = (
<select
id={id}
@@ -50,6 +61,11 @@ export default function EffortSelect({
aria-label={label ? undefined : 'Thinking effort'}
>
<option value="">Default effort</option>
+ {outOfLadder && (
+ <option value={outOfLadder}>
+ {clamped ? `${outOfLadder} (runs as ${clamped})` : `${outOfLadder} (not supported — ignored)`}
+ </option>
+ )}
{levels.map(level => (
<option key={level} value={level}>{level}</option>
))}
diff --git a/client/src/components/cos/EffortSelect.test.jsx b/client/src/components/cos/EffortSelect.test.jsx
new file mode 100644
index 0000000000..ab5ed806cc
--- /dev/null
+++ b/client/src/components/cos/EffortSelect.test.jsx
@@ -0,0 +1,63 @@
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import EffortSelect from './EffortSelect';
+
+const CLAUDE = { id: 'claude-code', command: 'claude' };
+const AGY = { id: 'antigravity-cli', command: 'agy' };
+const CODEX = { id: 'codex', command: 'codex' };
+const GROK = { id: 'grok-cli', command: 'grok' };
+
+describe('EffortSelect', () => {
+ it('renders nothing for a provider with no effort control', () => {
+ const { container } = render(<EffortSelect provider={GROK} value="" onChange={() => {}} />);
+ expect(container).toBeEmptyDOMElement();
+ });
+
+ it('offers agy its narrower low|medium|high ladder', () => {
+ render(<EffortSelect provider={AGY} value="" onChange={() => {}} />);
+ expect(screen.getAllByRole('option').map(o => o.textContent))
+ .toEqual(['Default effort', 'low', 'medium', 'high']);
+ });
+
+ it('offers codex its full ladder', () => {
+ render(<EffortSelect provider={CODEX} value="" onChange={() => {}} />);
+ expect(screen.getAllByRole('option').map(o => o.textContent))
+ .toEqual(['Default effort', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra']);
+ });
+
+ // The server clamps an out-of-ladder effort rather than dropping it, so the
+ // run still gets an `--effort`. Without an option matching the stored value
+ // the select renders blank — indistinguishable from "Default effort" — while
+ // the run silently uses the clamped level.
+ it('surfaces a stored effort outside the provider ladder, naming what it runs as', () => {
+ render(<EffortSelect provider={AGY} value="max" onChange={() => {}} />);
+ expect(screen.getByRole('combobox')).toHaveValue('max');
+ expect(screen.getByRole('option', { name: 'max (runs as high)' })).toBeInTheDocument();
+ });
+
+ it('clamps down to the nearest supported level, not the nearest by name', () => {
+ render(<EffortSelect provider={AGY} value="minimal" onChange={() => {}} />);
+ // Nothing sits below `minimal`, so it falls back to the weakest level.
+ expect(screen.getByRole('option', { name: 'minimal (runs as low)' })).toBeInTheDocument();
+ });
+
+ it('says an unrecognized effort is ignored rather than implying it runs', () => {
+ render(<EffortSelect provider={AGY} value="bogus" onChange={() => {}} />);
+ expect(screen.getByRole('option', { name: 'bogus (not supported — ignored)' })).toBeInTheDocument();
+ });
+
+ it('does not add the extra option when the stored value is in the ladder', () => {
+ render(<EffortSelect provider={CLAUDE} value="xhigh" onChange={() => {}} />);
+ const options = screen.getAllByRole('option').map(o => o.textContent);
+ expect(options).toEqual(['Default effort', 'low', 'medium', 'high', 'xhigh', 'max']);
+ expect(screen.getByRole('combobox')).toHaveValue('xhigh');
+ });
+
+ it('reports the raw selection so the caller stores what the user picked', async () => {
+ const onChange = vi.fn();
+ render(<EffortSelect provider={AGY} value="" onChange={onChange} />);
+ await userEvent.selectOptions(screen.getByRole('combobox'), 'medium');
+ expect(onChange).toHaveBeenCalledWith('medium');
+ });
+});
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index abf17ce249..d58d05136d 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -39,7 +39,7 @@ grep -i "what you want to do" client/src/utils/README.md
| `urlNormalize` | `isUrl` detection, `normalizeUrl` (optional git/`requireDot` modes), and `isHttpUrl` (explicit http(s) only — safe-href check). |
| `platform` | `isMac` detection and `modKey` (⌘/Ctrl) for keyboard-shortcut display. |
| `navWorkingSet` | Recent/pinned nav persistence (`recordVisit`, `togglePin`, `isPinned`) plus `resolveRecentNavEntries` for mapping stored deep links back to their longest matching nav-manifest entry. |
-| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isAntigravityProvider`, `filterSelectableModels`, `configuredDefaultIn` — the sentinel a provider's catalog carries, so a picker can render an option matching a sentinel-valued tier instead of a blank select — `getProviderTimeout`, configured-default sentinels, and the claude/codex/agy thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). |
+| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isAntigravityProvider`, `filterSelectableModels`, `resolveCliEffort` (mirror — what a stored effort actually runs as, so the picker can name a clamped level), `configuredDefaultIn` — the sentinel a provider's catalog carries, so a picker can render an option matching a sentinel-valued tier instead of a blank select — `getProviderTimeout`, configured-default sentinels, and the claude/codex/agy thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). |
| `layeredIntelligenceReasons` | Canonical gloss for the Layered Intelligence loop's run-outcome reason tokens, shared by the on-demand toast and the durable "Last run" line (`formatLiReason`, `liReasonTone`, `LI_NEUTRAL_REASONS`). |
## Module loading / resilience
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index bcf9f306f4..2475012727 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -177,6 +177,37 @@ export const effortLevelsForProvider = (provider) => {
return null;
};
+// Every effort value any CLI accepts, weakest→strongest. MIRROR of EFFORT_RANK
+// in server/lib/providerModels.js — keep in lockstep.
+const EFFORT_RANK = Object.freeze(['minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra']);
+
+/**
+ * The level a stored effort will ACTUALLY run at on this provider, or null when
+ * no flag is emitted. MIRROR of `resolveCliEffort` in
+ * server/lib/providerModels.js — keep in lockstep.
+ *
+ * The UI needs this because the server clamps an out-of-ladder effort rather
+ * than dropping it: a stage pinned to claude `max` and switched to Antigravity
+ * (whose ladder stops at `high`) still runs, at `high`. Without this the select
+ * holds a value matching no option, renders blank — reading as "Default effort"
+ * — while the run silently uses the clamped level.
+ * @param {string|null|undefined} effort
+ * @param {{id?:string, command?:string}|null|undefined} provider
+ * @returns {string|null}
+ */
+export const resolveCliEffort = (effort, provider) => {
+ if (!effort) return null;
+ const levels = effortLevelsForProvider(provider);
+ if (!levels) return null;
+ if (levels.includes(effort)) return effort;
+ const requested = EFFORT_RANK.indexOf(effort);
+ if (requested === -1) return null;
+ const supported = levels.map(l => EFFORT_RANK.indexOf(l)).filter(i => i !== -1).sort((a, b) => a - b);
+ if (supported.length === 0) return null;
+ const below = supported.filter(i => i < requested);
+ return EFFORT_RANK[below.length ? below[below.length - 1] : supported[0]];
+};
+
/**
* Embedding-only model detector — mirror of `isEmbeddingModel` in
* server/lib/localModelHeuristics.js. Keep the two regexes in lockstep (the
diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.js
index 73ab7dd4d3..b7a786d4ab 100644
--- a/client/src/utils/providers.test.js
+++ b/client/src/utils/providers.test.js
@@ -36,6 +36,7 @@ import {
isKimiProvider,
isAntigravityProvider,
effortLevelsForProvider,
+ resolveCliEffort,
CLAUDE_EFFORT_LEVELS,
CODEX_EFFORT_LEVELS,
ANTIGRAVITY_EFFORT_LEVELS,
@@ -50,8 +51,37 @@ import { PROVIDER_TYPES as SERVER_PROVIDER_TYPES } from '../../../server/lib/aiT
import {
effortLevelsForProvider as serverEffortLevelsForProvider,
isAntigravityProvider as serverIsAntigravityProvider,
+ resolveCliEffort as serverResolveCliEffort,
} from '../../../server/lib/providerModels.js';
+// The client copy drives what EffortSelect DISPLAYS; the server copy decides
+// what the CLI actually receives. Any drift means the UI names a level the run
+// won't use, so every case is asserted against both implementations.
+describe('resolveCliEffort (server mirror)', () => {
+ const AGY = { id: 'antigravity-cli', command: 'agy' };
+ const CLAUDE = { id: 'claude-code', command: 'claude' };
+ const CODEX = { id: 'codex', command: 'codex' };
+ const GROK = { id: 'grok-cli', command: 'grok' };
+
+ it.each([
+ ['supported value passes through', 'medium', AGY, 'medium'],
+ ['above agy ladder clamps down', 'xhigh', AGY, 'high'],
+ ['max clamps to agy high', 'max', AGY, 'high'],
+ ['ultra clamps to agy high', 'ultra', AGY, 'high'],
+ ['below agy ladder takes the weakest', 'minimal', AGY, 'low'],
+ ['codex-only ultra clamps on claude', 'ultra', CLAUDE, 'max'],
+ ['codex-only minimal clamps on claude', 'minimal', CLAUDE, 'low'],
+ ['codex accepts its whole ladder', 'ultra', CODEX, 'ultra'],
+ ['unknown value yields no flag', 'bogus', AGY, null],
+ ['effort-less provider yields no flag', 'high', GROK, null],
+ ['unset yields no flag', '', AGY, null],
+ ['null yields no flag', null, CLAUDE, null],
+ ])('%s', (_label, effort, provider, expected) => {
+ expect(resolveCliEffort(effort, provider)).toBe(expected);
+ expect(serverResolveCliEffort(effort, provider)).toBe(expected);
+ });
+});
+
// These drive the Effort/model pickers in the CoS task + schedule forms. The
// client copy is a hand-mirror of server/lib/providerModels.js (the client can't
// import server modules at runtime), so pin both sides together here.
diff --git a/server/lib/aiToolkit/providers.js b/server/lib/aiToolkit/providers.js
index 6b3b4fb408..e694f285a2 100644
--- a/server/lib/aiToolkit/providers.js
+++ b/server/lib/aiToolkit/providers.js
@@ -226,6 +226,24 @@ function migrateCodexProvider(data) {
return changed;
}
+// Remove a `--model <id>` / `--model=<id>` pin (both spellings) from a legacy
+// Gemini-CLI argv being converted to agy. Only the legacy migration wants this —
+// on the spawn paths a long-form `--model` is a legitimate agy pin and is kept.
+function stripLegacyModelPin(args) {
+ const out = [];
+ for (let i = 0; i < args.length; i++) {
+ const arg = args[i];
+ if (arg === '--model') {
+ const next = args[i + 1];
+ if (typeof next === 'string' && !next.startsWith('-')) i += 1; // skip its value
+ continue;
+ }
+ if (typeof arg === 'string' && arg.startsWith('--model=')) continue;
+ out.push(arg);
+ }
+ return out;
+}
+
function migrateAntigravityProviders(data) {
if (!data?.providers) return false;
let changed = false;
@@ -241,6 +259,14 @@ function migrateAntigravityProviders(data) {
if (!data.providers[mapping.targetId]) {
const envVars = { ...(legacy.envVars || {}) };
delete envVars.GEMINI_SANDBOX;
+ // Drop any `--model` the legacy argv pinned BEFORE normalizing. The arg
+ // builders deliberately preserve a long-form `--model` (agy accepts it,
+ // so a pin is a real user selection) — but this argv came from the
+ // *Gemini* CLI, so its pin is a Gemini id (`gemini-2.5-pro`) that agy
+ // cannot resolve. Carrying it over would both break every run AND make
+ // `hasModelFlag` permanently suppress PortOS's own injection, leaving the
+ // user no way to fix it short of hand-editing the provider args.
+ const legacyArgs = stripLegacyModelPin(legacy.args || []);
const migrated = {
...legacy,
id: mapping.targetId,
@@ -248,8 +274,8 @@ function migrateAntigravityProviders(data) {
type: mapping.type,
command: 'agy',
args: mapping.type === 'cli'
- ? ensureAntigravityPrintArgs(legacy.args || [])
- : ensureAntigravityTuiArgs(legacy.args || []),
+ ? ensureAntigravityPrintArgs(legacyArgs)
+ : ensureAntigravityTuiArgs(legacyArgs),
models: [...ANTIGRAVITY_MODEL_CATALOG],
timeout: legacy.timeout || mapping.timeout,
envVars,
@@ -815,7 +841,12 @@ export function createProviderService(config = {}) {
return await this._fetchAnthropicModels(provider);
}
- if (providerName.includes('antigravity') || provider.command === 'agy') {
+ // Path/exe-tolerant (`isAntigravityCommand`, not `command === 'agy'`) so a
+ // provider configured with the absolute binary path still refreshes —
+ // otherwise the client's `isAntigravityProvider` gate offers the Refresh
+ // button and every click falls through to the throw below. Matches the
+ // TUI branch in refreshProviderModels.
+ if (providerName.includes('antigravity') || isAntigravityCommand(provider.command)) {
return await this._fetchAntigravityModels(provider);
}
@@ -829,10 +860,21 @@ export function createProviderService(config = {}) {
/**
* agy ships an `agy models` subcommand that prints one model id per line —
* the authoritative catalog for this user's plan and binary version, which
- * a hardcoded list can only go stale against. Falls back to the shipped
- * catalog when the binary isn't runnable (not installed yet, PATH doesn't
- * resolve under the service env) so a refresh never empties a working
- * provider's model list.
+ * a hardcoded list can only go stale against.
+ *
+ * THROWS rather than falling back to `ANTIGRAVITY_MODEL_CATALOG` when the
+ * probe can't run (agy not installed, the service PATH can't resolve it, a
+ * timeout, a non-zero exit) or comes back with nothing parseable. The
+ * shipped catalog is for *seeding and migration* — surfacing it from a
+ * refresh would make a failed probe indistinguishable from a real fetch:
+ * `refreshProviderModels` would persist it and the UI would toast "Models
+ * refreshed", so a user whose PATH can't see agy would pick a model their
+ * plan doesn't have and only find out when the run dies. Throwing makes
+ * `refreshProviderModels` return null → an explicit error toast, and leaves
+ * the existing list untouched (nothing is persisted). Same posture as
+ * `_fetchOllamaToolCapableModels`, and the root CLAUDE.md rule that a
+ * reachable-but-list-failed backend must surface an explicit error rather
+ * than a plausible-looking empty/default result.
*
* The sentinel is always re-prepended: it is what keeps "use agy's own
* configured default" selectable after a refresh.
@@ -849,17 +891,18 @@ export function createProviderService(config = {}) {
// that's a full 15s hang ending in SIGTERM and an empty catalog. (execFile
// ignores an `stdio` option, so ending the stream is the way to do it.)
pending.child?.stdin?.end();
- const { stdout } = await pending.catch(() => ({ stdout: '' }));
+ const { stdout } = await pending.catch((err) => {
+ throw new Error(`'${bin} models' failed: ${err?.message || 'could not run the binary'}`);
+ });
- const listed = stdout
+ const listed = (stdout || '')
.split(/\r?\n/)
.map(line => line.trim())
// Drop blanks, banner/status lines, and anything that isn't a bare id.
.filter(line => /^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(line) && line !== ANTIGRAVITY_CONFIGURED_DEFAULT);
if (listed.length === 0) {
- console.error(`⚠️ '${bin} models' returned no model ids — keeping the shipped Antigravity catalog`);
- return [...ANTIGRAVITY_MODEL_CATALOG];
+ throw new Error(`'${bin} models' returned no model ids`);
}
return [ANTIGRAVITY_CONFIGURED_DEFAULT, ...new Set(listed)];
},
diff --git a/server/lib/aiToolkit/providers.test.js b/server/lib/aiToolkit/providers.test.js
index a721606471..4223a2fbd8 100644
--- a/server/lib/aiToolkit/providers.test.js
+++ b/server/lib/aiToolkit/providers.test.js
@@ -527,7 +527,10 @@ describe('Provider Service', () => {
name: 'Gemini CLI',
type: 'cli',
command: 'gemini',
- args: ['--yolo', '-m', 'gemini-2.5-pro', '--output-format', 'text'],
+ // Both model spellings: `-m` is the legacy short form agy rejects
+ // outright, `--model` is a form agy DOES accept — but pinned to a
+ // Gemini id agy can't resolve, so the migration must drop it too.
+ args: ['--yolo', '-m', 'gemini-2.5-pro', '--model', 'gemini-1.5-flash', '--output-format', 'text'],
envVars: { GEMINI_SANDBOX: 'false', KEEP_ME: '1' },
models: ['gemini-2.5-pro'],
defaultModel: 'gemini-2.5-pro'
@@ -551,7 +554,11 @@ describe('Provider Service', () => {
expect(active.id).toBe('antigravity-cli');
expect(legacy).toBeNull();
expect(antigravity.command).toBe('agy');
+ // No `--model` survives: a Gemini id would break every agy run AND
+ // permanently suppress PortOS's own model injection via hasModelFlag.
expect(antigravity.args).toEqual(['--dangerously-skip-permissions', '--print']);
+ expect(antigravity.args).not.toContain('--model');
+ expect(antigravityTui.args).not.toContain('--model');
expect(antigravity.defaultModel).toBe('antigravity-configured-default');
expect(antigravity.contextWindow).toBe(1048576);
expect(antigravity.envVars).toEqual({ KEEP_ME: '1' });
@@ -591,6 +598,38 @@ describe('Provider Service', () => {
expect(antigravity.lightModel).toBe('antigravity-configured-default');
});
+ // A failed `agy models` probe must be distinguishable from a real fetch.
+ // Returning the shipped catalog here would persist it and toast "Models
+ // refreshed", so a user whose service PATH can't resolve `agy` would pick a
+ // model their plan may not have and only discover it when the run dies.
+ it('reports a failed `agy models` probe as a refresh failure, leaving the stored list intact', async () => {
+ const stored = ['antigravity-configured-default', 'gemini-3.1-pro-high'];
+ await writeProvidersFile({
+ activeProvider: 'antigravity-cli',
+ providers: {
+ 'antigravity-cli': {
+ id: 'antigravity-cli',
+ name: 'Antigravity CLI',
+ type: 'cli',
+ command: '/nonexistent/path/to/agy',
+ contextWindow: 1048576,
+ models: [...stored],
+ defaultModel: 'antigravity-configured-default'
+ }
+ }
+ });
+
+ const errSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ const result = await providerService.refreshProviderModels('antigravity-cli');
+ errSpy.mockRestore();
+
+ // null = "nothing to persist"; the routes layer turns this into an error.
+ expect(result).toBeNull();
+ // And the previously-stored list is untouched on disk.
+ const after = await providerService.getProviderById('antigravity-cli');
+ expect(after.models).toEqual(stored);
+ });
+
it('leaves a user-customized Antigravity model list alone', async () => {
await writeProvidersFile({
activeProvider: 'antigravity-cli',
diff --git a/server/lib/antigravity.js b/server/lib/antigravity.js
index 37352b347e..3bc66b04d1 100644
--- a/server/lib/antigravity.js
+++ b/server/lib/antigravity.js
@@ -111,11 +111,15 @@ export function prepareAntigravityPrompt(args = [], prompt = '') {
// swallow --dangerously-skip-permissions: the flag stays a real boolean and the
// permission auto-approval actually takes effect. Do NOT add --print here.
/**
+ * Deliberately takes NO per-run model/effort overrides, unlike its `--print`
+ * sibling: the TUI path injects those in `agentTuiSpawning.js#appendModelArgs`
+ * + `buildEffortArgs`, after this normalizer has run (this is only reached via
+ * the provider-agnostic `applyCommandDefaults`). It still drops a dangling
+ * `--model` so that later append can't produce two of them.
* @param {string[]} [args] - the provider's saved argv
- * @param {{model?:string|null, effort?:string|null}} [overrides] - per-run selections
*/
-export function ensureAntigravityTuiArgs(args = [], overrides = {}) {
- const out = appendAntigravityModelAndEffort(stripAntigravityUnsupportedArgs(args), overrides);
+export function ensureAntigravityTuiArgs(args = []) {
+ const out = stripBrokenModelFlags(stripAntigravityUnsupportedArgs(args));
if (!out.includes('--dangerously-skip-permissions') && !out.includes('--sandbox')) {
out.push('--dangerously-skip-permissions');
}
diff --git a/server/lib/antigravity.test.js b/server/lib/antigravity.test.js
index 0faa3244ed..dac87f21a4 100644
--- a/server/lib/antigravity.test.js
+++ b/server/lib/antigravity.test.js
@@ -112,6 +112,21 @@ describe('ensureAntigravityPrintArgs', () => {
.toEqual(['--model', 'gemini-3.1-pro-low', '--dangerously-skip-permissions', '--print']);
});
+ // This is the path every production caller uses (buildCliArgs,
+ // buildCliSpawnConfig, askService), so the "user-baked pin wins" contract is
+ // pinned here rather than only on the TUI normalizer.
+ it('lets a user-baked --model pin win over the per-run model (both spellings)', () => {
+ expect(ensureAntigravityPrintArgs(['--model', 'claude-sonnet-4-6'], { model: 'gemini-3.1-pro-high' }))
+ .toEqual(['--model', 'claude-sonnet-4-6', '--dangerously-skip-permissions', '--print']);
+ expect(ensureAntigravityPrintArgs(['--model=claude-sonnet-4-6'], { model: 'gemini-3.1-pro-high' }))
+ .toEqual(['--model=claude-sonnet-4-6', '--dangerously-skip-permissions', '--print']);
+ });
+
+ it('lets a user-baked --effort pin win over the per-run effort', () => {
+ expect(ensureAntigravityPrintArgs(['--effort', 'low'], { effort: 'high' }))
+ .toEqual(['--effort', 'low', '--dangerously-skip-permissions', '--print']);
+ });
+
it('normalizes any pre-baked print flag (--print / -p / --prompt) to a single trailing --print', () => {
expect(ensureAntigravityPrintArgs(['--print'])).toEqual(['--dangerously-skip-permissions', '--print']);
expect(ensureAntigravityPrintArgs(['-p'])).toEqual(['--dangerously-skip-permissions', '--print']);
@@ -166,14 +181,16 @@ describe('ensureAntigravityTuiArgs', () => {
expect(ensureAntigravityTuiArgs(['--sandbox'])).toEqual(['--sandbox']);
});
- it('appends the per-run model and effort', () => {
- expect(ensureAntigravityTuiArgs([], { model: 'gemini-3.1-pro-high', effort: 'high' }))
- .toEqual(['--model', 'gemini-3.1-pro-high', '--effort', 'high', '--dangerously-skip-permissions']);
+ // The TUI path injects model/effort downstream (agentTuiSpawning), so this
+ // normalizer only preserves a real pin and drops a dangling one — otherwise
+ // that later append would emit a second --model.
+ it('preserves a user-baked --model pin', () => {
+ expect(ensureAntigravityTuiArgs(['--model', 'claude-sonnet-4-6']))
+ .toEqual(['--model', 'claude-sonnet-4-6', '--dangerously-skip-permissions']);
});
- it('lets a user-baked --model pin win over the per-run model', () => {
- expect(ensureAntigravityTuiArgs(['--model', 'claude-sonnet-4-6'], { model: 'gemini-3.1-pro-high' }))
- .toEqual(['--model', 'claude-sonnet-4-6', '--dangerously-skip-permissions']);
+ it('drops a dangling --model so the downstream append cannot double it', () => {
+ expect(ensureAntigravityTuiArgs(['--model'])).toEqual(['--dangerously-skip-permissions']);
});
});