When VS Code is configured with "files.autoSave": "afterDelay" (the default 1000ms delay) and "antigravity.enableInlineDiff": true (default in v1.5.0), all edits made by the Antigravity agent are automatically rejected and reverted to originalText after exactly 1 second before the user can accept or review them.
Environment & Versions
- Extension:
google.google-antigravity(v1.5.0) - CLI / Sidecar:
agy.exe(v1.2.12) - Host IDE: Microsoft VS Code (
win32-x64) - Key Settings:
"files.autoSave": "afterDelay","antigravity.enableInlineDiff": true
Steps to Reproduce
- In VS Code settings (
settings.json), set:
"files.autoSave": "afterDelay",
"antigravity.enableInlineDiff": true
2.Prompt the Antigravity agent to make changes to one or more files.
3.Observe the editor when the agent finishes applying changes.
Expected Behavior
Inline diff decorations and Accept / Reject buttons remain visible until the user explicitly accepts or rejects the changes.
Actual Behavior:
The agent finishes editing the file.
The Accept / Reject action appears for < 1 second and disappears.
All file changes are automatically reverted on disk back to their pre-edit state.
Root Cause Analysis (extension.js)
-
registerDiff() leaves the document dirty:
In InlineDiffManager.prototype.registerDiff, this.applyContentReplacement(document, activeDiff.combinedText) replaces the buffer with combinedText without saving, marking document.isDirty = true and starting VS Code’s 1000ms auto-save timer. -
handleDocumentWillSave() intercepts auto-save and reverts to originalText:
At 1000ms, VS Code fires onWillSaveTextDocument with
reason = vscode.TextDocumentSaveReason.AfterDelay (value 2):
if (event.reason != null && event.reason !== vscode.TextDocumentSaveReason.Manual) {
this.pendingAutoSaveUris.add(normalizedKey);
event.waitUntil(Promise.resolve([
vscode.TextEdit.replace(fullRange, activeDiff.originalText),
]));
return;
}
- handleDocumentDidSave() finalizes with accepted = false:
After writing originalText to disk, onDidSaveTextDocument triggers:
const isManualSave = this.pendingManualSaveUris.delete(normalizedKey); // false
this.finalizeFile(key, isManualSave); // passes false!
Calling finalizeFile(key, false) destroys the diff session and marks the hunk as rejected (SetFileDiffs: ).
Workaround
Add the following to VS Code’s settings.json to fall back to the side-by-side diff renderer:
“antigravity.enableInlineDiff”: false