Antigravity answers some agents' system prompts with a fake 429 "Resource
has been exhausted", whatever quota is left. Jodiezzzzzz on X (10-27): a
Codex thread begun on GPT-5.x and switched to an Antigravity model got 429
again and again. zgoodz on X: "antigravity在Hermes里一样429". v0.1.1625
told the Codex case as a 400 with "start a new chat", which isn't zero
setup.
What Google matches, each tried on a real Antigravity account on 10-27
(in the system instruction, any case):
- "x-anthropic-billing-header:" (Claude Code)
- "built on Anthropic's Claude Agent SDK" ("running within the Claude
Agent SDK" goes through)
- "You are Codex, an agent based on GPT-5" / "..., a coding agent based
on GPT-5"
- new: "Hermes Agent, an intelligent AI assistant created by Nous
Research", Hermes' earlier default SOUL.md, kept by anyone who edited
their SOUL.md. Hermes' current default ("You are Hermes Agent, built by
Nous Research") goes through.
Each goes through with a zero-width space after its first letter.
"You are Hermes Agent, an intelligent..." still fails, so the
break goes inside the matched phrase itself.
Now codeAssistBody puts that zero-width space into each matched line
(antigravityCloak), in the system instruction only, and only for an
Antigravity account. Gemini CLI's account on the same envelope, and
every other provider and protocol, get the prompt as the agent wrote
it. The text added names nothing; it is one U+200B per line.
`magpie provider set antigravity prompt=as-written` (PromptAsWritten,
kept through Save/withPicks and the GUI's save) turns it off. Then the
v0.1.1625/#2156 fallback stands: a 400 with a hint (now one for Hermes
too, in the Routing page's five languages) and Antigravity skipped for
6h in a group.
Default-on, as the community antigravity-cloak middleware's README
says, changes what Google is sent so a request it means to refuse goes
through. That may be against Antigravity's terms. The owner asked for
it ("破解过 antigravity 提示词让其可以在别的 agent 中使用"), and it is
scoped to Antigravity accounts with an off switch.
Run at this tree (rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/
./internal/cli/ ./internal/gui/: gateway, cli and gui ok; provider
died in TestUnreadLoginsWriteErrorsKeepCredentials ("close of synctest
channel from outside bubble" in filememo.Forget), #3632, red on main
since 091153bf; with -skip of that test, provider ok.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok. go build: ok.
- GUI (node --test, Playwright 1.62, chromium and webkit):
routing-ag-turned-away, i18n-keys, gui-ja, gui-de, gui-zh-tw,
routing-js, panel-routing: 45 pass, 0 fail.
- Broken by hand: with the cloak skipped, TestAntigravityAnswersHermes
AndCodexByDefault and TestOnlyAntigravityIsSentThePromptBrokenUp go
red; without withPicks' line, "prompt=as-written isn't kept".
- Real account, sandbox HOME with only the Antigravity login copied,
this build on 127.0.0.1:3496:
- real Hermes Agent (AIAgent, sandbox SOUL.md = the old persona plus
one line): "OK", 200. With prompt=as-written: 400 with the Hermes
hint. Back on default: 200.
- real Codex 0.162.1: a thread begun on gpt-5.5 (against a local
fake Responses server), then `codex exec resume <id> -m
antigravity/gemini-3-flash` through this build: "OK". With
prompt=as-written: 400 with the Codex hint.
- a synthetic switched Codex Responses thread, with and without
web_search: 200.
- opencode, droid, kimi, pi, gemini-cli, qwen, crush, goose, amp and
openclaw identity sentences: never refused, as written.
Not tried: Claude models on Antigravity (the sandbox account's Claude
quota is spent, so the Claude Code lines were checked on Gemini 3
Flash only); other agents' whole prompts, only their identity lines;
the Windows box; the whole GUI suite.
The plugins repo's antigravity-cloak 0.1.2 adds the Hermes line for
magpies before this one.
159 lines
6.9 KiB
Go
159 lines
6.9 KiB
Go
package gateway
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// codexGPT5System is the start of Codex's own prompt for gpt-5.6-sol, as
|
|
// Codex 0.162.1 sends it: the first developer message of the thread.
|
|
const codexGPT5System = "You are Codex, an agent based on GPT-5. You and the user share one workspace, and your job is to collaborate with them until their goal is genuinely handled."
|
|
|
|
// Antigravity answers Codex's GPT-5 identity line in the system instruction
|
|
// with the same 429 it gives Claude Code's prompt, in any case; the lines
|
|
// it answers were each tried on a real Antigravity account (10-27).
|
|
func TestAntigravityTurnsAwayCodexsGPT5Prompt(t *testing.T) {
|
|
for _, system := range []string{
|
|
codexGPT5System,
|
|
"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace.",
|
|
"you are codex, an agent based on gpt-5.",
|
|
"Some instructions first.\n" + codexGPT5System,
|
|
} {
|
|
if !antigravityTurnsAway(system) {
|
|
t.Errorf("%q isn't taken for what Antigravity turns away", system)
|
|
}
|
|
if antigravityHint(system) != antigravityCodexHint {
|
|
t.Errorf("%q isn't told Codex's hint", system)
|
|
}
|
|
}
|
|
// what it answers: magpie's own Codex prompt for other models, GPT-6's,
|
|
// the line reworded, and the identity alone
|
|
for _, system := range []string{
|
|
"You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI on a user's computer.",
|
|
"You are Codex, an agent based on GPT-6.",
|
|
"You are Codex, an AI agent based on GPT-5.",
|
|
"You are Codex, an agent built on GPT-5.",
|
|
"You are Codex, a coding agent.",
|
|
} {
|
|
if antigravityTurnsAway(system) {
|
|
t.Errorf("%q is taken for what Antigravity turns away; it answers it", system)
|
|
}
|
|
}
|
|
if antigravityHint(claudeCodeSystem) != antigravityTurnedAwayHint {
|
|
t.Error("Claude Code's prompt isn't told its own hint")
|
|
}
|
|
}
|
|
|
|
// codexAGTurn is a Codex turn on Antigravity's model itself, on the Responses
|
|
// API, with Codex's GPT-5 prompt as its first developer message. switched
|
|
// is a thread begun on a GPT model and moved to this one (/model, resume
|
|
// -m, a fork as an agent's thread): it keeps that prompt first and says
|
|
// the switch in a later developer message, after a reply. search is
|
|
// Codex's web_search tool, which it sends every turn and an Antigravity
|
|
// model is given magpie's search for.
|
|
func codexAGTurn(switched, search bool) string {
|
|
input := `{"type":"message","role":"developer","content":[{"type":"input_text","text":` + quote(codexGPT5System) + `}]},` +
|
|
`{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]}`
|
|
if switched {
|
|
input += `,{"type":"message","role":"assistant","content":[{"type":"output_text","text":"hello"}]},` +
|
|
`{"type":"message","role":"developer","content":[{"type":"input_text","text":"<model_switch>\nThe user was previously using a different model.\n</model_switch>"}]},` +
|
|
`{"type":"message","role":"user","content":[{"type":"input_text","text":"go on"}]}`
|
|
}
|
|
tools := ""
|
|
if search {
|
|
tools = `,"tools":[{"type":"function","name":"exec_command","parameters":{"type":"object","properties":{}}},{"type":"web_search"}]`
|
|
}
|
|
return `{"model":"antigravity/gemini-3-flash","stream":true,"input":[` + input + `]` + tools + `}`
|
|
}
|
|
|
|
// Jodiezzzzzz on X (10-27): every Codex call to antigravity/claude-opus-5-5
|
|
// ended in "exceeded retry limit, last status: 429 Too Many Requests", the
|
|
// account's only one, while dsh was served on the same account and model.
|
|
// The thread carried Codex's GPT-5 prompt, which Antigravity turns away:
|
|
// Codex is told why at a status it doesn't retry, Antigravity is asked
|
|
// once, and the account doesn't rest.
|
|
func TestAntigravityTurnsCodexsGPT5ThreadAwayOnce(t *testing.T) {
|
|
for _, c := range []struct{ switched, search bool }{{false, false}, {true, false}, {false, true}, {true, true}} {
|
|
switched, search := c.switched, c.search
|
|
t.Run(fmt.Sprintf("switched=%v,search=%v", switched, search), func(t *testing.T) {
|
|
asked := 0
|
|
var system string
|
|
// a model magpie's search can be served by, as a Google
|
|
// sign-in's own Gemini searches for it
|
|
s, askedUsage := antigravityGroupFor(t, []string{"u@example.com"}, "gemini-3-flash", func(w http.ResponseWriter, r *http.Request) {
|
|
asked++
|
|
b, _ := io.ReadAll(r.Body)
|
|
system = string(b)
|
|
w.WriteHeader(http.StatusTooManyRequests)
|
|
io.WriteString(w, turnedAway)
|
|
})
|
|
rec := httptest.NewRecorder()
|
|
s.Handler().ServeHTTP(rec, httptest.NewRequest("POST", "/v1/responses", strings.NewReader(codexAGTurn(switched, search))))
|
|
code, out := rec.Code, rec.Body.String()
|
|
if !strings.Contains(system, "systemInstruction") || !strings.Contains(system, "an agent based on GPT-5") || search != strings.Contains(system, `"web_search"`) {
|
|
t.Fatalf("the prompt didn't go as the system instruction, so this isn't the case: %s", system)
|
|
}
|
|
if code != http.StatusBadRequest {
|
|
t.Fatalf("Codex got %d, which it retries: %s", code, out)
|
|
}
|
|
if !strings.Contains(out, "Resource has been exhausted") || !strings.Contains(out, antigravityCodexHint) {
|
|
t.Fatalf("Codex isn't told Antigravity's words and why: %s", out)
|
|
}
|
|
if asked != 1 {
|
|
t.Fatalf("Antigravity was asked %d times", asked)
|
|
}
|
|
r := lastRoute(s)
|
|
if len(r.Tries) != 1 || r.Tries[0].Fail != failPrompt || r.Tries[0].Rest != nil {
|
|
t.Fatalf("the try: %+v", r.Tries)
|
|
}
|
|
if *askedUsage != 0 {
|
|
t.Fatalf("the account's usage was asked again %d times", *askedUsage)
|
|
}
|
|
if _, ok := restOf("antigravity@u@example.com"); ok {
|
|
t.Fatalf("the account rests for a prompt it turned away: %v", rests())
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// In a group, the next Codex turn carrying that prompt skips Antigravity
|
|
// as Claude Code's does, and the skip says Codex's hint.
|
|
func TestAntigravityForeseesCodexsGPT5Prompt(t *testing.T) {
|
|
asked := 0
|
|
s, _ := antigravityTurnedAwayGroup(t, []string{"u@example.com"}, func(w http.ResponseWriter, r *http.Request) {
|
|
asked++
|
|
w.WriteHeader(http.StatusTooManyRequests)
|
|
io.WriteString(w, turnedAway)
|
|
})
|
|
for range 2 {
|
|
if code, out := turnOn(t, s, claudeTurn(codexGPT5System)); code != 200 || !strings.Contains(out, "from the other") {
|
|
t.Fatalf("the turn: %d %s", code, out)
|
|
}
|
|
}
|
|
if asked != 1 {
|
|
t.Fatalf("Antigravity was asked %d times", asked)
|
|
}
|
|
if c := s.Recent()[0]; !strings.Contains(c.Fallback, antigravityCodexHint) {
|
|
t.Fatalf("the skip doesn't say why: %q", c.Fallback)
|
|
}
|
|
}
|
|
|
|
func TestAntigravityCodexHintIsTheRoutingPages(t *testing.T) {
|
|
b, err := os.ReadFile(filepath.Join("..", "gui", "assets", "plugins", "routing", "client.js"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.Contains(string(b), quote(antigravityCodexHint)) {
|
|
t.Fatal("plugins/routing/client.js doesn't know the note the gateway adds to Antigravity's refusal of Codex's prompt")
|
|
}
|
|
if !strings.Contains(string(b), quote(antigravityHermesHint)) {
|
|
t.Fatal("plugins/routing/client.js doesn't know the note the gateway adds to Antigravity's refusal of Hermes' old persona")
|
|
}
|
|
}
|