Repository navigation
fix(antigravity): strip the Claude Code dual-use security sentence that triggers a fake 429 - #8829
Open
yanhexiong wants to merge 1 commit into
Open
yanhexiong wants to merge 1 commit into
yanhexiong wants to merge 1 commit into
Conversation
…at triggers a fake 429 The Antigravity upstream answers system instructions containing Claude Code's "Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: ..." sentence with a bare 429 RESOURCE_EXHAUSTED (no quotaResetDelay/RetryInfo). It is not the identity sentence NeutralizeSystemIdentity already rewrites, and inserting zero-width characters into its keywords does not avoid it. Drop the sentence in NeutralizeSystemIdentity, which every Antigravity path already goes through, and let operators add further patterns through SUB2API_ANTIGRAVITY_STRIP_PATTERNS without a rebuild. Refs Wei-Shaw#8824 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
All contributors have signed the CLA. ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
doublepi123
added a commit
to doublepi123/sub2api
that referenced
this pull request
Nov 17, 2026
Port upstream Wei-Shaw#8829, Wei-Shaw#8894, Wei-Shaw#8793 and Wei-Shaw#8878. Antigravity answers some ordinary system-prompt text with a bare 429 RESOURCE_EXHAUSTED ("Resource has been exhausted (e.g. check quota).") although quota is available; the identical request without the text returns 200 (Wei-Shaw#8824, Wei-Shaw#8791). On 152 this hit devbox's Claude Code sessions on gemini-4-carbon since 11-15 while minimal prompts to the same tier succeed. - Wei-Shaw#8829/Wei-Shaw#8894: drop Claude Code's dual-use security sentence and its pasted-content sentence; extra patterns can be supplied without a rebuild through SUB2API_ANTIGRAVITY_STRIP_PATTERNS (one regexp per line). - Wei-Shaw#8793: neutralize Pi's leading identity sentence. - Wei-Shaw#8878: neutralize DeepSeek Harness's opener and rewrite its two mid-prompt sentences. NeutralizeSystemIdentity now strips trigger sentences, rewrites one leading identity, then applies the sentence redactions; it remains the shared entry for the Claude, Gemini native and compat forwarding paths.
Warren-W
pushed a commit
to Warren-W/sub2api
that referenced
this pull request
Nov 20, 2026
…al-use security sentence that triggers a fake 429 Upstream PR: Wei-Shaw#8829 (squashed from 297a212)
Warren-W
pushed a commit
to Warren-W/sub2api
that referenced
this pull request
Nov 20, 2026
…de pasted-content sentence that triggers a fake 429 Upstream PR: Wei-Shaw#8894 (squashed from dbe4008); conflict with Wei-Shaw#8829 resolved by keeping both patterns.
Warren-W
pushed a commit
to Warren-W/sub2api
that referenced
this pull request
Nov 20, 2026
…de pasted-content sentence that triggers a fake 429 Upstream PR: Wei-Shaw#8894 (squashed from dbe4008); conflict with Wei-Shaw#8829 resolved by keeping both patterns.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude Code 的 system prompt 里有一句
Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: …,Antigravity 上游对包含这句话的systemInstruction直接返回裸 429 RESOURCE_EXHAUSTED(无quotaResetDelay/RetryInfo),随后账号进入冷却,后续请求全部 503。和 #8791 / #7410 / #7307 是同一类上游规则,但这次命中的不是身份句,NeutralizeSystemIdentity已把身份句改写掉之后仍然 429。受控实验(同一 key、同一 endpoint、同一模型,只改
system,每次在账号无冷却时发送):Dual-use…这一句Tools with both offensive and defensive uses need a clear, authorized purpose.改动:
NeutralizeSystemIdentity先删除这句话。它已经是 Claude/v1/messages、Gemini native、Responses/Chat 兼容三条链路的共同入口,一处改动全覆盖。upstream_trigger_filter.go:默认只带这一条正则;支持环境变量SUB2API_ANTIGRAVITY_STRIP_PATTERNS(每行一个 Go 正则,非法的跳过并记日志),上游以后再拦别的句子时运维可以直接配置,不必等发版。验证:
gofmt、go vet、golangci-lint v2.14.0(antigravity 包)均无问题;go test -tags=unit ./internal/service/... ./internal/handler/... ./internal/pkg/...全部通过(含新增 5 个用例,其中一个走完整的TransformClaudeToGemini)。已在线上以补丁版本跑通:之前稳定 429 的 Claude Code 请求(gemini-3-flash与gemini-4-carbon-medium)现在返回 200。不在本 PR 范围:#8824 里提到的「裸 429(无 quotaResetDelay)不要冷却整个
antigravity:geminiscope」。Refs #8824
🤖 Generated with Claude Code