Skip to content

fix(MOC-59): antigravity 传输指纹层对齐官方客户端(抓包实证)#310

Merged
Cmochance merged 2 commits into
mainfrom
worktree-moc-59-antigravity-fingerprint
May 29, 2026
Merged

fix(MOC-59): antigravity 传输指纹层对齐官方客户端(抓包实证)#310
Cmochance merged 2 commits into
mainfrom
worktree-moc-59-antigravity-fingerprint

Conversation

@Cmochance
Copy link
Copy Markdown
Owner

@Cmochance Cmochance commented May 29, 2026

MOC-59:Antigravity 传输指纹层对齐(抓包实证)

背景

Antigravity 检测到非官方客户端时容易封号。本 PR 基于 2026-05-29 本机 mitmproxy local 模式抓包(Antigravity IDE 2.0.10),把 codex-app-transfer 发往 daily-cloudcode-pa.googleapis.com 的请求【传输指纹层】对齐官方客户端,推翻了多个基于 CLIProxyAPI 的旧假设

范围决策

只对齐【传输指纹层】(UA / clientMetadata / requestId / envelope / header)。【内容层】(system prompt + tools 定义)保持 Codex 原样不动 —— 因为 Codex 工具(shell/apply_patch)与官方 Cascade 的 22 个工具是两套不同 agent 架构,16/22 无法无损映射,强行替换 prompt/工具会造成命令偏差。指纹层是封号主信号,且改动零功能影响。

改动(实证 vs 旧推测)

旧(CLIProxyAPI 推测) 新(抓包实证)
UA(chat + 控制面) antigravity/1.23.2 darwin/arm64(控制面还带 google-api-nodejs-client 长形式) antigravity/hub/2.0.10 <plat>/<arch>(运行时检测平台/架构,统一)
clientMetadata {ide_type,ide_name,ide_version}(snake) {"ideType":"ANTIGRAVITY"}(camel,仅此字段)
X-Goog-Api-Client 控制面发 gl-node/22.21.1 不发(chat + 控制面都不发)
envelope requestId agent-<uuid> agent/<uuid>/<ms>/<uuid>/<seq>
user_prompt_id envelope 含 antigravity 路径(gemini-cli 路径保留)

另:抽 node_platform_arch 共享 helper(gemini-cli + antigravity UA 共用,防两份 OS/ARCH 映射 drift);同步 mod.rs 差异表 / cloud_code.rs 头 / models.rs 的 module doc 为实证值。

验证

  • 单测:gemini-oauth 52 + adapters 557 全过(含新增/改写测试)
  • cargo check --workspace 通过
  • 2-agent review(code-reviewer + silent-failure-hunter):无 BLOCKER,核心正确性确认(user_prompt_id write-only 不被 SSE/session 读、续连靠 response_id+sessionId;删 header/字段不破坏控制面);findings 均为 module doc 同步,已修

Followup(MOC-59 后续,本 PR 不做)

  • labels 字段(需 trajectory_idrequestId 一致性 + 完整语义)
  • toolConfig.mode=VALIDATED(需先验证对 Codex 工具调用的兼容性)
  • 版本 6h-cached auto-updater poll(替 hardcode 2.0.10)
  • onboardUser body 实证(本次没触发到)
  • 删 dead 的 OauthProviderConfig.x_goog_api_client 字段 + ANTIGRAVITY_X_GOOG_API_CLIENT 常量

完整抓包指纹见 auto-memory reference_antigravity_wire_fingerprint

Refs MOC-59

🤖 Generated with Claude Code


Open in Devin Review

基于 2026-05-29 本机 mitmproxy local 模式抓包(Antigravity IDE 2.0.10),把发往
daily-cloudcode-pa 的请求【传输指纹层】对齐官方客户端,推翻多个 CLIProxyAPI 旧假设。
按决策,【内容层】(system prompt + tools)保持 Codex 原样不动 —— Codex 工具
(shell/apply_patch)与官方 Cascade 22 工具是两套不同 agent 架构,无法无损映射,
强行替换会命令偏差。指纹层是封号主信号且零功能影响。

- UA 统一为 antigravity/hub/2.0.10 <plat>/<arch>(运行时检测;原 1.23.2 + 硬编码
  darwin/arm64 + 控制面错误的 nodejs-client 长形式)
- clientMetadata 精简为 {"ideType":"ANTIGRAVITY"}(camelCase;原 snake_case 3 字段)
- 控制面 loadCodeAssist/onboardUser 删 X-Goog-Api-Client(实证不发)
- envelope requestId: agent-<uuid> → agent/<uuid>/<ms>/<uuid>/<seq>
- antigravity 路径删 user_prompt_id(实证 envelope 不含;gemini-cli 路径保留)
- 抽 node_platform_arch 共享 helper(gemini-cli + antigravity UA 共用,防 OS/ARCH drift)
- 同步 module doc(mod.rs 差异表 / cloud_code.rs 头 / models.rs)为实证值

测试: gemini-oauth 52 + adapters 557 全过;cargo check --workspace 通过。
2-agent review(code-reviewer + silent-failure-hunter)无 BLOCKER。

Refs MOC-59
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@Cmochance
Copy link
Copy Markdown
Owner Author

e2e + 协议层验证结论(2026-05-29)

协议转换层(2-agent 实证 dump):Codex Responses → cloudcode envelope 无 drop bug、无转换错误。被 drop 的 parallel_tool_calls/include/store/metadata 都是 Gemini wire 无对应的合理忽略;function_call/output、tool schema、reasoning、content blocks、MCP、compaction 映射全部正确。

传输层 e2e(真实出站):临时 example 起本地 proxy(antigravity active)发真实 Codex 请求到 daily-cloudcode-pa,HTTP 200 —— 上游接受了对齐后的完整请求(新 UA/clientMetadata/requestId/envelope/thinkingLevel),客户端身份/请求格式未被拒

验证局限:生成层返 403 This service has been disabled in this account for violation of Terms of Service —— 测试账号本身已被封(account-level,与请求格式无关)。指纹对齐是预防,救不回已封账号;完整生成验证需未封账号。

新发现(followup → MOC-67,本 PR 不做):

  • thinkingConfig:gemini-3 我们发 thinkingLevel(string),官方发 thinkingBudget:10000(int) —— 需验证 daily-cloudcode-pa 是否接受 thinkingLevel(若不接受是功能问题)
  • generationConfig 多发 temperature/topP、maxOutputTokens 透传(能力层,固定成官方值会覆盖用户设置,不建议盲目对齐)
  • systemInstruction.role 省略 vs 官方 "user"、schema type 大小写(纯指纹 NIT)

review:Devin + 2-agent(code-reviewer/silent-failure-hunter)无 BLOCKER;CI 全绿;0 unresolved thread。

@Cmochance
Copy link
Copy Markdown
Owner Author

e2e 补充:完整生成成功(未封账号)✅

承上条 —— 用新 build(含本 PR 改动)的 app、重新 OAuth 登录未封账号后重跑 e2e:

HTTP 200 → response.completed → 模型正常生成文本「二」(1+1=2) + 真实计费(usage 71/1 tokens)

对齐后的完整请求(UA antigravity/hub/2.0.10 / clientMetadata {"ideType":"ANTIGRAVITY"} / requestId 新格式 / 无 x-goog / 无 user_prompt_id / thinkingLevel)被 daily-cloudcode-pa 完整接受并正常服务,识别为合法 antigravity 客户端。

(上条的 403 是另一测试账号 wuy765150@gmail.com 已被 ToS 封号,account-level,与请求格式无关。thinkingLevel 实测被上游接受 → MOC-67 的 thinkingConfig 降为指纹 NIT。)

MOC-59 指纹对齐端到端闭环:单测 609 ✓ + 协议审查无 bug ✓ + e2e 真实 200/completed/生成成功 ✓。

@Cmochance Cmochance merged commit 1ee8bdb into main May 29, 2026
6 checks passed
@Cmochance Cmochance deleted the worktree-moc-59-antigravity-fingerprint branch May 29, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant