Repository navigation
fix(source-control): pass the Antigravity prompt to agy --print - #20147
Conversation
… real agy accepts The prior leading-dash case used '--sandbox' as the prompt, which real agy 1.2.1 rejects via its own exact-flag-name heuristic independent of this fix (verified: `agy --print=--sandbox` still errors). Swap the primary case to a realistic leading-dash prompt verified clean against real agy, and keep the flag-collision case renamed with a why-comment noting it pins argv construction only.
…test The test input changed to a non-flag prompt in the prior commit but the name still referenced "the sandbox flag", pointing at nothing in the test body.
📝 WalkthroughWalkthroughThe Antigravity agent now delivers prompts through argv using Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to Large staged changes can prevent Antigravity commit-message generation from starting on Windows. Add bounded prompt handling or an alternate supported transport before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7fb7f1a4-f8ac-4820-9fc9-df518fa47702
📒 Files selected for processing (3)
src/shared/commit-message-agent-spec.test.tssrc/shared/commit-message-agent-specs-secondary.tssrc/shared/commit-message-plan.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| // using `--print=<value>` so a leading-dash prompt binds to the flag instead of | ||
| // being parsed as its own option, and --sandbox/--model stay separate options. | ||
| promptDelivery: 'argv', | ||
| buildArgs: ({ prompt, model }) => [`--print=${prompt}`, '--sandbox', '--model', model], |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Bound the agy prompt before spawning on Windows.
On native Windows, buildArgs places the full prompt in --print=<prompt>, while spawnSourceControlAgent passes those arguments to child_process.spawn. The staged-diff prompt can exceed 32,767 characters, so the 70,000-character case can fail before agy starts. Enforce a Windows-safe total command-line budget, including fixed arguments, and return a clear error or reduce the staged context. Keep agy on its current argv contract because the repository does not establish a supported stdin mode. Update the large-prompt test to assert the bound.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a focused fix for Antigravity's non-interactive commit-message generation: agy --print consumes its operand rather than stdin, so the prompt is now delivered on argv as --print=<prompt> instead of being swallowed by --sandbox.
- Prompt delivery switch — the
antigravityspec moves frompromptDelivery: 'stdin'to'argv'withbuildArgsemitting--print=<prompt> --sandbox --model <model>, the combined formagy's own error message recommends. - Test coverage — spec and plan tests are updated to exact assertions for the new argv shape, plus cases for a leading-dash prompt, a flag-name-collision prompt, a 70 KB prompt, and the #14059 recipe-args config.
ℹ️ Large diffs now ride argv for Antigravity
The argv switch is forced — agy --print has no stdin mode — so the prompt must be an operand. But the commit-message prompt can reach ~200 KB (STAGED_DIFF_BYTE_BUDGET), and embedding it in --print=<value> means large staged diffs now travel on argv, which can exceed Windows' ~32 KB command-line limit and Linux's ~128 KB per-argument limit. This matches cursor/kimi/copilot's existing unguarded argv delivery (the author pins the parity in a test), so it is not a regression and needs no change here — just noting that Antigravity joins them in failing to spawn for very large diffs rather than degrading gracefully.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — since the prior review, two follow-up commits refine the Antigravity test coverage without touching the production spec.
- Leading-dash test corrected — the original
c71e23a"leading-dash" test actually fed--sandbox(a full flag name) as its prompt, so its--print=--sandboxassertion exercised the case realagyrejects rather than a genuine leading-dash prompt. It now uses-fix: something, which realagyparses cleanly. - Flag-name-collision case split out — the
--sandboxcollision is now its own test, with aWhycomment clarifying it pins argv construction only, since realagyrejects an exact flag-name match independently of this fix. - Stale wording dropped — the plan test title no longer says "instead of the sandbox flag".
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/shared/commit-message-plan.test.ts (1)
233-233: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winDo not assert unbounded Antigravity
argvdelivery.The local source-control path passes
plan.argstospawnAgentwith no prompt size guard.buildArgsplaces the prompt in--print=${prompt}. WindowsCreateProcesslimits the command line to 32,767 characters, so a large staged change can fail during process creation beforeagyreceives it. Enforce a limit based on the serialized Windows command line or use anagy-supported alternate transport. Replace this test with boundary behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: aa22c4b5-7e51-48b1-a482-3f1c39a05d3d
📒 Files selected for processing (2)
src/shared/commit-message-agent-spec.test.tssrc/shared/commit-message-plan.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

In plain terms
If you asked Orca to write your commit message using "Antigravity" (the
agyCLI) as the AI agent, it either produced a nonsense commit message or just failed outright with a confusing error. That's because Orca was accidentally handingagythe wrong piece of text as the actual prompt — it gaveagythe word--sandbox(an unrelated setting) instead of the real instructions to write a commit message, soagyeither used that garbage as its "prompt" or refused to run at all. This fix makes Orca pass the real prompt toagycorrectly, the same wayagyitself documents. Now picking Antigravity for commit-message generation actually generates a commit message from your real changes, instead of erroring or producing garbage.Summary
agy's--printflag takes the prompt as its operand, not from stdin. The old spec sent['--print', '--sandbox', '--model', model]with the prompt piped to stdin, so--printconsumed the literal string--sandboxas its prompt argument. Olderagybuilds silently generated from that garbage prompt; currentagy(1.2.1) detects the misparse and exits 2 withError: --print took "--sandbox" as its prompt....promptDelivery: 'argv'withbuildArgs: ({ prompt, model }) => ['--print=' + prompt, '--sandbox', '--model', model]. The--print=<value>combined form is exactly what agy's own error message recommends, and it keeps a leading-dash prompt bound to the flag instead of letting it parse as a separate option.Known limitation (design boundary — read this)
Real
agy1.2.1 has its own separate heuristic that rejects--print=<value>when<value>is an exact match for a registered flag name (e.g. a prompt that is literally the string--sandbox) — this fires even with the corrected--print=<value>combined form; confirmedagy --print=--sandboxstill errors there. This is a property of agy itself, independent of this fix — there's nothing this spec can do to neutralize it, since the value is byte-for-byte a flag name. It only matters for a prompt whose entire text equals a known flag string, which real diff-derived commit prompts never do (confirmed a merely leading-dash, non-flag-name prompt like-fix: somethingparses cleanly). Not a regression from this change; just the exact boundary of what--print=<value>protects against.Closure condition
agy --printno longer swallows--sandboxas the prompt; the real Antigravity commit-message prompt reaches the model.--add-dir . --model gemini-3.6-flash --effort low --dangerously-skip-permissions) is preserved intact around the--print=<prompt>operand, with--modeldeduped the same way every other spec's recipe args already are.Verification (real
agy1.2.1 binary on this machine, no billed generation run)Reproduced the bug with the old argv shape, confirming it hits the exact #19539 error:
Same reproduction using the real #14059 recipe args:
End-to-end proof through the real production code path (
planCommitMessageGenerationfromsrc/shared/commit-message-plan.ts, piped straight into a realspawnSync(plan.binary, plan.args)against the installedagybinary, API key intentionally unset to stop short of a billed call):No exit-2, no "as its prompt" error — the fixed argv clears parsing entirely and fails only at the (deliberately broken) auth stage, proving the whole pipeline from plan to spawn is correct.
The temporary probe test file used to produce this was not committed; unit tests in this PR (
commit-message-agent-spec.test.ts,commit-message-plan.test.ts) cover the same argv shape as pure assertions, using a prompt (-fix: something) verified to parse cleanly against real agy for the "this is real protection" case, and a separately-labeled case pinning the flag-name-collision argv shape with a why-comment noting it does not claim real-agy safety.Visual proof (real Orca UI, real click, real
agysubprocess)Ran the actual dev build, set the "Commit message" AI recipe to Antigravity in Settings → Git & Source Control, staged a trivial change, and clicked the real "Generate commit message with AI" button.
GEMINI_API_KEYwas intentionally unset for this app instance to guarantee no billed generation could occur.Antigravity CLI command failed with code 1: modelProvider is set to "gemini"... GEMINI_API_KEY environment variable is not set, the same auth-stage error from the terminal verification above, not the old [Bug]: Antigravity commit message generation fails: --print takes --sandbox as prompt (exit code 2) #19539 exit-2 "as its prompt" parse failure:This confirms the fix through the real UI surface end to end, short of the billed model call itself (deliberately excluded).
Test plan
npx vitest run --config config/vitest.config.ts src/shared/commit-message-agent-spec.test.ts src/shared/commit-message-plan.test.ts— 77 passedoxlinton changed files — cleanoxfmt --checkon changed files — cleannode config/scripts/run-typecheck-projects-in-parallel.mjs— exit 0agy1.2.1 binary (see verification above)Fixes #19539
Fixes #14059