Skip to content

fix(source-control): pass the Antigravity prompt to agy --print - #20147

Merged
nwparker merged 3 commits into
mainfrom
fix/agy-print-operand
Sep 12, 2026
Merged

nwparker merged 3 commits into
mainfrom
fix/agy-print-operand

Conversation

@nwparker

@nwparker nwparker commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​135 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​131
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3

In plain terms

If you asked Orca to write your commit message using "Antigravity" (the agy CLI) 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 handing agy the wrong piece of text as the actual prompt — it gave agy the word --sandbox (an unrelated setting) instead of the real instructions to write a commit message, so agy either used that garbage as its "prompt" or refused to run at all. This fix makes Orca pass the real prompt to agy correctly, the same way agy itself 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 --print flag takes the prompt as its operand, not from stdin. The old spec sent ['--print', '--sandbox', '--model', model] with the prompt piped to stdin, so --print consumed the literal string --sandbox as its prompt argument. Older agy builds silently generated from that garbage prompt; current agy (1.2.1) detects the misparse and exits 2 with Error: --print took "--sandbox" as its prompt....
  • Fix: promptDelivery: 'argv' with buildArgs: ({ 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 agy 1.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; confirmed agy --print=--sandbox still 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: something parses cleanly). Not a regression from this change; just the exact boundary of what --print=<value> protects against.

Closure condition

Verification (real agy 1.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:

$ echo "real commit prompt text" | agy --print --sandbox --model gemini-3.6-flash
Error: --print took "--sandbox" as its prompt, so the intended prompt was left as an argument and ignored.
Attach the prompt to the flag (--print='your prompt') and move --sandbox elsewhere on the command line.
EXIT: 2

Same reproduction using the real #14059 recipe args:

$ echo 'Generate a concise git commit message for the currently staged changes.' | agy --print --sandbox --model gemini-3.6-flash --add-dir . --effort low --dangerously-skip-permissions
Error: --print took "--sandbox" as its prompt, so the intended prompt was left as an argument and ignored.
EXIT: 2

End-to-end proof through the real production code path (planCommitMessageGeneration from src/shared/commit-message-plan.ts, piped straight into a real spawnSync(plan.binary, plan.args) against the installed agy binary, API key intentionally unset to stop short of a billed call):

PLAN binary: agy
PLAN args: ["--print=Generate a concise git commit message for the currently staged changes.","--sandbox","--model","gemini-3.6-flash","--add-dir",".","--effort","low","--dangerously-skip-permissions"]
PLAN stdinPayload: null
EXIT CODE: 1
STDOUT: 
STDERR: modelProvider is set to "gemini" in settings.json, but the GEMINI_API_KEY environment variable is not set. Set GEMINI_API_KEY to your Gemini API key, or remove "modelProvider" from settings.json to use the default backend.

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 agy subprocess)

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_KEY was intentionally unset for this app instance to guarantee no billed generation could occur.

  1. Antigravity selected as the commit-message agent in Settings:
    01-settings-antigravity-selected.png
  2. After clicking "Generate commit message with AI" — the panel shows 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:
    02-generate-clicked-error.png

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 passed
  • oxlint on changed files — clean
  • oxfmt --check on changed files — clean
  • node config/scripts/run-typecheck-projects-in-parallel.mjs — exit 0
  • Manual E2E against real agy 1.2.1 binary (see verification above)
  • Manual E2E through the real Orca UI (see visual proof above)

Fixes #19539
Fixes #14059

agy --print takes the prompt as its operand, so --sandbox was consumed as the
prompt: older agy generated from the literal text, newer agy exits 2.

Fixes #19539
Fixes #14059
… 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.
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

The Antigravity agent now delivers prompts through argv using --print=<prompt>. The --sandbox and --model arguments remain separate, and stdin payloads are null. Tests cover standard prompts, leading-dash prompts, large prompts, and recipe CLI arguments with duplicate model removal.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to 98544

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change satisfies the coding requirements in [#19539] and [#14059]. The Antigravity spec uses promptDelivery: 'argv' and constructs --print=<prompt>. The prompt therefore does not consume `--sa…
Out of Scope Changes check ✅ Passed The changes remain within the linked issue scope. They modify Antigravity commit-message argument construction and add focused unit tests for prompt binding and recipe-argument preservation. The comme…
Title check ✅ Passed The title clearly and concisely identifies the main change: passing the Antigravity prompt to the agy --print argument.
Description check ✅ Passed The description explains the problem, solution, scope, linked issues, testing, and visual proof. It is mostly complete despite not reproducing every template heading or checklist item verbatim.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7fb7f1a4-f8ac-4820-9fc9-df518fa47702

📥 Commits

Reviewing files that changed from the base of the PR and between 7294915 and c71e23a.

📒 Files selected for processing (3)
  • src/shared/commit-message-agent-spec.test.ts
  • src/shared/commit-message-agent-specs-secondary.ts
  • src/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],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 antigravity spec moves from promptDelivery: 'stdin' to 'argv' with buildArgs emitting --print=<prompt> --sandbox --model <model>, the combined form agy'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.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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=--sandbox assertion exercised the case real agy rejects rather than a genuine leading-dash prompt. It now uses -fix: something, which real agy parses cleanly.
  • Flag-name-collision case split out — the --sandbox collision is now its own test, with a Why comment clarifying it pins argv construction only, since real agy rejects an exact flag-name match independently of this fix.
  • Stale wording dropped — the plan test title no longer says "instead of the sandbox flag".

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Do not assert unbounded Antigravity argv delivery.

The local source-control path passes plan.args to spawnAgent with no prompt size guard. buildArgs places the prompt in --print=${prompt}. Windows CreateProcess limits the command line to 32,767 characters, so a large staged change can fail during process creation before agy receives it. Enforce a limit based on the serialized Windows command line or use an agy-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

📥 Commits

Reviewing files that changed from the base of the PR and between c71e23a and 9854468.

📒 Files selected for processing (2)
  • src/shared/commit-message-agent-spec.test.ts
  • src/shared/commit-message-plan.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@nwparker
nwparker merged commit 3b13ce0 into main Sep 12, 2026
27 checks passed
@nwparker
nwparker deleted the fix/agy-print-operand branch September 12, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant