Skip to content

fix(agent-hooks): stop Antigravity's Windows hook from spawning PowerShell on every event - #15520

Merged
nwparker merged 7 commits into
mainfrom
nwparker/bug-windows-antigravity-agent-hooks-spawn-a-visi
Aug 20, 2026
Merged

nwparker merged 7 commits into
mainfrom
nwparker/bug-windows-antigravity-agent-hooks-spawn-a-visi

Conversation

@nwparker

@nwparker nwparker commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​521 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​513
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​22 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11

ELI5

On Windows, the Antigravity agent fired a hook every few seconds, and each one started a
whole Windows PowerShell just to send one small status message to Orca. PowerShell takes
about a third of a second to boot, and the black console window the agent opens for the
hook stays on screen that entire time — so users saw it flashing all session long. Orca
now sends that message with curl.exe instead, which every other agent already uses. The
work still happens, it just finishes fast enough that there is nothing to see.

What Changed

  • src/main/antigravity/hook-script.ts — the Windows managed hook posts through the shared
    buildWindowsAgentHookPostCommand('antigravity', …) curl builder instead of a bespoke
    powershell.exe -Command "… Invoke-WebRequest …". The event name rides along as the same
    top-level hook_event_name form field the POSIX branch already sends.
  • Same file — setlocal becomes setlocal DisableDelayedExpansion. The curl line
    percent-expands paneKey / worktreeId, and inherited delayed expansion eats a ! out of
    those values ([windows] Managed grok-hook.cmd fails with exit code 1 (syntax error) when GROK_HOME is unset #9358 / Windows: grok-hook.cmd syntax error when GROK_HOME is empty (SessionStart fails) #9941). The old PowerShell line read $env: at runtime and was
    immune; the curl line is not.
  • src/shared/agent-hook-listener.ts — accept an absent or empty Antigravity payload as
    {}. The POSIX script substitutes {} before posting and PowerShell did the same for
    empty stdin, but curl omits a --data-urlencode name@- field entirely when stdin is
    empty. Without this, payload-less events were dropped and lost the status transition their
    hook_event_name still carried. Scoped to antigravity; every other source keeps
    rejecting a body it cannot parse.
  • Tests — new src/main/antigravity/windows-hook-payload-delivery.test.ts (live, Windows)
    plus listener and shape coverage.

No change to the POSIX script, the remote/SSH installer, the WSL relay path, the registered
hook command, or the wrapper .cmd files.

Why

Antigravity was the last agent still posting hook status through Windows PowerShell 5.1
(git grep on main finds the interpreter in src/main/antigravity/hook-script.ts and
nowhere else). Claude, Codex, Cursor, Devin, Droid, Gemini, Grok, and Command Code all moved
to curl.exe behind the shared builders in installer-utils.ts, whose own comment records
the reason: "PowerShell per-post costs ~300ms startup and mangles UTF-8 via code-page
translation."

Antigravity spawns its hooks itself, so Orca cannot suppress the console Windows allocates
for them — but it fully controls how long that console lives. Removing the interpreter takes
the visible window from a third of a second to a flicker, which is the same state the other
bare-.cmd agents (Codex, Devin) are already in and which nobody reports.

Measured on Windows 11, 20 runs per variant against a local listener, identical harness:

per hook event
before (PowerShell 5.1) 326 ms
after (curl.exe) 134 ms

Both figures include Git Bash harness overhead, so the ~192 ms delta is the honest number.
At one event every 2–6 s that is the difference between continuous flashing and nothing.

Secondary wins that fall out of the same change: UTF-8 no longer round-trips through the
console code page, the timeout tightens from -TimeoutSec 2 to
--connect-timeout 0.5 --max-time 1.5, and each event drops a ~50 MB .NET process for a
~4 MB one.

How it drifted

Worth recording, because it explains why no test caught it and what stops the next one.

May 16 (#2100) The shared Windows hook POST was PowerShell by design — its comment: "Windows PowerShell 5.1 defaults redirected stdin/request bodies to the active code page. Hook payloads are UTF-8 JSON, so force UTF-8 on both read and POST or CJK prompts arrive in Orca as literal question marks." PowerShell was the Unicode fix.
May 19 (#2389) Antigravity added, three days later, copying that then-correct command verbatim plus one field. The shared builder's signature was buildWindowsAgentHookPostCommand(source) — no extension point — and Antigravity is the one agent whose event name comes from the wrapper's env rather than the piped payload. It could not call the shared builder, so it forked a private copy. That fork is the root cause.
Jun 25 (#6402) Shared builder switched to curl.exe, motivated by latency (two PowerShell processes ≈ 650 ms/hook). Every agent that called it was fixed for free; the private copy silently was not.
~Sep (#11782) extraFormLines added so Grok could attach grokHome — precisely the extension point Antigravity needed in May, arriving after the fork had set. This PR uses it.

So the original code was not wrong when written; a missing extension point forced a copy, and copies do not receive fixes.

Note for the reporter: the issue infers a regression on 2026-08-14 from file mtimes. That is a rewrite, not an introduction — the PowerShell POST has been in the core script since May 19 and executing since the wrapper/core split on May 22 (#2645). The "did not used to happen" is most likely #13378 (Aug 10, "refresh existing Orca launchers when agent CLIs are unavailable"): before it, a host where the Antigravity CLI was not detected never got its core script refreshed, so the wrappers' if exist "%ORCA_ANTIGRAVITY_CORE%" check failed and they fell through to the harmless echo {} path — exactly as described. That switched on a dormant code path. Inferred from the commit's stated purpose, not reproduced.

Stopping the next one

New src/main/agent-hooks/windows-hook-post-interpreter.test.ts asserts the invariant the drift violated, across all ten batch-script agents at once: a managed Windows .cmd hook posts through fully-qualified curl.exe, pipes its payload via payload@-, and spawns no interpreter. It generates the scripts under a mocked win32 platform instead of executing them, so the POSIX CI legs guard it too — otherwise this class is only visible on a Windows runner.

Confirmed to be a real guard rather than a tautology: reverting hook-script.ts to main makes it fail with antigravity-hook.cmd must not spawn an interpreter, and restoring the fix makes it pass. Copilot (.ps1) and Kimi (.sh) are excluded with a stated reason — their interpreter is the host, not a per-event child.

Linked Issue

Fixes #15117

Visual Proof

N/A for rendered Orca UI — no Orca view, layout, or in-app control changes. The symptom is
an OS console window belonging to the agent's own process tree, not an Orca surface, so
there is no tab-switchable Orca screenshot pair to attach. The measurable before/after is the
process-level evidence in Why and Testing; the interpreter's removal is asserted
directly by expect(script).not.toMatch(/powershell/i).

Testing

Validated on a real Windows 11 host, not an emulated platform check.

Windows (live) — src/main/antigravity/, src/shared/agent-hook-listener-antigravity.test.ts:
25 passed | 3 skipped. Includes a suite that installs the hooks for real, spawns each of
the five event wrappers the way Antigravity does (cmd /c <bare .cmd path>, matching the
issue's process trace), pipes a 4 KB payload containing café 日本語 😀, and follows it to a
live listener:

Windows baseline comparison — ran src/main/agent-hooks/ on origin/main on the same
host first: 6 pre-existing failures (3 × installer-utils symlink tests, 2 × Claude
managed-hook-stdin-lifecycle, 1 × Claude windows-hook-payload-delivery) — all
environment-specific to that box and all in Claude's PowerShell path, none touched here. My
branch reproduces exactly those 6 and adds none.

That comparison also caught a real defect mid-review: the first cut of the listener fix only
handled payload="", but curl actually omits the field entirely, so the event still dropped.
Fixed and re-validated on hardware.

macOS — src/shared/ src/main/agent-hooks/ src/main/antigravity/: 5853 passed, 0
failures (includes the new cross-agent interpreter guard, which runs on every platform). pnpm typecheck, pnpm build, oxlint --deny-warnings, oxfmt --check all clean.

  • I manually tested these changes locally
  • Automated tests added/updated

Review

  • Security: curl.exe is fully qualified as %SystemRoot%\System32\curl.exe, preserving
    the same repo-local-binary-hijack protection the qualified powershell.exe path had. The
    payload stays off the command line via payload@-. One honest note: the hook token moves
    from a runtime $env: read into a percent-expanded -H argument, so it is briefly visible
    in the curl process command line. That is the existing posture for all eight other agents
    using these shared builders (installer-utils.ts:153, :172) — Antigravity was the
    outlier — and the token is loopback-only and per-session. Called out rather than buried.
  • Cross-platform: POSIX branch byte-identical. Windows validated on hardware. curl.exe
    is Win10 1803+, already a hard dependency of every other agent hook, so no new floor.
  • SSH / remote / folder workspaces: remote installs write getManagedScript('posix')
    (hook-service.ts:193) — untouched. WSL uses the POSIX script via the relay. The hook post
    is loopback within the host that runs the agent, so there is no client/host version skew.
  • Backwards compatibility: no persisted state, schema, migration, setting, or wire
    contract. refreshManagedScriptIfPresent rewrites the script in place on upgrade; the
    registered command and wrapper .cmd files are unchanged, so no stale-registration path.
    Downgrade restores the old script cleanly.
  • Performance: strictly better — one fewer interpreter, ~192 ms and ~46 MB less per
    event, tighter timeouts.
  • Provider neutrality / UI / mobile: no surface touched.

Agent skill upstream boundary

  • Not applicable.

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)

…Shell per event (#15117)

Antigravity was the last agent posting hook status through Windows PowerShell
5.1. Every hook event — roughly one every 2-6s during an active session — paid a
~300ms interpreter cold start, which is what made the console the agent
allocates for each hook long enough to see as continuous flashing.

Move the Windows POST to the shared curl.exe builder every other agent already
uses. curl finishes in ~10ms and, unlike PowerShell, does not recode the UTF-8
payload through the console code page.

Because the curl line percent-expands values, the script also needs
`setlocal DisableDelayedExpansion` (#9358/#9941) so a `!` in a pane key or
worktree path is not eaten as a delayed reference.
…arries no payload

The PowerShell post substituted `{}` for empty stdin, and the POSIX script does
the same before posting. curl forwards stdin verbatim, so a payload-less event
now arrives as `payload=""` and the shared ingest dropped it — losing the status
transition its `hook_event_name` still carried.

Accept an empty Antigravity payload as `{}` at the ingest boundary, scoped to
that source so every other agent keeps rejecting a body it cannot parse.
…y object

Real-Windows validation showed curl omits a `--data-urlencode name@-` field
entirely when stdin is empty, so a payload-less event arrives with no `payload`
key rather than an empty one. Accept both shapes.
An over-broad `oxfmt --write` over src/shared/ reformatted a file this change does
not touch. That file's drift is pre-existing on main; restoring it keeps the PR
diff to the Antigravity hook.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Windows Antigravity hooks now use the shared buildWindowsAgentHookPostCommand helper with curl.exe. The scripts include the event field and disable delayed expansion. Tests cover script generation, UTF-8 payload delivery, authentication, responses, empty input, and missing pane context. Antigravity payload normalization accepts missing or empty payloads as empty objects. Other sources still reject empty or absent payloads, and malformed nonempty Antigravity payloads remain rejected.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #15117 by removing PowerShell from Antigravity's Windows hook path while preserving event delivery and status reporting.
Out of Scope Changes check ✅ Passed The production and test changes support the linked issue and stated objectives; no unrelated code changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely identifies the main change: replacing per-event PowerShell launches in Antigravity's Windows hooks.
Description check ✅ Passed The description covers the required sections, linked issue, testing, visual proof, risks, cross-platform impact, and checklist with specific implementation details.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 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: 2

🧹 Nitpick comments (1)
src/main/antigravity/hook-script.ts (1)

10-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten implementation-history comments.

Keep only the non-obvious constraint in each comment. Move issue history and performance narrative to the PR description.

  • src/main/antigravity/hook-script.ts#L10-L16: Remove the PowerShell and console-flash history. Keep a brief transport rationale if needed.
  • src/main/antigravity/hook-script.ts#L24-L26: Reduce the delayed-expansion rationale to one line.
  • src/main/antigravity/hook-service.test.ts#L101-L102: Remove the repeated performance explanation.
  • src/main/antigravity/windows-hook-payload-delivery.test.ts#L1-L7: Replace the suite preamble with one brief test-purpose comment, or remove it.

As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c4c80e64-ee5a-433c-bc39-064074786983

📥 Commits

Reviewing files that changed from the base of the PR and between 73f7767 and 2f0a42f.

📒 Files selected for processing (5)
  • src/main/antigravity/hook-script.ts
  • src/main/antigravity/hook-service.test.ts
  • src/main/antigravity/windows-hook-payload-delivery.test.ts
  • src/shared/agent-hook-listener-antigravity.test.ts
  • src/shared/agent-hook-listener.ts

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

…erpreter

The Antigravity drift was invisible to per-agent tests. The shared builder took
only `(source)` and could not add the extra form field Antigravity needs, so it
forked a private copy of the then-correct PowerShell command (#2100); when the
shared builder moved to curl (#6402) every caller was fixed for free and the
copy silently was not.

Assert the violated invariant across all ten batch-script agents at once, and
generate under a mocked win32 platform so the POSIX CI legs guard it too.
Verified to fail on the pre-fix script, naming the offending file.
…cover blank payloads

- The missing-pane case closed stdin, so a hook that read before the env guard would
  still pass on an EOF the real caller never sends. Abandon the pipe instead (#11549).
- Cover whitespace-only payloads, which the trim() in the ingest already accepts.
- Trim comments to the repo's concise-comment rule; the drift history lives in the PR.

@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

🧹 Nitpick comments (1)
src/main/agent-hooks/windows-hook-post-interpreter.test.ts (1)

1-11: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reduce the file header comment.

This 11-line history is longer than needed for this test. Keep one concise comment that states the invariant.

As per coding guidelines: “Comments must be concise, non-obvious, and brief—prefer one line.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7beffafc-9494-46da-9edf-8203825c1803

📥 Commits

Reviewing files that changed from the base of the PR and between 2f0a42f and 3da174f.

📒 Files selected for processing (2)
  • src/main/agent-hooks/windows-hook-post-interpreter.test.ts
  • src/main/antigravity/hook-script.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/antigravity/hook-script.ts

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

@nwparker

Copy link
Copy Markdown
Contributor Author

Thanks — all three findings were valid and are addressed in c951dcc.

1. Missing-pane test provided an EOF the real caller never sends (windows-hook-payload-delivery.test.ts) — correct, and the most useful of the three. runWrapper now takes string | null; null abandons the pipe instead of closing it, which is the shape a caller outside an Orca pane actually produces. A hook that reads stdin before the env guard now hangs and fails the 15 s deadline instead of passing. Added an error handler on child.stdin so the expected EPIPE on child exit doesn't reject the run.

2. Whitespace-only payloads uncovered — added, and widened past the suggestion to ['', ' ', '\r\n'] since the ingest accepts them via .trim().

3. Comments too long — agreed, and it was a straight violation of this repo's own AGENTS.md rule ("BE CONCISE. 1 LINE if possible"). Trimmed all four sites to the non-obvious constraint only. The drift history it duplicated now lives in the PR description under How it drifted, which is where it belonged.

Also added since the review: src/main/agent-hooks/windows-hook-post-interpreter.test.ts, a cross-agent guard asserting the invariant this bug violated — a managed Windows .cmd hook posts through fully-qualified curl.exe, pipes via payload@-, and spawns no interpreter. It generates under a mocked win32 platform rather than executing, so the POSIX legs guard it too; otherwise this class is only visible on a Windows runner. Verified it fails on the pre-fix script (antigravity-hook.cmd must not spawn an interpreter) rather than being a tautology.

Re-validated on a real Windows 11 host, not just an emulated platform check.

…ressed

Filtering to posting scripts before asserting hid the failure that matters: a
script that swaps its curl POST for an interpreter no longer matches the filter,
so the suite failed on an opaque count instead of naming the file. Assert
no-interpreter across every .cmd first, then narrow.

Scoped the follow-on assertions correctly while doing it — claude-statusline.cmd
posts to its own pathname and stages a temp file rather than piping stdin, which
the previous shape would have flagged.

Verified both regression shapes now name the offending agent.

@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: Pro Plus

Run ID: 5665aa22-9a43-48e4-94e0-eb6f6323a085

📥 Commits

Reviewing files that changed from the base of the PR and between c951dcc and 5af5e7e.

📒 Files selected for processing (1)
  • src/main/agent-hooks/windows-hook-post-interpreter.test.ts

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

Comment on lines +116 to +118
expect(script.body, `${script.name} must not spawn an interpreter`).not.toMatch(
/powershell(\.exe)?/i
)

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '90,135p' src/main/agent-hooks/windows-hook-post-interpreter.test.ts
rg -n --glob '*.ts' --glob '*.tsx' --glob '*.js' --glob '*.jsx' 'pwsh|powershell' src/main/agent-hooks

Repository: stablyai/orca

Length of output: 5967


🏁 Script executed:

sed -n '1,95p' src/main/agent-hooks/windows-hook-post-interpreter.test.ts
sed -n '135,190p' src/main/agent-hooks/windows-hook-post-interpreter.test.ts
rg -n 'BATCH_SCRIPT_INSTALLERS|pwsh\.exe|pwsh\b' src/main/agent-hooks src/shared

Repository: stablyai/orca

Length of output: 6503


🏁 Script executed:

node - <<'JS'
const pattern = /powershell(\.exe)?/i
for (const value of ['powershell', 'powershell.exe', 'pwsh', 'pwsh.exe']) {
  console.log(`${value}: ${pattern.test(value)}`)
}
JS

Repository: stablyai/orca

Length of output: 217


Reject pwsh.exe as a PowerShell interpreter.

The regex matches only powershell and powershell.exe. A script that invokes pwsh.exe would pass this test. Match both executable names.

@nwparker
nwparker merged commit 36d78e8 into main Aug 20, 2026
89 of 91 checks passed
OrcaWin added a commit that referenced this pull request Aug 20, 2026
…s per event (#14828)

Grok runs a hook `command` containing a space as `pwsh -Command <cmd>`. Orca
registered the encoded PowerShell launcher, whose command line is full of
spaces, so every status event walked

  grok.exe -> pwsh.exe -> powershell.exe -> cmd.exe -> curl.exe

before reaching a script whose entire job is one loopback POST. Measured
against Grok 1.0.5's own dispatcher on Windows 11, that is 518-719ms per event
(mean 607ms). The same script registered as its bare path is spawned directly
as `grok.exe -> cmd.exe` and costs 43-213ms (mean 114ms).

Orca installs nine Grok events, and a single one-tool-call prompt dispatches
roughly ten of them, so this is the difference between a hook chain that is
continuously resident during a turn and one that is not. It is also how long
the console the agent allocates for a hook can stay on screen, which is the
mechanism #15520 fixed for Antigravity -- Grok was worse, paying two
interpreters rather than one.

Use the shared `wrapWindowsCmdHookCommand`, the same registration Codex, Devin
and Antigravity already use (#8430). A profile path that is not cmd-safe still
falls back to the encoded launcher, so #6078 stays covered.

Tradeoff carried over from those agents: a bare path cannot hold the launcher's
missing-script guard, so a deleted script surfaces as a per-event
`command not found` in Grok's log rather than a silent stdin drain. Verified
that Grok fails open there -- the tool still runs, including on PreToolUse,
which Grok declares a blocking event.

Verified end to end against the real Grok CLI: 9/9 status posts delivered with
full payloads through the bare path, and 12/12 in a controlled A/B spawning
both shapes the way Grok does. Also confirmed Grok creates hook processes with
CREATE_NO_WINDOW rather than DETACHED_PROCESS, which is the mode where a bare
.cmd would have been worse than the launcher.
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 21, 2026
…Shell on every event (stablyai#15520)

Antigravity was the last agent posting hook status through Windows PowerShell 5.1. Every
hook event — roughly one every 2-6s during an active session — paid a ~300ms interpreter
cold start, which is what made the console the agent allocates for each hook last long
enough to be seen as continuous flashing.

Move the Windows POST to the shared curl.exe builder every other agent already uses, via
the `extraFormLines` escape hatch for the `hook_event_name` field Antigravity uniquely
needs. Measured on Windows 11: 326ms -> 134ms per event.

Because the curl line percent-expands its arguments, the script also needs
`setlocal DisableDelayedExpansion` (stablyai#9358/stablyai#9941) so a `!` in a pane key or worktree path
is not eaten as a delayed reference.

curl omits a `--data-urlencode name@-` field entirely when stdin is empty, so accept an
absent or blank Antigravity payload as `{}` at the ingest boundary — the POSIX script
substitutes `{}` before posting and PowerShell did the same, and without this a
payload-less event lost the status transition its `hook_event_name` still carried. Scoped
to that source; every other agent keeps rejecting a body it cannot parse.

Adds a cross-agent guard asserting the invariant the original drift violated: a managed
Windows .cmd hook posts through fully-qualified curl.exe and spawns no interpreter.
Generated under a mocked win32 platform so the POSIX CI legs guard it too.

Validated on a real Windows 11 host, not an emulated platform check.

Fixes stablyai#15117
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
…Shell on every event (stablyai#15520)

Antigravity was the last agent posting hook status through Windows PowerShell 5.1. Every
hook event — roughly one every 2-6s during an active session — paid a ~300ms interpreter
cold start, which is what made the console the agent allocates for each hook last long
enough to be seen as continuous flashing.

Move the Windows POST to the shared curl.exe builder every other agent already uses, via
the `extraFormLines` escape hatch for the `hook_event_name` field Antigravity uniquely
needs. Measured on Windows 11: 326ms -> 134ms per event.

Because the curl line percent-expands its arguments, the script also needs
`setlocal DisableDelayedExpansion` (stablyai#9358/stablyai#9941) so a `!` in a pane key or worktree path
is not eaten as a delayed reference.

curl omits a `--data-urlencode name@-` field entirely when stdin is empty, so accept an
absent or blank Antigravity payload as `{}` at the ingest boundary — the POSIX script
substitutes `{}` before posting and PowerShell did the same, and without this a
payload-less event lost the status transition its `hook_event_name` still carried. Scoped
to that source; every other agent keeps rejecting a body it cannot parse.

Adds a cross-agent guard asserting the invariant the original drift violated: a managed
Windows .cmd hook posts through fully-qualified curl.exe and spawns no interpreter.
Generated under a mocked win32 platform so the POSIX CI legs guard it too.

Validated on a real Windows 11 host, not an emulated platform check.

Fixes stablyai#15117
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…Shell on every event (stablyai#15520)

Antigravity was the last agent posting hook status through Windows PowerShell 5.1. Every
hook event — roughly one every 2-6s during an active session — paid a ~300ms interpreter
cold start, which is what made the console the agent allocates for each hook last long
enough to be seen as continuous flashing.

Move the Windows POST to the shared curl.exe builder every other agent already uses, via
the `extraFormLines` escape hatch for the `hook_event_name` field Antigravity uniquely
needs. Measured on Windows 11: 326ms -> 134ms per event.

Because the curl line percent-expands its arguments, the script also needs
`setlocal DisableDelayedExpansion` (stablyai#9358/stablyai#9941) so a `!` in a pane key or worktree path
is not eaten as a delayed reference.

curl omits a `--data-urlencode name@-` field entirely when stdin is empty, so accept an
absent or blank Antigravity payload as `{}` at the ingest boundary — the POSIX script
substitutes `{}` before posting and PowerShell did the same, and without this a
payload-less event lost the status transition its `hook_event_name` still carried. Scoped
to that source; every other agent keeps rejecting a body it cannot parse.

Adds a cross-agent guard asserting the invariant the original drift violated: a managed
Windows .cmd hook posts through fully-qualified curl.exe and spawns no interpreter.
Generated under a mocked win32 platform so the POSIX CI legs guard it too.

Validated on a real Windows 11 host, not an emulated platform check.

Fixes stablyai#15117
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] Windows: Antigravity agent hooks spawn a visible console (cmd.exe + powershell.exe) on every invocation and tool call

1 participant