On Windows, the Antigravity desktop applications spawn a backend Go-based language server (language_server.exe) to manage tasks, code analysis, and run commands. Because the Node/Electron host processes and the spawned Go language server share the same console group, any console interrupt signal (such as hitting Ctrl+C in an active terminal or terminating a reloading dev server) propagates to all processes in that console group.
Go’s runtime contains a default signal handler that intercepts CTRL_C_EVENT / SIGINT. When it catches this signal, language_server.exe terminates immediately (usually exiting with code 0).
When the language server crashes or exits:
-
The Electron frontend loses its IPC connection to the backend.
-
The UI automatically triggers a page refresh to recover the session.
-
Your current task execution is abruptly halted, and the screen resets to a new conversation.
This patch resolves the crash by introducing a lightweight Python process wrapper (ls_wrapper.py) that acts as a signal-isolated buffer between Electron and the language server.
How it Works:
-
Signal Isolation: The wrapper utilizes the Windows API via
ctypesto callSetConsoleCtrlHandler(None, 1). This ignores console control events (such asCtrl+CandCtrl+Break). Because child processes inherit the signal-handling state of their parent, the nestedlanguage_server.exeignores these console-wide interrupts. -
Process Lifecycle Management: Since the standard Ctrl+C signal is ignored, we must prevent orphaned language server processes when the host application closes. The wrapper creates a Windows Job Object configured with
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSEand assigns the language server process to it. When the wrapper process is terminated (e.g., when Electron kills its child process), the OS automatically and cleanly terminateslanguage_server.exe. -
Log Persistence: By default, the application resets the language server log file on every launch (
flags: 'w'). The patch updates this to append mode (flags: 'a') to preserve error diagnostics across app restarts.