t3code
t3code copied to clipboard
fix: prevent Antigravity session resume wedge and use atomic git worktree add -b
Summary
-
Antigravity ACP sessions can wedge after an interrupted turn (
Failed to launch two-stage session)- Interrupted
antigravity-acpturns can leave trailingstepsrows in<appDataDir>/brain/<conversationId>/conversation.dbwithstatus = 'WAITING', causing subsequent session activations to fail or wedge. AcpCoreAdapter.activateSession()always callssession/loadbeforesession/resume, replaying the full history stream (which can exceed the 30s RPC timeout on long threads) even whenunstable_resumeSessionis supported.- Timed-out
session/cancelor failedactivateSessioncalls can leave the cached ACP child process in a bad state, andretireRuntimefiredoptions.onTerminationtwice.
- Interrupted
-
GitVcsDriver.createWorktreecreates the branch in a separate step before `git worktree addcreateWorktreerunscreateBranchAt(git branch --no-track -- <newBranch> <startPoint>) in the parent repository before runninggit worktree add -- <path> <newBranch>.- If
git worktree addfails (e.g., target path collision or checkout failure), the newly created local branch is left orphaned in the repository.
Proposed Fix
AntigravitySessionFiles.ts: Sanitizeconversation.dbbefore starting/resuming by updating any stuckstatus = 'WAITING'rows instepsto'CANCELED'.AcpCoreAdapter.ts/AntigravityAdapterV2.ts: AddpreferResumeSession: trueso Antigravity attemptssession/resumebeforesession/loadwhen supported.AcpCoreAdapter.ts/AntigravityAdapterV2.ts: MarkruntimeRestartRequired = truewhenactivateSessionfails,runtime.cancelfails, or the 10s interrupt wait times out, and ensureoptions.onTerminationfires once from the process exit handler.GitVcsDriverCore.ts: Create the worktree and branch atomically in one step viagit worktree add --no-track -b <newBranch> -- <worktreePath> <startPoint>, then configure upstream tracking only whenstartPointresolves torefs/remotes/*.