Skip to content

fix(commit-message): stop Antigravity treating --sandbox as the commit prompt - #14157

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/sta-4011-antigravity-prompt
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/sta-4011-antigravity-prompt

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

ELI5

When Orca asked Antigravity to write a commit message, it accidentally told the CLI that the job was --sandbox instead of the real prompt. This change puts the commit-message text in the flag Antigravity actually reads.

What Changed

Antigravity commit-message generation now passes the prompt as the value of --print and keeps --sandbox as a later boolean flag:

['--print', prompt, '--sandbox', '--model', model]

--print stays immediately followed by the prompt so extra recipe CLI arguments cannot land between the flag and its value.

Why

Linux agy 1.1.12 treats --print / -p / --prompt as a required string flag. Orca previously spawned:

agy --print --sandbox --model <model>   # prompt on stdin

--print consumed --sandbox as the user request. That matches the report: Antigravity answered as if the user asked about --sandbox. A trailing --print with no value exits 2 and prints help; stdin is not the print-mode prompt.

Linked Issue

Fixes #14059
Fixes STA-4011

Visual Proof

N/A — no Source Control chrome change. The bug is the argv Orca passes to agy. Before/after invocation on a throwaway Linux SSH target with a real demo-project repo:

Before (origin/main):

agy --print --sandbox --model Gemini 3.5 Flash (Medium) --add-dir . --model gemini-3.6-flash --effort low --dangerously-skip-permissions
# stdin: "You are generating a single git commit message..."

After:

agy --print "<commit-generation prompt + staged patch>" --sandbox --model Gemini 3.5 Flash (Medium) --add-dir . --model gemini-3.6-flash --effort low --dangerously-skip-permissions
# stdin: empty

--print's next token is the real prompt, not --sandbox.

Testing

  • Linux agy 1.1.12 on a throwaway Docker SSH target (linux-arm64): --print without a value → exit 2 + help; --print --sandbox → parsed (auth path), proving --sandbox is the print value.
  • Isolated Electron CDP session of this worktree (pnpm build:relay, unique user-data, identity verified).
  • Connected the SSH target, registered /work/demo-project (local git-bundle fallback after GitHub HTTPS clone needed auth), staged a real change, clicked Generate commit message with AI.
  • Fake agy on the remote PATH captured argv/stdin before and after the fix.
  • Relay: linux-arm64, already installed, reconnect succeeded. No commit-message spawn errors in app logs.
  • Focused vitest: commit-message-agent-spec, commit-message-plan, commit-message-text-generation, commit-message-generation, commit-message-prompt.
  • Those new tests fail if the old --print --sandbox + stdin contract is restored.
  • pnpm tc:node and oxlint on the touched files.

Cleanup: stopped only the Electron/dev PIDs from this session, removed the Docker container, temp keys, and isolated user-data. Worktree git status was clean after the commit.

SSH merge verdict: land. Remaining risk: very large staged diffs now travel on argv like other argv-delivery agents (Kimi/Cursor/Copilot), not stdin.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@brennanb2025, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cfbbcaee-463c-4378-be2b-3a9cb8877a60

📥 Commits

Reviewing files that changed from the base of the PR and between 9bb8836 and 9a425b5.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ecb3a7c7-c01c-4150-999d-62c41fe268b5

📥 Commits

Reviewing files that changed from the base of the PR and between bc2e300 and bdaa9ec.

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

📝 Walkthrough

Walkthrough

Antigravity commit-message prompts now use argv delivery. The prompt follows --print, before the sandbox and model options. Tests verify argument ordering, argv prompt delivery, the agy binary, configured model, custom arguments, label, and null stdin payload.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Antigravity commit-message bug and the fix for treating --sandbox as the prompt.
Description check ✅ Passed The description explains the bug, fix, testing, linked issue, visual proof, and scope with only minor template omissions.
Linked Issues check ✅ Passed The changes pass the prompt through --print and preserve --sandbox as a flag, directly resolving issue #14059.
Out of Scope Changes check ✅ Passed All modified files update Antigravity argument handling or add focused tests for the linked commit-message bug.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 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.

agy's --print/-p/--prompt is a required string flag. Orca invoked
`agy --print --sandbox --model ...` with the commit prompt on stdin,
so Linux agy 1.1.12 treated --sandbox as the user request.

Keep the prompt immediately after --print so recipe CLI arguments
cannot land between the flag and its value.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/sta-4011-antigravity-prompt branch from bdaa9ec to 9a425b5 Compare August 14, 2026 22:01
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Re-audited and rebased the single fix onto current origin/main (9bb8836bb6). Final head: 9a425b5ec1b093571cf2a001789607f6b918dba5.

Final evidence:

  • Focused Vitest: 5 files / 179 tests passed (commit-message-agent-spec, commit-message-plan, commit-message-prompt, commit-message-generation, commit-message-text-generation).
  • pnpm tc:node passed; oxlint on all 3 touched files passed; git diff --check passed.
  • Two independent adversarial review lanes returned clean; SSH provider coverage also passed in the reproduction lane.
  • Live Ubuntu 20.04 arm64 with agy 1.1.12: valueless --print exited 2 with flag needs an argument: -print; the fixed --print <prompt> --sandbox --model … vector parsed and reached authentication.
  • Linux argv sweep: 32,768-byte prompt spawned and reached auth (2,019 ms); 131,072 bytes failed with E2BIG (1 ms); 262,144 bytes failed with E2BIG (2 ms). Boundary checks showed 131,071 bytes still spawned (1,015 ms).

The flag-plus-value implementation remains the smallest standard fix: agy 1.1.12 requires the print prompt as one argv value and exposes no stdin/file prompt mode. The measured per-argument ceiling is an accepted large-prompt limitation shared by argv-delivery agents, not a reason to restore the broken stdin contract; addressing it safely across Linux, Windows, local, and SSH needs a separate cross-agent delivery design.

Scope remains 3 files / one commit. No UI, remote-wire, Git, provider, folder-workspace, or interactive Antigravity behavior changed. Not merged.

@M-Ali-ML

M-Ali-ML commented Aug 25, 2026 •

Copy link
Copy Markdown

Hey, will this also fix this issue or should I open this as a new issue?
Can confirm it also fixed my issue by checking out to this branch and running it.
Can we get this merged?

### Summary
When using the **Generate Commit Message** feature with the **Antigravity** (`agy`) agent, the command fails with exit

code 2 on Antigravity CLI version 1.1.18 and higher.

### Error Output

Antigravity CLI command failed with code 2: 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.

### Root Cause
In Antigravity CLI v1.1.18+, strict flag validation was added to prevent `-p`/`--print` from consuming subsequent flags

starting with -- as prompt text.

Orca currently invokes the CLI with arguments structured as:
```bash
agy --print --sandbox "<prompt>"

Because Go's flag parser binds --sandbox as the value for --print, agy >= 1.1.18 detects this and exits with code 2.

Steps to Reproduce

  1. Install/update agy to version 1.1.18 or higher (agy update).
  2. Open Orca with a repository containing staged changes.
  3. Open the Source Control sidebar and click the Generate Commit Message (✨) button.
  4. Select Antigravity as the agent.
  5. Click Generate.

Expected Behavior

agy should execute in headless mode, accept the prompt, and return the generated commit message.

Suggested Fix

Update the argument builder in Orca's Antigravity integration from:

// Current
['--print', '--sandbox', prompt]

to either:

// Fixed: Place flags before --print
['--sandbox', '--print', prompt]

// Or attach the prompt directly via '='
[`--print=${prompt}`, '--sandbox']

Environment

• Orca Version: 1.4.188
• Antigravity CLI Version: 1.1.20
• OS: macOS

@nwparker

Copy link
Copy Markdown
Contributor

Review verdict: Do not merge as-is; superseded by #21606. Its older argument/prompt workaround is incorporated into the maintained source-control migration, which now covers current agy defaults and generation compatibility.

@nwparker

Copy link
Copy Markdown
Contributor

Closing as superseded by #21606, which merged on 2026-09-21. The review notes on this PR confirm the older workaround was incorporated into that maintained source-control migration.

@nwparker nwparker closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Antigravity receives --sandbox as the prompt when generating commit messages

3 participants