Skip to content

[Bug]: statusLine/title refresh runner leaks orphaned subprocesses on kill timeout (TerminateProcess: Access is denied) — accumulates into OutOfMemoryException over sustained use #709

Description

@RegreDanger

Antigravity CLI Version

1.1.8

Environment Context

  • OS: Windows 11 Pro, build 10.0.22621
  • Shell: Windows PowerShell 5.1 (powershell.exe), invoked via a custom statusLine/title command in settings.json
  • Terminal Emulator: Windows Terminal
  • Runtime Version: PowerShell 5.1.22621.4249
  • Hardware Details: 15.88GB RAM total (relevant below — the eventual crash is not caused by physical memory exhaustion)

Steps to Reproduce

  • Configure a custom statusLine and/or title command in settings.json pointing to an external script (PowerShell in this case, but the mechanism is independent of the script's language):

    {
      "statusLine": {
        "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:/Users/<username>/.gemini/antigravity-cli/statusline.ps1",
        "enabled": true
      },
      "title": {
        "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:/Users/<username>/.gemini/antigravity-cli/title.ps1",
        "enabled": true
      }
    }
  • Use agy normally for an extended period (hours). No special action is needed to trigger it — it happens as a background side effect of normal refresh ticks.

  • Periodically, a given tick's subprocess invocation runs long enough that the runner decides to kill it (timeout). Check the CLI log at that point (log/cli-*.log).

Expected Behavior

When a statusLine/title subprocess invocation times out, the runner should successfully terminate it and move on cleanly on the next tick, leaving no residual process behind.

Actual Behavior / Error Screenshots

The kill attempt itself fails, and the subprocess is left running indefinitely instead of being cleaned up. The CLI log shows this exact pattern repeating:

statusline: command failed: exit status 1 (stderr: ) (failure 1/30)
statusline: command failed: exec: canceling Cmd: TerminateProcess: Access is denied. (stderr: ) (failure 1/30)

Visibly, this surfaces in the TUI as intermittent:

⚠ Statusline Error
  ⎿  ⚠ Statusline error:
     command failed: exit status 1 (stderr: )
     Full logs at: C:\Users\<username>\.gemini\antigravity-cli\log\cli-....log

Because the failed kill leaves the process alive, this accumulates over time rather than self-correcting. In our case, we found 565 orphaned powershell.exe processes via Task Manager / Get-Process, the oldest dated ~50 hours prior to discovery — all idle (0% CPU, ~1MB working set each, Responding: True), confirmed via Win32_Process.CommandLine (CIM/WMI) to all be invocations of the configured statusLine/title script. The sheer process/handle count (3,790 kernel handles from these alone) eventually degraded new-process creation system-wide enough to throw a genuine System.OutOfMemoryException when the runner tried to spawn the next refresh tick — this is kernel handle/session quota exhaustion, not physical RAM exhaustion (5.48GB remained free at the time).

Note: this reproduces identically with a compiled native binary (e.g. a Go .exe) in place of the PowerShell script instead of powershell.exe -File ... — confirms the bug is in the runner's own process-kill path (exec: canceling Cmd: TerminateProcess), not specific to PowerShell or any particular scripting language.

Logs & Configurations

Relevant excerpt from %APPDATA%\antigravity-cli\log\cli-*.log (timestamps/PIDs are illustrative, pattern repeats verbatim across many separate occurrences over the 50-hour window):

I<timestamp> statusline_runner.go:258] statusline: command failed: exit status 1 (stderr: ) (failure 1/30)
I<timestamp> statusline_runner.go:258] statusline: command failed: exec: canceling Cmd: TerminateProcess: Access is denied. (stderr: ) (failure 1/30)
I<timestamp> statusline_runner.go:258] statusline: command failed: exit status 1 (stderr: ) (failure 1/30)

settings.json (statusLine/title block, path sanitized):

{
  "statusLine": {
    "type": "command",
    "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:/Users/<username>/.gemini/antigravity-cli/statusline.ps1",
    "enabled": true
  },
  "title": {
    "type": "command",
    "command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:/Users/<username>/.gemini/antigravity-cli/title.ps1",
    "enabled": true
  }
}

Verification commands used to confirm the leak (Windows PowerShell):

Get-CimInstance Win32_Process -Filter "Name='powershell.exe'" |
    Select-Object ProcessId, CreationDate, CommandLine

Happy to provide the full process dump, further log excerpts, or test a proposed fix — this was reproduced consistently over a multi-day session, not a one-off.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingcomp:customizationsPlugins & Skills, MCP, Status Line, Window TitleperformancePerformance issues (e.g., hanging processes, infinite model loops, memory leak)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions