[Bug] Antigravity agent hangs indefinitely on "Running..." after command approval

Update: Found the root cause and a working patch

Following up on my earlier post - I dug into the Antigravity desktop logs and identified the cause of the hang, then applied a one-line patch to main.js that fixes it. The same workflow that hung 3 times in a row completed successfully on the first attempt after patching.


Root Cause

The hang is caused by an uncaught TypeError: Do not know how to serialize a BigInt in the main Electron process. This crashes the IPC channel between the integrated terminal and the agent, so terminal command results are never delivered back. The agent then sits at “Running..” forever, waiting for output that will never arrive.

The crash sequence visible in the logs:

Step 1 — ptyHost heartbeat loss (main.log):

[warning] No ptyHost heartbeat after 6 seconds
[error] No ptyHost heartbeat after 12 seconds

Step 2 — BigInt serialization crash (main.log):

[error] [uncaught exception in main]: TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)
    at xC (file:///Applications/Antigravity.app/Contents/Resources/app/out/main.js:31:11765)
    at vbe.o (file:///Applications/Antigravity.app/Contents/Resources/app/out/main.js:31:14636)
    at vbe.m (file:///Applications/Antigravity.app/Contents/Resources/app/out/main.js:31:14511)
    at n.then.Error.m.id (file:///Applications/Antigravity.app/Contents/Resources/app/out/main.js:31:15438)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Step 3 — Terminal completions stop entirely (Antigravity.log, window-level):

Before the crash, completions log normally:

[INFO]: [Terminal] Command completed: python3 <script> exit code 0

After the crash, no more [Terminal] Command completed entries appear for the rest of the session.

Step 4 — Agent spins indefinitely:

The language server keeps requesting planner cycles with an ever-growing message count (27 → 31 → 33 → … → 48 → 51), waiting for terminal output that will never arrive. This is the “Running..” state visible in the UI.


The Fix (one-line patch)

The crash occurs in the xC function in main.js, which serializes values for IPC transport. It calls JSON.stringify(t) on arbitrary values, but JSON.stringify throws on BigInt values because it doesn’t natively support them.

File: /Applications/Antigravity.app/Contents/Resources/app/out/main.js (macOS)

Find this string (there is exactly one occurrence):

sn.fromString(JSON.stringify(t))

Replace with:

sn.fromString(JSON.stringify(t,(k,v)=>typeof v==="bigint"?Number(v):v))

This adds a replacer function that converts BigInt values to Number before serialization. All realistic values flowing through this path (PIDs, timestamps, byte counts) fit safely within Number.MAX_SAFE_INTEGER (9 quadrillion), so there is no precision loss.

On macOS, the full steps are:

  1. Quit Antigravity completely

  2. Back up the original file:

    cp "/Applications/Antigravity.app/Contents/Resources/app/out/main.js" \
       "/Applications/Antigravity.app/Contents/Resources/app/out/main.js.backup"
    
  3. Apply the patch:

    sed -i '' 's/sn\.fromString(JSON\.stringify(t))/sn.fromString(JSON.stringify(t,(k,v)=>typeof v==="bigint"?Number(v):v))/' \
       "/Applications/Antigravity.app/Contents/Resources/app/out/main.js"
    
  4. Relaunch Antigravity

To revert:

cp "/Applications/Antigravity.app/Contents/Resources/app/out/main.js.backup" \
   "/Applications/Antigravity.app/Contents/Resources/app/out/main.js"

Results

Before patch: Agent hung at “Running..” on every attempt involving multiple sequential terminal commands (3 consecutive failures on the same workflow).

After patch: The exact same workflow — 17 sequential CLI calls (label-delete and filter-delete operations) — completed successfully on the first attempt. main.log shows zero BigInt errors, zero ptyHost heartbeat loss, and all terminal completions were delivered back to the agent normally.


Environment

  • macOS (Apple Silicon), Antigravity Desktop 1.19.6
  • Gemini 3.1 Pro (High)

Notes

  • The code signature on the app bundle will be invalidated by this edit. In my experience, macOS still launches the app without issues since it was already trusted via Gatekeeper on first install. You may see a one-time confirmation prompt.
  • Any Antigravity auto-update will overwrite main.js, so you would need to re-apply the patch after updating.
  • The same JSON.stringify pattern likely exists in the Windows build at an equivalent path — Windows users experiencing this issue could apply the same fix.

Log Locations for Others Investigating

  • macOS: ~/Library/Application Support/Antigravity/logs/<session>/
    • main.log — look for BigInt or ptyHost heartbeat
    • window*/exthost/google.antigravity/Antigravity.log — look for [Terminal] Command completed entries stopping
3 Likes