Skip to content

[Provider compatibility] Claude Code Task subagents receive false 429 on Antigravity Gemini 3.7 Flash #2899

Closed

Description

@redeye1011

Client or integration

Claude Code

Provider or upstream service

Google Antigravity / Cloud Code Assist

OpenCodex version

2.35.0

Endpoint or capability

/v1/messages; Claude Code Task subagents

Current behaviour

A Claude Code Task subagent routed to google-antigravity/gemini-3.7-flash fails with HTTP 429:

Resource has been exhausted (e.g. check quota).

Controlled comparisons indicate that this is not ordinary quota exhaustion:

  • Main Claude Code requests using the same OpenCodex model succeed.
  • Equivalent non-Task requests succeed.
  • Removing one exact paragraph from the Task subagent system instruction changes the response from 429 to 200.
  • Changing tool count, output-token limit, thinking configuration, session identity, or concurrency does not resolve the failure.

The triggering paragraph is:

You are a Claude agent, built on Anthropic's Claude Agent SDK.

A minimal Cloud Code Assist request containing that sentence reproduces the 429. Removing or generically rewriting it returns 200.

Google returns only:

{
  "error": {
    "code": 429,
    "message": "Resource has been exhausted (e.g. check quota).",
    "status": "RESOURCE_EXHAUSTED"
  }
}

OpenCodex therefore reports the failure as a rate limit even though it is prompt-content-specific.

Expected behaviour

Claude Code should be able to run a Task subagent through Antigravity Gemini 3.7 Flash when the upstream model is otherwise available.

For this compatibility case, OpenCodex should remove the exact rejected identity paragraph while preserving every other system instruction.

Unrelated Google 429 responses should retain their existing quota and rate-limit handling.

Minimal redacted request or reproduction

# Configure a Claude Code subagent to use:
# google-antigravity/gemini-3.7-flash

# Start Claude Code through OpenCodex and request delegation:
Use the Gemini 3.7 Flash subagent and have it reply exactly:
SUBAGENT_OK

# Observed:
# The Task subagent fails with HTTP 429.
#
# Control:
# A main Claude Code request through the same model succeeds.

Distinguishing redacted request fragment:

{
  "model": "gemini-3.7-flash-tiered",
  "request": {
    "systemInstruction": {
      "parts": [
        {
          "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK."
        }
      ]
    },
    "contents": [
      {
        "role": "user",
        "parts": [{ "text": "Reply OK." }]
      }
    ]
  }
}

Controlled results:

Task system instruction containing the exact identity paragraph  429
No system instruction                                           200
No tools                                                        429
Exact identity paragraph alone                                  429
Generic agent identity instead                                  200
Exact identity paragraph removed                                200

Actual response or error

HTTP 429

{
  "error": {
    "code": 429,
    "message": "Resource has been exhausted (e.g. check quota).",
    "status": "RESOURCE_EXHAUSTED"
  }
}

Upstream documentation

No public specification was found for this internal Cloud Code Assist behaviour.

The expected behaviour is based on Claude Code's concrete Task-subagent request shape and controlled requests against the upstream service.

Suggested mapping or implementation notes

Apply the compatibility rewrite after the Gemini systemInstruction is constructed and before the Cloud Code Assist request is serialized:

  • Apply only in Cloud Code Assist mode.
  • Apply only to gemini-3.7-flash.
  • Remove only a paragraph exactly equal to:
You are a Claude agent, built on Anthropic's Claude Agent SDK.
  • Preserve all other system-instruction text and parts.
  • Leave other Google transports and model IDs unchanged.
  • Do not broadly reclassify Google 429 responses.

A candidate implementation was tested through an isolated OpenCodex instance using the real Claude Code Task flow. Before the rewrite, the subagent returned 429. After the rewrite, one real Task subagent completed and returned:

SUBAGENT_OK

The focused regression test, typecheck, full test suite, privacy scan, and diff validation passed.

The same patch was then applied to a normal running OpenCodex proxy and verified manually through the Claude Code CLI. A Gemini 3.7 Flash Task subagent completed 10 consecutive tool calls successfully:

Task subagent completed
Tool calls: 10/10 successful
Duration: approximately 43.3 seconds

This human verification exercised the normal Claude Code CLI → OpenCodex /v1/messages → Antigravity Gemini 3.7 Flash path rather than a synthetic adapter-only request.

Additional context and attachments

The full Task request continued to succeed after removing only the exact identity paragraph. Its tools, reasoning configuration, output limit, and remaining system instructions were unchanged.

Related but distinct issues:

No request bodies containing conversation history, credentials, account identifiers, local paths, session identifiers, timestamps, or user-specific configuration are attached.

Checks

  • I searched existing provider and compatibility issues.
  • The request and response were redacted.
  • The expected behaviour is based on a concrete client requirement.

Activity

  1. lidge-jun commented on Aug 29, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 58 / 80

    설명

    이 이슈는 Claude Code의 Task 서브에이전트가 google-antigravity/gemini-3.7-flash로 갈 때만 HTTP 429(Resource has been exhausted)가 나고, 같은 모델의 일반(메인) 요청은 200이 나온다는 보고입니다. OpenCodex 2.35.0, 엔드포인트는 /v1/messages입니다. 작성자가 좁혀 둔 핵심은 할당량·동시성·툴 개수·thinking 설정이 아니라, Task 시스템 프롬프트에 들어가는 한 문장입니다.

    그 문장은 You are a Claude agent, built on Anthropic's Claude Agent SDK. 입니다. Cloud Code Assist에 이 문장만 넣은 최소 요청도 429가 나고, 지우거나 일반 문장으로 바꾸면 200이 됩니다. 즉 Google 쪽이 Anthropic/Claude SDK 정체성 문구를 보고 쿼터 소진처럼 보이게 거절하는 콘텐츠/정책성 가짜 429 가능성이 큽니다. OpenCodex가 Antigravity 경로를 이미 src/adapters/google-antigravity-replay.ts 등으로 다루고 있지만, 이 증상은 서명 리플레이나 세션 키가 아니라 업스트림이 특정 프롬프트 문자열에 반응하는 호환 문제에 가깝습니다.

    현재 dev(c3da277, #2891 entitlement client_version 수정 직후) 방향과는 직접 겹치지 않습니다. Codex pool 401·Cursor replay 계열과도 별개입니다. 다만 Claude Code Task는 서브에이전트마다 시스템 지시가 커지고, OpenCodex가 메시지를 거의 그대로 Antigravity로 넘기면 업스트림 필터에 그대로 노출됩니다. 메인 요청만 되고 Task만 깨지는 패턴은 재현·비교가 잘 되어 있어 조사 가치가 있습니다.

    OpenCodex 쪽에서 할 수 있는 대응 후보는 (1) Antigravity/Gemini 경로에서 Claude SDK 자기소개 문구를 중립 문구로 치환하거나 제거하는 옵트인 정규화, (2) 업스트림 429 본문이 진짜 쿼터인지 프롬프트 거절인지 구분하는 진단 힌트, (3) Task 전용 모델 라우팅 권고(Antigravity 대신 다른 백엔드)입니다. 어느 것도 지금 HEAD에 바로 얹을 만한 완성 패치는 아니고, 먼저 와이어 캡처로 요청 본문에 그 문장이 그대로 나가는지·OpenCodex가 중간에 넣는지 확인이 필요합니다.

    types.ts/config.ts 분할 캠페인과는 무관합니다. 중복 이슈로 보이는 기존 Antigravity/Claude Code 항목이 있으면 그쪽으로 묶는 편이 낫습니다.

    경로/증상 - 업스트림이 쿼터 메시지를 쓰지만, 문장 한 줄 유무로 429↔200이 바뀌므로 일반 쿼터 고갈로 취급하면 사용자를 잘못된 repair(계정 추가, 대기)로 보냅니다.
    경로 google-antigravity 어댑터 - 현재 코드베이스의 antigravity 작업은 주로 thought-signature/replay(src/adapters/google-antigravity-replay.ts)라서, 이 프롬프트 필터와는 다른 축입니다. 기존 패치에 묻히지 말고 별도 조사 단위가 필요합니다.
    심볼 Task system instruction - Claude Code가 넣는 고정 문장이면 OpenCodex가 클라이언트 패치 없이 중간에서만 손댈 수 있습니다. 치환 범위(정확 문자열 vs 정규식)와 다른 프로바이더로의 부작용을 정해야 합니다.
    경로 진단 UX - ocx/로그가 429를 그냥 quota로 보이면 재현이 어려워집니다. provider-compatibility 라벨에 맞게 "content-shaped 429" 힌트가 필요한지 판단이 필요합니다.

    메인테이너의 판단이 필요한 지점

    • OpenCodex가 Claude SDK 자기소개 문구를 Antigravity 경로에서 자동 정규화할지, 문서/라우팅 권고만 할지
    • 최소 재현을 리포지토리 fixture/테스트로 고정할지(실업스트림 호출 없이 탐지 규칙만)
    • 같은 문장이 다른 Google/Gemini 경로에서도 터지는지 범위 조사 우선순위
    • 기존 Antigravity 이슈와 merge/close 여부

    너의 추천
    help wanted/needs-design 성격으로 두고, 먼저 프록시 로그에 Task 요청의 해당 문장 존재 여부를 확인하는 조사 코멘트를 유지하세요. 바로 광역 문자열 치환 PR은 만들지 말고, Antigravity 전용 sanitize(정확 문장 매칭) 설계가 나온 뒤에만 좁은 패치를 받습니다. 지금은 닫지 마세요.

    이 댓글은 grok-bot이 작성했습니다

  2. lidge-jun commented on Aug 30, 2026

    @lidge-jun
    Owner

    Fixed on dev in 209e9f4 (#2961).

    The cause was not a real rate limit. src/adapters/google.ts joins the client system prompt into Gemini systemInstruction and forwarded it verbatim, and Antigravity Gemini 3.7 Flash rejects one standalone paragraph of the Claude Agent SDK prompt. That rejection surfaced to the client as a 429.

    The fix strips only that exact paragraph, and only for Cloud Code Assist gemini-3.7-flash. Everything else in the prompt is forwarded byte-identical, and no other Google model or mode is affected -- there are negative-scope tests for each of those, plus one asserting the remainder is unchanged.

    Thanks for the clear report; the reproduction made this narrow to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    providerProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reports

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions