Language Server Fails to Initialize Agent When Git Repository Uses worktreeConfig Extension

Summary

Antigravity IDE’s Language Server crashes on the GetAgentScripts RPC call when the opened workspace is a Git repository with core.repositoryformatversion = 1 and extensions.worktreeConfig = true. This prevents the AI agent from initializing, making the chat completely unresponsive — the user can send messages but never receives any response.

Environment

  • Antigravity IDE Version: Latest as of 2026-04-12
  • OS: Windows 10/11
  • Git Version: 2.50.1.windows.1
  • Language Server Binary: language_server_windows_x64.exe

Steps to Reproduce

  1. Create or open a Git repository that has (or has had) a git worktree configured.
    This results in the following .git/config:

    [core]
        repositoryformatversion = 1
    [extensions]
        worktreeConfig = true
    

    Note: Git automatically sets repositoryformatversion = 1 and adds extensions.worktreeConfig = true when a worktree is created via git worktree add. These settings persist even after the worktree is removed.

  2. Open this folder in Antigravity IDE via File → Open Folder.

  3. Open the AI chat panel and send any message.

Expected: The AI agent responds to the message.
Actual: The message is sent but no response is ever received. The chat appears to hang indefinitely.

Root Cause (from log analysis)

The Language Server’s internal git parser does not support repositoryformatversion = 1 with the worktreeConfig extension. This causes the GetAgentScripts gRPC call to fail repeatedly, which prevents the agent trajectory/cascade from being created. When the user sends a message, it fails silently because no trajectory exists.

Error Chain (from logs)

Stage 1 — GetAgentScripts fails repeatedly:

E0412 16:05:14.192760 interceptor.go:74
  /exa.language_server_pb.LanguageServerService/GetAgentScripts (unknown):
  core.repositoryformatversion does not support extension: worktreeconfig

This error repeats 6+ times at ~16:05:14 – 16:05:35 (ls-main.log).

Stage 2 — Agent/cascade never initializes:

E0412 16:05:39.436635 log.go:398
  Failed to cancel agent 60229606-32d5-4671-a9ca-c89838cf1ace: cascade not found

Stage 3 — User message delivery fails:

E0412 16:05:45.160385 interceptor.go:74
  /exa.language_server_pb.LanguageServerService/SendUserCascadeMessage (unknown):
  trajectory not found: 60229606-32d5-4671-a9ca-c89838cf1ace

Stage 4 — Agent state stream enters infinite error loop:

E0412 16:05:40.451812 – 16:05:55.700607 (repeating every ~1s)
  /exa.language_server_pb.LanguageServerService/StreamAgentStateUpdates (unknown):
  agent state for conversation 60229606-32d5-4671-a9ca-c89838cf1ace not found

This loop continues indefinitely with no recovery mechanism.

Impact

  • Severity: High — The AI assistant is completely non-functional for the affected workspace.
  • User experience: No error message is shown to the user. The chat simply never responds, making it appear as if the service is down. The user has no way to diagnose the issue without reading internal log files.
  • Scope: Any Git repository that has ever used git worktree will have this configuration permanently (Git does not revert repositoryformatversion when worktrees are removed). This is a standard, widely-used Git feature.

Workaround

Manually edit the .git/config file to remove the worktreeConfig extension and downgrade the repository format version:

git config --unset extensions.worktreeConfig
git config core.repositoryformatversion 0

Then restart Antigravity IDE.

Caveat: This workaround is only safe if there are no active worktrees. If the repository actively uses worktrees, this workaround will break the worktree setup.

Suggested Improvements

  1. Primary fix: Update the Language Server’s git parser to support repositoryformatversion = 1 and the worktreeConfig extension. This is a standard Git feature (introduced in Git 2.20) and should be handled gracefully.

  2. Graceful degradation: If the Language Server cannot parse the git configuration, it should still initialize the agent session. Git metadata is not required for the AI chat to function — the agent should fall back to operating without git context rather than failing entirely.

  3. User-facing error message: When the agent fails to initialize, display a clear error message in the chat panel (e.g., “Unable to initialize AI agent for this workspace. Check logs for details.”) instead of silently dropping all messages.

  4. Error loop prevention: The StreamAgentStateUpdates call enters an infinite retry loop (every ~1 second) when the agent state doesn’t exist. This should have a backoff strategy and a maximum retry count to avoid wasting resources.

Log Files

Full log session: %APPDATA%\Antigravity\logs\20260412T153503\

Key files:

  • ls-main.log — Language Server errors (GetAgentScripts, worktreeconfig, trajectory not found)
  • agent-window-console.log — Client-side agent state errors and Failed to send message
  • window1\renderer.log — Extension host lifecycle
  • window1\exthost\vscode.git\Git.log — Git extension successfully opening the repository (confirming Git itself has no issue)
  • window1\exthost\google.antigravity\Antigravity.log — Language server lifecycle (starts and stops normally, no errors logged here)