Skip to content

fix: prevent Antigravity session resume wedge and use atomic git worktree add -b #28354

Closed

Description

@mellowmarshall

Summary

  1. Antigravity ACP sessions can wedge after an interrupted turn (Failed to launch two-stage session)

    • Interrupted antigravity-acp turns can leave trailing steps rows in <appDataDir>/brain/<conversationId>/conversation.db with status = 'WAITING', causing subsequent session activations to fail or wedge.
    • AcpCoreAdapter.activateSession() always calls session/load before session/resume, replaying the full history stream (which can exceed the 30s RPC timeout on long threads) even when unstable_resumeSession is supported.
    • Timed-out session/cancel or failed activateSession calls can leave the cached ACP child process in a bad state, and retireRuntime fired options.onTermination twice.
  2. GitVcsDriver.createWorktree creates the branch in a separate step before `git worktree add

    • createWorktree runs createBranchAt (git branch --no-track -- <newBranch> <startPoint>) in the parent repository before running git worktree add -- <path> <newBranch>.
    • If git worktree add fails (e.g., target path collision or checkout failure), the newly created local branch is left orphaned in the repository.

Proposed Fix

  • AntigravitySessionFiles.ts: Sanitize conversation.db before starting/resuming by updating any stuck status = 'WAITING' rows in steps to 'CANCELED'.
  • AcpCoreAdapter.ts / AntigravityAdapterV2.ts: Add preferResumeSession: true so Antigravity attempts session/resume before session/load when supported.
  • AcpCoreAdapter.ts / AntigravityAdapterV2.ts: Mark runtimeRestartRequired = true when activateSession fails, runtime.cancel fails, or the 10s interrupt wait times out, and ensure options.onTermination fires once from the process exit handler.
  • GitVcsDriverCore.ts: Create the worktree and branch atomically in one step via git worktree add --no-track -b <newBranch> -- <worktreePath> <startPoint>, then configure upstream tracking only when startPoint resolves to refs/remotes/*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions