Non-invasive MCP accelerator plugin for Google Antigravity (CLI/Desktop/IDE): cuts LLM turns (-34%), token quota (-31%), and upload traffic (-40%) without affecting native UI or diffs.
TypeScript ai-agentai-codingantigravityantigravity-cliantigravity-ideantigravity-pluginscoding-agentcontext-optimizationdeveloper-productivitydeveloper-toolsgeminigoogle-antigravitylatency-optimizationmcpmcp-pluginmcp-servermodel-context-protocolperformanceplugintoken-optimization
fix(apply-edits): surface verify-fail badge on first line within 8800B budget
acrot01ddb9891cbfd
diff --git a/dist/mcp-server.mjs b/dist/mcp-server.mjsindex 0f2e711..6f090e7 100755--- a/dist/mcp-server.mjs+++ b/dist/mcp-server.mjs@@ -4421,12 +4421,15 @@ Verify [${status} in ${res.durationMs}ms] \`${verifySpec.command}\`:timedOut: res.timedOut,error: res.error});- const minApplied = `${header} (${formatAppliedSummaryCompact(summaryLines.length, noOpCount, false)}; list omitted to preserve verify diagnostics)`;+ const verifyScopedHeader = status === "PASS" ? header : `${header} [VERIFY ${status} \u2014 fix before proceeding]`;+ const verifyAppliedFull = `${verifyScopedHeader}+${summaryLines.join("\n")}`;+ const minApplied = `${verifyScopedHeader} (${formatAppliedSummaryCompact(summaryLines.length, noOpCount, false)}; list omitted to preserve verify diagnostics)`;const reservedForApplied = status === "PASS" ? Math.min(Buffer.byteLength(appliedFull, "utf8"),DEFAULT_INLINE_MAX_BYTES - 512) : Math.min(- Buffer.byteLength(appliedFull, "utf8"),+ Buffer.byteLength(verifyAppliedFull, "utf8"),Buffer.byteLength(minApplied, "utf8"));const maxVerifyBodyBytes = Math.max(@@ -4462,7 +4465,7 @@ Verify [${status} in ${res.durationMs}ms] \`${verifySpec.command}\`:const verifySection = `${verifyPrefix}${formatted}`;const remainingAppliedBytes = totalByteLimit - Buffer.byteLength(verifySection, "utf8");const appliedSection2 = compactSummaryLinesToBytes(- header,+ verifyScopedHeader,summaryLines,noOpCount,Math.max(64, remainingAppliedBytes)diff --git a/src/tools/apply-edits.ts b/src/tools/apply-edits.tsindex 30cd3f3..66ec01a 100644--- a/src/tools/apply-edits.ts+++ b/src/tools/apply-edits.ts@@ -2308,7 +2308,14 @@ export async function runApplyEdits(error: res.error,});- const minApplied = `${header} (${formatAppliedSummaryCompact(summaryLines.length, noOpCount, false)}; list omitted to preserve verify diagnostics)`;+ // Surface verify failures on the very first line so models skimming the+ // header never miss a broken post-edit check.+ const verifyScopedHeader =+ status === "PASS"+ ? header+ : `${header} [VERIFY ${status} — fix before proceeding]`;+ const verifyAppliedFull = `${verifyScopedHeader}\n${summaryLines.join("\n")}`;+ const minApplied = `${verifyScopedHeader} (${formatAppliedSummaryCompact(summaryLines.length, noOpCount, false)}; list omitted to preserve verify diagnostics)`;const reservedForApplied =status === "PASS"? Math.min(@@ -2316,7 +2323,7 @@ export async function runApplyEdits(DEFAULT_INLINE_MAX_BYTES - 512,): Math.min(- Buffer.byteLength(appliedFull, "utf8"),+ Buffer.byteLength(verifyAppliedFull, "utf8"),Buffer.byteLength(minApplied, "utf8"),);const maxVerifyBodyBytes = Math.max(@@ -2361,7 +2368,7 @@ export async function runApplyEdits(const remainingAppliedBytes =totalByteLimit - Buffer.byteLength(verifySection, "utf8");const appliedSection = compactSummaryLinesToBytes(- header,+ verifyScopedHeader,summaryLines,noOpCount,Math.max(64, remainingAppliedBytes),diff --git a/test/apply-edits.test.ts b/test/apply-edits.test.tsindex eb4e8f4..4aa12ac 100644--- a/test/apply-edits.test.ts+++ b/test/apply-edits.test.ts@@ -333,6 +333,7 @@ describe("apply_edits", () => {verify: `${JSON.stringify(process.execPath)} -e "console.log('12 tests passed')"`,});assert.equal(passRes.isError, false);+ assert.doesNotMatch(passRes.text.split("\n")[0] ?? "", /\[VERIFY /);assert.match(passRes.text, /Verify \[PASS/);assert.match(passRes.text, /12 tests passed/);@@ -344,9 +345,35 @@ describe("apply_edits", () => {verify: `${JSON.stringify(process.execPath)} -e "console.error('TypeError: bad value'); process.exit(1)"`,});assert.equal(failRes.isError, false);+ assert.match(+ failRes.text.split("\n")[0] ?? "",+ /\[VERIFY FAIL \(exit 1\) — fix before proceeding\]/,+ );assert.match(failRes.text, /Verify \[FAIL \(exit 1\)/);assert.match(failRes.text, /TypeError: bad value/);assert.equal(await fs.readFile(f, "utf8"), "const x = 3;\n");++ // Large multibyte failing verify under tight 8800 B budget must keep the full+ // line-1 verify badge intact and stay strictly within 8800 UTF-8 bytes.+ const bigFailRes = await runApplyEdits({+ cwd: tmpDir,+ edits: [+ { path: "check.js", hunks: [{ target: "x = 3", replacement: "x = 4" }] },+ ],+ verify: `${JSON.stringify(process.execPath)} -e "for (let i = 0; i < 400; i++) console.error('错误诊断行_' + i + '_' + '汉'.repeat(20)); process.exit(1)"`,+ maxVerifyChars: 7500,+ });+ assert.equal(bigFailRes.isError, false);+ assert.match(+ bigFailRes.text.split("\n")[0] ?? "",+ /^Applied edits to 1 file\(s\): \[VERIFY FAIL \(exit 1\) — fix before proceeding\]$/,+ );+ assert.ok(+ Buffer.byteLength(bigFailRes.text, "utf8") <= 8800,+ `Expected <= 8800 bytes, got ${Buffer.byteLength(bigFailRes.text, "utf8")}`,+ );+ assert.match(bigFailRes.text, /Verify \[FAIL \(exit 1\)/);+ assert.equal(await fs.readFile(f, "utf8"), "const x = 4;\n");});it("refuses overwriting existing file with create unless overwrite is true", async () => {