From a52d1b370b18a5d06f197fc1acafaa924bbaa1c1 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 27 Oct 2026 00:41:44 +0800 Subject: [PATCH] antigravity-cloak 0.1.1: Codex's GPT-5 prompt is broken too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Antigravity answers "You are Codex, an agent based on GPT-5" and "You are Codex, a coding agent based on GPT-5" in the system instruction with the same fake 429 "Resource has been exhausted" it gives Claude Code's prompt. A Codex thread begun on a GPT model keeps that prompt after /model, resume -m or a fork onto an Antigravity model, so such a thread never got an answer (Jodiezzzzzz on X, 10-27; magpie now tells it as a 400 with a hint). The two lines join the words broken with a zero-width space. Run: - bun test packages/antigravity-cloak: 14 pass, 0 fail (two new cases: a switched thread's developer message, the coding-agent wording in lower case; magpie's own "You are Codex, based on GPT-5." stays). - bun test scripts/check.test.mjs: 3 pass. - On a real Antigravity account through a sandbox magpie: both lines whole get 429 (magpie's 400); "Y​ou are Codex, an agent based on GPT-5" and "Y​ou are Codex, a coding agent based on GPT-5" get 200. - npm had 0.1.0; this is 0.1.1. Not tried: the plugin installed in a running magpie on a real account. --- packages/antigravity-cloak/README.md | 9 +++++---- .../antigravity-cloak/antigravity-cloak.middleware.js | 6 +++++- packages/antigravity-cloak/cases.json | 2 ++ packages/antigravity-cloak/package.json | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/antigravity-cloak/README.md b/packages/antigravity-cloak/README.md index 9230f1d..eb8d14b 100644 --- a/packages/antigravity-cloak/README.md +++ b/packages/antigravity-cloak/README.md @@ -2,12 +2,13 @@ Claude Code and Claude Desktop on an Antigravity account, as [magpie](https://usemagpie.ai) gateway middleware. -Antigravity answers a request whose system prompt reads as Claude Code's or the Claude Agent SDK's (which Claude Desktop's chats use) with `429 Resource has been exhausted`, however much quota is left. magpie shows it as a 400 that says so. Tried with a real account, Antigravity matches two pieces of the prompt: +Antigravity answers a request whose system prompt reads as Claude Code's or the Claude Agent SDK's (which Claude Desktop's chats use) with `429 Resource has been exhausted`, however much quota is left. magpie shows it as a 400 that says so. Tried with a real account, Antigravity matches these pieces of the prompt: - Claude Code's billing line, `x-anthropic-billing-header: …`; -- `You are a Claude agent, built on Anthropic's Claude Agent SDK`. +- `You are a Claude agent, built on Anthropic's Claude Agent SDK`; +- Codex's own prompt for its GPT-5 models, `You are Codex, an agent based on GPT-5` or `You are Codex, a coding agent based on GPT-5`. A Codex chat begun on a GPT model keeps it after `/model` or a fork onto an Antigravity model, so that chat 429s while a new one works. -The same prompt goes through when each has a zero-width space (U+200B) inside it. This middleware puts one after the first letter of `x-anthropic-billing-header` and `Claude Agent SDK`, in the system prompt only, and only in what an Antigravity account is sent. Every other provider, a Claude subscription above all, gets the prompt as the agent wrote it, even in a routing group that tries Antigravity first. The model reads the words as before. +The same prompt goes through when each has a zero-width space (U+200B) inside it. This middleware puts one after the first letter of `x-anthropic-billing-header`, `Claude Agent SDK` and those two Codex lines, in the system prompt only, and only in what an Antigravity account is sent. Every other provider, a Claude subscription above all, gets the prompt as the agent wrote it, even in a routing group that tries Antigravity first. The model reads the words as before. It needs a magpie with the `onProvider` hook (v0.1.1283 or later): an older magpie loads it and never calls it, so requests go as they came. @@ -28,6 +29,6 @@ Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @m - `accounts`: the subscriptions it acts on, by kind. `antigravity` is the default. - `off`: leave every request as it came. -中文:Antigravity 看到 Claude Code / Claude Agent SDK 的系统提示词会回一个假的 429。这个中间件只在发给 Antigravity 账号的请求里,往 `x-anthropic-billing-header` 和 `Claude Agent SDK` 里插一个零宽空格,其他供应商(尤其是 Claude 订阅)收到的提示词不变。这样做可能违反 Antigravity 的条款,账号有被封的风险,请只用在可以承受损失的账号上。需要 magpie v0.1.1283 或更新版本。 +中文:Antigravity 看到 Claude Code / Claude Agent SDK / Codex GPT-5 的系统提示词会回一个假的 429。这个中间件只在发给 Antigravity 账号的请求里,往 `x-anthropic-billing-header`、`Claude Agent SDK` 和 Codex 给 GPT-5 模型的身份行(在 GPT 模型上开始、再切到 Antigravity 模型的 Codex 对话会带着它)里插一个零宽空格,其他供应商(尤其是 Claude 订阅)收到的提示词不变。这样做可能违反 Antigravity 的条款,账号有被封的风险,请只用在可以承受损失的账号上。需要 magpie v0.1.1283 或更新版本。 After [hexiaolv/magpie-antigravity-cloak](https://github.com/hexiaolv/magpie-antigravity-cloak) (MIT), which breaks a longer list of words in every request, whatever provider it goes to. diff --git a/packages/antigravity-cloak/antigravity-cloak.middleware.js b/packages/antigravity-cloak/antigravity-cloak.middleware.js index 5c413a2..a5380f6 100644 --- a/packages/antigravity-cloak/antigravity-cloak.middleware.js +++ b/packages/antigravity-cloak/antigravity-cloak.middleware.js @@ -5,7 +5,11 @@ // // "x-anthropic-billing-header:" Claude Code's billing line // "You are a Claude agent, built on Anthropic's Claude Agent SDK" +// "You are Codex, an agent based on GPT-5" Codex's own prompt +// "You are Codex, a coding agent based on GPT-5" for its GPT-5 models // +// (a Codex thread begun on a GPT model keeps its prompt after /model or a +// fork onto an Antigravity one) // and lets the same prompt through with a zero-width space (U+200B) inside // each. This middleware puts one after the first letter of each word in // what Antigravity alone is sent (onProvider, ctx.provider.account): every @@ -20,7 +24,7 @@ // After hexiaolv's magpie-antigravity-cloak (MIT), which does the same to // every request whatever provider it goes to. -export const words = ["x-anthropic-billing-header", "Claude Agent SDK"] +export const words = ["x-anthropic-billing-header", "Claude Agent SDK", "You are Codex, an agent based on GPT-5", "You are Codex, a coding agent based on GPT-5"] const zwsp = "​" diff --git a/packages/antigravity-cloak/cases.json b/packages/antigravity-cloak/cases.json index 02ffa32..62293bc 100644 --- a/packages/antigravity-cloak/cases.json +++ b/packages/antigravity-cloak/cases.json @@ -6,6 +6,8 @@ {"name": "Anthropic: no words, nothing changed", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "request": {"model": "m", "system": "You code.", "messages": []}}, {"name": "Chat: system and developer messages, not the user's", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "chat"}, "request": {"model": "m", "messages": [{"role": "system", "content": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}, {"role": "developer", "content": [{"type": "text", "text": "x-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}, "expect_request": {"model": "m", "messages": [{"role": "system", "content": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK."}, {"role": "developer", "content": [{"type": "text", "text": "x\u200b-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}}, {"name": "Responses: instructions and a system input item", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "instructions": "You are a Claude agent, built on Anthropic's Claude Agent SDK.", "input": [{"role": "system", "content": [{"type": "input_text", "text": "x-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": [{"type": "input_text", "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]}, "expect_request": {"model": "m", "instructions": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK.", "input": [{"role": "system", "content": [{"type": "input_text", "text": "x\u200b-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]}, {"role": "user", "content": [{"type": "input_text", "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]}}, + {"name": "Responses: Codex's GPT-5 prompt kept after a switch to an Antigravity model", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "claude-opus-5-5"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5. You and the user share one workspace."}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "hi"}]}, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "\nThe user was previously using a different model.\n"}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5."}]}]}, "expect_request": {"model": "m", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "Y\u200bou are Codex, an agent based on GPT-5. You and the user share one workspace."}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "hi"}]}, {"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "\nThe user was previously using a different model.\n"}]}, {"type": "message", "role": "user", "content": [{"type": "input_text", "text": "You are Codex, an agent based on GPT-5."}]}]}}, + {"name": "Responses: the coding agent wording, any case; magpie's own Codex prompt stays", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "claude-opus-5-5"}, "ctx": {"protocol": "responses"}, "request": {"model": "m", "instructions": "you are codex, a coding agent based on gpt-5.", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]}, "expect_request": {"model": "m", "instructions": "y\u200bou are codex, a coding agent based on gpt-5.", "input": [{"type": "message", "role": "developer", "content": [{"type": "input_text", "text": "You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]}}, {"name": "Gemini: systemInstruction", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "ctx": {"protocol": "gemini"}, "request": {"systemInstruction": {"parts": [{"text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}, "contents": []}, "expect_request": {"systemInstruction": {"parts": [{"text": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK."}]}, "contents": []}}, {"name": "extraWords are broken too", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "options": {"extraWords": ["Claude Code"]}, "request": {"model": "m", "system": "You are Claude Code."}, "expect_request": {"model": "m", "system": "You are C\u200blaude Code."}}, {"name": "accounts says which subscriptions", "provider": {"id": "g", "name": "Gemini", "account": "gemini", "model": "m"}, "options": {"accounts": ["gemini"]}, "request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}, "expect_request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's C\u200blaude Agent SDK."}}, diff --git a/packages/antigravity-cloak/package.json b/packages/antigravity-cloak/package.json index 373f970..035e3f5 100644 --- a/packages/antigravity-cloak/package.json +++ b/packages/antigravity-cloak/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/middleware-antigravity-cloak", - "version": "0.1.0", + "version": "0.1.1", "description": "magpie gateway middleware: Antigravity stops turning Claude Code's and the Claude Agent SDK's system prompts away, and no other provider's request is changed", "type": "module", "files": ["antigravity-cloak.middleware.js", "README.md"],