antigravity 0.1.7: DeepSeek Harness's @-path paragraph goes reworded (#1028)

DSH desktop puts a paragraph on @ paths ("Tokens prefixed with @ are paths the user explicitly referenced…") in every system prompt. xueyinmei-dot replayed a recorded DSH request against gemini-4-argon: with the paragraph word for word, most answers came in ~3s at ~300 tok/s with no thinking and ended after one shallow step; with only that paragraph removed, or reworded, the request was answered normally (20 of 20 replays with the rewording, and a 12-step real DSH session).

shape() now sends that exact paragraph as their rewording, which says the same thing, after the zero-width breaks. Any other text, including a prompt that only mentions @ paths, goes as written. The match is the whole paragraph, so another app's prompt is not touched.

Run on mica (Bun 1.4.2, temp HOME): bun test packages/antigravity 95 pass 0 fail; bun scripts/check.mjs exit 0.
Broken by hand: outgoing() without reword() turns the new test red (shape.test.mjs 21 pass 1 fail).
Not tried: a real Antigravity account (the rewording's effect rests on the reporter's replays). magpie's built-in Antigravity path (internal/gateway/codeassist.go) gets the same rewording in its own commit.

Reported-by: xueyinmei-dot
This commit is contained in:
yetone
2026-11-12 12:15:18 +08:00
parent ae6a435ca8
commit acf9b5fd03
4 changed files with 45 additions and 3 deletions
+3
View File
@@ -86,6 +86,9 @@ The plugin also changes the request itself, as the built-in did:
- **System prompt:** lines Antigravity turns away (Claude Code's billing
header, Codex's and Hermes Agent's own prompts, omp's RFC 2119 line) are broken up with a
zero-width space.
DeepSeek Harness's paragraph on `@` paths ("Tokens prefixed with @ are
paths…") goes reworded with the same meaning: word for word, it got most
`gemini-4-argon` answers fast, without thinking and shallow (#1028).
- **Tool calls:**
- Tool call ids are reduced to `[A-Za-z0-9_-]`.
- A tool's `{output}` or `{error}` response becomes `{result}`.
+23 -2
View File
@@ -1012,6 +1012,27 @@ function claudeTurns(contents) {
return out
}
// REWORDED are paragraphs that go through but are answered badly, each with
// a rewording that keeps its meaning. DeepSeek Harness's desktop app puts
// the first in every system prompt. With it word for word, gemini-4-argon
// answered most requests in about 3s at about 300 tok/s with no thinking,
// and ended after one shallow step; with it removed or reworded, the same
// replayed request was answered normally 20 of 20 times (#1028).
const REWORDED = [
[
"Tokens prefixed with @ are paths the user explicitly referenced. Relative paths resolve from the workspace root; absolute paths identify files or directories on the host. A trailing slash marks a directory: list it when its contents matter. Anything else is a file: use the read tool when its contents are needed, and do not claim to have inspected it before reading. @\"...\" quotes a path containing spaces.",
"When the user writes @ followed by a path, they are pointing at that file or folder. Relative paths start at the workspace root; absolute paths are host paths. A path ending in a slash is a folder, so list it if its contents matter; otherwise it is a file, so open it with the read tool before relying on it. Paths with spaces appear as @\"...\".",
],
]
const reword = (system) => {
for (const [from, to] of REWORDED) if (system.includes(from)) system = system.split(from).join(to)
return system
}
// outgoing is a system prompt as Antigravity is sent it
const outgoing = (system) => reword(cloak(system))
// shape is the Gemini request as Antigravity takes it for the model sent
// at the level at, asked at effort
function shape(req, sent, at, effort) {
@@ -1019,9 +1040,9 @@ function shape(req, sent, at, effort) {
const m = sent.toLowerCase()
const claude = m.includes("claude")
if (isObj(req.systemInstruction)) {
for (const p of req.systemInstruction.parts ?? []) if (typeof p?.text === "string") p.text = cloak(p.text)
for (const p of req.systemInstruction.parts ?? []) if (typeof p?.text === "string") p.text = outgoing(p.text)
} else if (typeof req.systemInstruction === "string") {
req.systemInstruction = { role: "user", parts: [{ text: cloak(req.systemInstruction) }] }
req.systemInstruction = { role: "user", parts: [{ text: outgoing(req.systemInstruction) }] }
}
if (Array.isArray(req.contents)) {
for (const c of req.contents) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-antigravity-auth",
"version": "0.1.6",
"version": "0.1.7",
"description": "Sign in to Antigravity with a Google account from OpenCode or magpie: Gemini, and the Claude and GPT-OSS models Google hosts for it",
"type": "module",
"main": "./opencode.mjs",
+18
View File
@@ -169,3 +169,21 @@ test("an empty text a stream ended on isn't sent back (Claude: text Field requir
const s = { contents: [{ role: "model", parts: [{ text: "a" }, { text: "", thoughtSignature: "sig" }] }] }
expect(shape(s, "gemini-3-flash", "", "").contents[0].parts[1]).toEqual({ text: "", thoughtSignature: "sig" })
})
test("DeepSeek Harness's @-path paragraph goes reworded, the rest as written (#1028)", () => {
// word for word as DSH desktop 0.2.2-rc.2 puts it in every system prompt
const dsh = "Tokens prefixed with @ are paths the user explicitly referenced. Relative paths resolve from the workspace root; absolute paths identify files or directories on the host. A trailing slash marks a directory: list it when its contents matter. Anything else is a file: use the read tool when its contents are needed, and do not claim to have inspected it before reading. @\"...\" quotes a path containing spaces."
const sys = "You are DeepSeek Harness.\n\n" + dsh + "\n\nBe brief."
for (const req of [{ systemInstruction: { parts: [{ text: sys }] }, contents: [] }, { systemInstruction: sys, contents: [] }]) {
const text = shape(req, "gemini-4-argon", "", "").systemInstruction.parts[0].text
expect(text).not.toContain("Tokens prefixed with @")
expect(text).toBe("You are DeepSeek Harness.\n\nWhen the user writes @ followed by a path, they are pointing at that file or folder. Relative paths start at the workspace root; absolute paths are host paths. A path ending in a slash is a folder, so list it if its contents matter; otherwise it is a file, so open it with the read tool before relying on it. Paths with spaces appear as @\"...\".\n\nBe brief.")
}
// a prompt that only mentions @ paths is left as it is
const other = "Tokens prefixed with @ are paths. Be brief."
expect(shape({ systemInstruction: { parts: [{ text: other }] }, contents: [] }, "gemini-4-argon", "", "").systemInstruction.parts[0].text).toBe(other)
// the rewording and the zero-width breaks go together
const both = shape({ systemInstruction: { parts: [{ text: "x-anthropic-billing-header: cc\n" + dsh }] }, contents: [] }, "gemini-3-flash", "", "").systemInstruction.parts[0].text
expect(both).toContain("x-a​n​thropic")
expect(both).toContain("When the user writes @ followed by a path")
})