@simonepri/refined-antigravity-acp 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/fixes/orphaned-checkpoints/index.d.ts +11 -1
- package/dist/src/fixes/orphaned-checkpoints/index.d.ts.map +1 -1
- package/dist/src/fixes/orphaned-checkpoints/index.js +126 -15
- package/dist/src/fixes/orphaned-checkpoints/index.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +1 -0
|
@@ -12,18 +12,28 @@
|
|
|
12
12
|
import { type AcpFix } from "../../core/types.js";
|
|
13
13
|
export declare const STEP_TYPE_USER = 14;
|
|
14
14
|
export declare const STEP_TYPE_AGENT = 15;
|
|
15
|
+
export declare const STEP_TYPE_ERROR = 17;
|
|
15
16
|
export declare const STEP_TYPE_CHECKPOINT = 23;
|
|
16
17
|
export declare const CHECKPOINT_STATUS_IN_PROGRESS = 2;
|
|
17
18
|
export declare const CHECKPOINT_STATUS_ABORTED = 5;
|
|
18
19
|
export declare const DONE_CH_PANIC_MARKER = "could not find doneCh for checkpoint";
|
|
19
20
|
export declare function getConversationDbPath(sessionId: string): string;
|
|
21
|
+
export declare function extractExecutorMetadataStepIdx(data: Uint8Array): number | null;
|
|
22
|
+
export declare function extractGenMetadataStepIndices(data: Uint8Array): {
|
|
23
|
+
stepIdx: number | null;
|
|
24
|
+
earliestIdx: number | null;
|
|
25
|
+
};
|
|
20
26
|
/**
|
|
21
27
|
* Automatically repairs orphaned in-progress steps (status=2), including checkpoints
|
|
22
28
|
* (step_type=23) and action/tool steps (step_type=21), left behind by cancelled, aborted,
|
|
23
29
|
* or interrupted Antigravity turns. Setting status=5 (aborted) prevents Antigravity
|
|
24
30
|
* from crashing on resumption or next prompt with "could not find doneCh for checkpoint".
|
|
25
31
|
*
|
|
26
|
-
*
|
|
32
|
+
* Also prunes orphaned or out-of-bounds `executor_metadata` and `gen_metadata` entries
|
|
33
|
+
* whose step indices exceed the maximum valid step in `steps`, preventing fatal Go executor
|
|
34
|
+
* panics ("earliest step index is out of bounds: X vs Y").
|
|
35
|
+
*
|
|
36
|
+
* Returns the number of repaired steps and metadata records.
|
|
27
37
|
*/
|
|
28
38
|
export declare function repairOrphanedCheckpoints(sessionId: string, customDbPath?: string): number;
|
|
29
39
|
export declare const orphanedCheckpointsFix: AcpFix;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fixes/orphaned-checkpoints/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,EAGL,KAAK,MAAM,EAEZ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fixes/orphaned-checkpoints/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,EAGL,KAAK,MAAM,EAEZ,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAC/C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,eAAO,MAAM,oBAAoB,yCAAyC,CAAC;AAE3E,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAsB9E;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,UAAU,GAAG;IAC/D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAuBA;AA8DD;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAsC1F;AAED,eAAO,MAAM,sBAAsB,EAAE,MAiBpC,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAyB,CAAC"}
|
|
@@ -15,8 +15,10 @@ import { join } from "node:path";
|
|
|
15
15
|
import { DatabaseSync } from "node:sqlite";
|
|
16
16
|
import { ACP_METHODS, } from "../../core/types.js";
|
|
17
17
|
import { extractSessionId } from "../../core/session-cache.js";
|
|
18
|
+
import { decodeVarint, getField } from "../../lib/protobuf.js";
|
|
18
19
|
export const STEP_TYPE_USER = 14;
|
|
19
20
|
export const STEP_TYPE_AGENT = 15;
|
|
21
|
+
export const STEP_TYPE_ERROR = 17;
|
|
20
22
|
export const STEP_TYPE_CHECKPOINT = 23;
|
|
21
23
|
export const CHECKPOINT_STATUS_IN_PROGRESS = 2;
|
|
22
24
|
export const CHECKPOINT_STATUS_ABORTED = 5;
|
|
@@ -25,13 +27,120 @@ export function getConversationDbPath(sessionId) {
|
|
|
25
27
|
const geminiHome = process.env.GEMINI_HOME || join(homedir(), ".gemini");
|
|
26
28
|
return join(geminiHome, "antigravity-acp", "conversations", `${sessionId}.db`);
|
|
27
29
|
}
|
|
30
|
+
export function extractExecutorMetadataStepIdx(data) {
|
|
31
|
+
let offset = 0;
|
|
32
|
+
while (offset < data.length) {
|
|
33
|
+
const [tag, nextOffset] = decodeVarint(data, offset);
|
|
34
|
+
const fieldNum = tag >> 3;
|
|
35
|
+
const wireType = tag & 7;
|
|
36
|
+
if (wireType === 0) {
|
|
37
|
+
const [v, after] = decodeVarint(data, nextOffset);
|
|
38
|
+
if (fieldNum === 3)
|
|
39
|
+
return v;
|
|
40
|
+
offset = after;
|
|
41
|
+
}
|
|
42
|
+
else if (wireType === 2) {
|
|
43
|
+
const [len, afterLen] = decodeVarint(data, nextOffset);
|
|
44
|
+
offset = afterLen + len;
|
|
45
|
+
}
|
|
46
|
+
else if (wireType === 1) {
|
|
47
|
+
offset = nextOffset + 8;
|
|
48
|
+
}
|
|
49
|
+
else if (wireType === 5) {
|
|
50
|
+
offset = nextOffset + 4;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
export function extractGenMetadataStepIndices(data) {
|
|
59
|
+
let stepIdx = null;
|
|
60
|
+
let earliestIdx = null;
|
|
61
|
+
const f2 = getField(data, 2);
|
|
62
|
+
if (f2 && f2.length >= 2) {
|
|
63
|
+
const [v1] = decodeVarint(f2, 0);
|
|
64
|
+
stepIdx = v1;
|
|
65
|
+
}
|
|
66
|
+
const f1 = getField(data, 1);
|
|
67
|
+
if (f1) {
|
|
68
|
+
const f9 = getField(f1, 9);
|
|
69
|
+
if (f9 && f9.length >= 2) {
|
|
70
|
+
const [tag, off] = decodeVarint(f9, 0);
|
|
71
|
+
if (tag >> 3 === 1) {
|
|
72
|
+
const [val] = decodeVarint(f9, off);
|
|
73
|
+
earliestIdx = val;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { stepIdx, earliestIdx };
|
|
78
|
+
}
|
|
79
|
+
function repairStepCheckpoints(db) {
|
|
80
|
+
const stmt = db.prepare(`
|
|
81
|
+
UPDATE steps
|
|
82
|
+
SET status = ${CHECKPOINT_STATUS_ABORTED},
|
|
83
|
+
step_payload = CASE
|
|
84
|
+
WHEN length(step_payload) >= 4 AND substr(step_payload, 3, 2) = x'2002'
|
|
85
|
+
THEN CAST(substr(step_payload, 1, 3) || x'05' || substr(step_payload, 5) AS BLOB)
|
|
86
|
+
ELSE step_payload
|
|
87
|
+
END
|
|
88
|
+
WHERE status = ${CHECKPOINT_STATUS_IN_PROGRESS} OR (length(step_payload) >= 4 AND substr(step_payload, 3, 2) = x'2002');
|
|
89
|
+
`);
|
|
90
|
+
return Number(stmt.run().changes);
|
|
91
|
+
}
|
|
92
|
+
function pruneExecutorMetadata(db, maxStepIdx) {
|
|
93
|
+
const hasTable = db
|
|
94
|
+
.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'executor_metadata'")
|
|
95
|
+
.get();
|
|
96
|
+
if (!hasTable)
|
|
97
|
+
return 0;
|
|
98
|
+
let pruned = 0;
|
|
99
|
+
const rows = db
|
|
100
|
+
.prepare("SELECT idx, data FROM executor_metadata ORDER BY idx DESC")
|
|
101
|
+
.all();
|
|
102
|
+
for (const row of rows) {
|
|
103
|
+
if (!row.data)
|
|
104
|
+
continue;
|
|
105
|
+
const step = extractExecutorMetadataStepIdx(row.data);
|
|
106
|
+
if (step !== null && step > maxStepIdx) {
|
|
107
|
+
db.prepare("DELETE FROM executor_metadata WHERE idx = ?").run(row.idx);
|
|
108
|
+
pruned++;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return pruned;
|
|
112
|
+
}
|
|
113
|
+
function pruneGenMetadata(db, maxStepIdx) {
|
|
114
|
+
const hasTable = db
|
|
115
|
+
.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'gen_metadata'")
|
|
116
|
+
.get();
|
|
117
|
+
if (!hasTable)
|
|
118
|
+
return 0;
|
|
119
|
+
let pruned = 0;
|
|
120
|
+
const rows = db.prepare("SELECT idx, data FROM gen_metadata ORDER BY idx DESC").all();
|
|
121
|
+
for (const row of rows) {
|
|
122
|
+
if (!row.data)
|
|
123
|
+
continue;
|
|
124
|
+
const { stepIdx, earliestIdx } = extractGenMetadataStepIndices(row.data);
|
|
125
|
+
if ((stepIdx !== null && stepIdx > maxStepIdx) ||
|
|
126
|
+
(earliestIdx !== null && earliestIdx > maxStepIdx)) {
|
|
127
|
+
db.prepare("DELETE FROM gen_metadata WHERE idx = ?").run(row.idx);
|
|
128
|
+
pruned++;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return pruned;
|
|
132
|
+
}
|
|
28
133
|
/**
|
|
29
134
|
* Automatically repairs orphaned in-progress steps (status=2), including checkpoints
|
|
30
135
|
* (step_type=23) and action/tool steps (step_type=21), left behind by cancelled, aborted,
|
|
31
136
|
* or interrupted Antigravity turns. Setting status=5 (aborted) prevents Antigravity
|
|
32
137
|
* from crashing on resumption or next prompt with "could not find doneCh for checkpoint".
|
|
33
138
|
*
|
|
34
|
-
*
|
|
139
|
+
* Also prunes orphaned or out-of-bounds `executor_metadata` and `gen_metadata` entries
|
|
140
|
+
* whose step indices exceed the maximum valid step in `steps`, preventing fatal Go executor
|
|
141
|
+
* panics ("earliest step index is out of bounds: X vs Y").
|
|
142
|
+
*
|
|
143
|
+
* Returns the number of repaired steps and metadata records.
|
|
35
144
|
*/
|
|
36
145
|
export function repairOrphanedCheckpoints(sessionId, customDbPath) {
|
|
37
146
|
const dbPath = customDbPath ?? getConversationDbPath(sessionId);
|
|
@@ -40,20 +149,21 @@ export function repairOrphanedCheckpoints(sessionId, customDbPath) {
|
|
|
40
149
|
let db = null;
|
|
41
150
|
try {
|
|
42
151
|
db = new DatabaseSync(dbPath, { timeout: 2000 });
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
152
|
+
let repairedCount = repairStepCheckpoints(db);
|
|
153
|
+
const maxRow = db
|
|
154
|
+
.prepare(`SELECT max(idx) as m FROM steps WHERE step_type != ${STEP_TYPE_ERROR}`)
|
|
155
|
+
.get();
|
|
156
|
+
const maxStepIdx = maxRow?.m ?? null;
|
|
157
|
+
if (maxStepIdx !== null) {
|
|
158
|
+
const cleanErrorSteps = db
|
|
159
|
+
.prepare(`DELETE FROM steps WHERE idx > ? AND step_type = ${STEP_TYPE_ERROR}`)
|
|
160
|
+
.run(maxStepIdx);
|
|
161
|
+
repairedCount += Number(cleanErrorSteps.changes);
|
|
162
|
+
repairedCount += pruneExecutorMetadata(db, maxStepIdx);
|
|
163
|
+
repairedCount += pruneGenMetadata(db, maxStepIdx);
|
|
164
|
+
}
|
|
55
165
|
if (repairedCount > 0) {
|
|
56
|
-
console.error(`[refined-antigravity-acp] Repaired ${repairedCount} orphaned checkpoint/step(s) for session ${sessionId}`);
|
|
166
|
+
console.error(`[refined-antigravity-acp] Repaired ${repairedCount} orphaned checkpoint/step/metadata record(s) for session ${sessionId}`);
|
|
57
167
|
}
|
|
58
168
|
return repairedCount;
|
|
59
169
|
}
|
|
@@ -69,7 +179,8 @@ export const orphanedCheckpointsFix = {
|
|
|
69
179
|
name: "orphaned-checkpoints",
|
|
70
180
|
description: "Repairs orphaned in-progress SQLite checkpoints to prevent fatal doneCh panics on resumption",
|
|
71
181
|
onOutbound(msg, _context) {
|
|
72
|
-
if ("method" in msg &&
|
|
182
|
+
if ("method" in msg &&
|
|
183
|
+
(msg.method === ACP_METHODS.SESSION_LOAD || msg.method === ACP_METHODS.SESSION_PROMPT)) {
|
|
73
184
|
const sessionId = extractSessionId(msg);
|
|
74
185
|
if (sessionId) {
|
|
75
186
|
repairOrphanedCheckpoints(sessionId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fixes/orphaned-checkpoints/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,WAAW,GAIZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CA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G,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CACX,sCAAsC,aAAa,4DAA4D,SAAS,EAAE,CAC3H,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CACX,sEAAsE,SAAS,GAAG,EAClF,GAAG,CACJ,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,EAAE,EAAE,KAAK,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAW;IAC5C,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,8FAA8F;IAEhG,UAAU,CAAC,GAAqB,EAAE,QAAyB;QACzD,IACE,QAAQ,IAAI,GAAG;YACf,CAAC,GAAG,CAAC,MAAM,KAAK,WAAW,CAAC,YAAY,IAAI,GAAG,CAAC,MAAM,KAAK,WAAW,CAAC,cAAc,CAAC,EACtF,CAAC;YACD,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,SAAS,EAAE,CAAC;gBACd,yBAAyB,CAAC,SAAS,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC"}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -149,6 +149,7 @@ The matrix below documents upstream defects across process startup, turn executi
|
|
|
149
149
|
| [**Interruption Cancellation Leak**](src/fixes/cancellation-leak/index.ts) | **Problem**: Interrupted turns leak raw internal Go/Python cancellation exception strings (_"context canceledThe request was cancelled by the client."_) directly into assistant message chunks.<br>🔗 [`problem: raw cancellation leak`](src/fixes/cancellation-leak/index.e2e.test.ts#L6) | Drops raw upstream cancellation error chunks so editor chat feeds remain clean on interruption.<br>🔗 [`solution: cancellation drop`](src/fixes/cancellation-leak/index.e2e.test.ts#L11) |
|
|
150
150
|
| [**Stale Ephemeral MCP Endpoints**](src/fixes/stale-mcp-endpoints/index.ts) | **Problem**: When a hung child process is recycled, resending initial `mcpServers` with outdated localhost ports fails because proxy endpoints have changed.<br>🔗 [`problem: stale proxy port`](src/fixes/stale-mcp-endpoints/index.e2e.test.ts#L20) | Uses `McpProxyPool` to dynamically intercept, remap, and heal MCP tool URLs across process restarts.<br>🔗 [`solution: proxy URL remapping`](src/fixes/stale-mcp-endpoints/index.e2e.test.ts#L20) |
|
|
151
151
|
| [**Orphaned SQLite Checkpoints**](src/fixes/orphaned-checkpoints/index.ts) | **Problem**: Canceling a turn leaves in-progress checkpoints uncommitted in SQLite, causing fatal panics (_"could not find doneCh for checkpoint"_) on future turns.<br>🔗 [`problem: orphaned checkpoint`](src/fixes/orphaned-checkpoints/index.e2e.test.ts#L11) | Scans the session SQLite database on startup and teardown, updating orphaned in-progress checkpoints to `ABORTED` (status 5).<br>🔗 [`solution: checkpoint repair`](src/fixes/orphaned-checkpoints/index.e2e.test.ts#L42) |
|
|
152
|
+
| [**Out-of-Bounds Generation Metadata**](src/fixes/orphaned-checkpoints/index.ts) | **Problem**: Canceling or truncating turns leaves orphaned metadata in SQLite referencing future step indices, causing Go executor panics (_"earliest step index is out of bounds"_).<br>🔗 [`problem: out-of-bounds metadata`](src/fixes/orphaned-checkpoints/index.e2e.test.ts#L224) | Automatically prunes orphaned executor and generation metadata referencing non-existent step indices on prompt and load.<br>🔗 [`solution: metadata pruning`](src/fixes/orphaned-checkpoints/index.e2e.test.ts#L268) |
|
|
152
153
|
| [**Unscoped Database Corruptions**](src/fixes/orphaned-checkpoints/index.ts) | **Problem**: Global database repair scans would mutate concurrent session databases across open tabs, corrupting active turns.<br>🔗 [`problem: concurrent tab safety`](src/fixes/orphaned-checkpoints/index.e2e.test.ts#L78) | Scopes checkpoint repair strictly to the target `sessionId.db`, isolating concurrent editor tabs.<br>🔗 [`solution: scoped session repair`](src/fixes/orphaned-checkpoints/index.e2e.test.ts#L117) |
|
|
153
154
|
| [**Database Concurrency Lockout**](src/fixes/orphaned-checkpoints/index.ts) | **Problem**: Raw `DatabaseSync` without busy timeout throws `SQLITE_BUSY: database is locked` when reading conversation steps during active writes.<br>🔗 [`problem: raw sqlite busy error`](src/fixes/orphaned-checkpoints/index.ts#L41) | Configures all database connections with `timeout: 2000` to wait out locks during concurrent reads and writes.<br>🔗 [`solution: sqlite timeout wait`](src/fixes/orphaned-checkpoints/index.ts#L41) |
|
|
154
155
|
| [**Dropped History Chunks on Load**](src/fixes/dropped-history-chunks/index.ts) | **Problem**: Raw `agy_acp_server` drops thought chains and agent message chunks during `session/load`, loading an incomplete history.<br>🔗 [`problem: dropped history chunks`](src/fixes/dropped-history-chunks/index.e2e.test.ts#L53) | Directly inspects protobuf steps in SQLite and reconstructs missing thought and message update events.<br>🔗 [`solution: sqlite history reconstruction`](src/fixes/dropped-history-chunks/index.e2e.test.ts#L99) |
|