fix(antigravity): 修复 v1internal 模式检测逻辑并新增 E2E 测试;#234
Merged
Conversation
- 初始化时去除 base_url 的 /v1internal 后缀,避免 httpx 拼接时路径重复 - 新增 _v1internal_enabled 标志位,简化 v1internal 模式检测逻辑 - 修复端点路径为 /v1internal:generateContent 完整格式 - project_id 自动发现仅在标准 GLA 模式下触发,v1internal 模式跳过 - 同步更新单元测试断言,与重构后逻辑对齐 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 新增 tests/e2e/ 目录及 e2e pytest marker - 默认测试运行排除 e2e 标记(-m 'not e2e'),需显式指定运行 - test_e2e_token.py: Token 获取与刷新流程验证 - test_e2e_vendor.py: Vendor 初始化与消息发送验证 - test_e2e_http.py: HTTP 请求/响应全链路验证 - conftest.py: 共享 fixture(配置加载、客户端初始化) 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
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.
变更内容
1. v1internal 模式检测逻辑重构(
src/coding/proxy/vendors/antigravity.py)_v1internal_enabled标志位,在__init__时从config.base_url一次性判定模式,替代此前_is_v1internal_mode()中project_id AND URL的双条件判断__init__中base_url含/v1internal后缀时 httpx 路径拼接重复问题:初始化时去除后缀,send_message/send_message_stream端点改为完整路径/v1internal:generateContent_prepare_request中的 project_id 自动发现守卫增加_v1internal_enabled跳过条件——v1internal 模式不依赖 project_id,无需触发 CRM API 发现流程2. 新增 E2E 测试套件(
tests/e2e/)/v1/messages的非流式/流式/tools/健康检查/状态诊断链路e2emarker 标记,默认排除,需RUN_ANTIGRAVITY_E2E=1环境变量激活3. 配置与单元测试更新
pyproject.toml:新增e2emarker 定义,默认-m 'not e2e'排除tests/test_antigravity.py:同步更新_is_v1internal_mode相关断言,与新的 URL 驱动行为对齐变更原因
原 v1internal 模式检测依赖
_effective_project_id AND "v1internal" in base_url双条件,导致配置了 v1internal URL 但未显式设置 project_id 时模式被误判为未启用,project_id 发现守卫亦因此错误触发。v1internal 协议实际由 URL 路径决定,与 project_id 无关,需要将模式检测解耦。测试计划
tests/test_antigravity.py通过RUN_ANTIGRAVITY_E2E=1 uv run pytest tests/e2e/ -v(需真实凭证环境)🤖 Generated with Claude Code, CodeX, Gemini