mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-24 03:16:20 +08:00
## Description Follow-up to the merged #3817. As flagged in the post-merge thread, the Antigravity IDE doesn’t expose third-party model-provider settings, so the setup text was telling users to add a custom model provider in a panel that doesn’t exist. The instructions now describe what the integration actually covers (MCP registration and the `/v1internal:streamGenerateContent` endpoint for `google-antigravity` clients) and distinguish the IDE from the Antigravity CLI (`agy`), which is the surface that accepts a custom endpoint via `GOOGLE_GEMINI_BASE_URL`. Follow-up fix (Devin review on this PR): the `agy` note mentioned `GOOGLE_GEMINI_BASE_URL` but only printed the OpenAI-compatible URL. It now prints the Gemini-compatible base URL (scheme://host, the Gemini API convention) as an explicit `GOOGLE_GEMINI_BASE_URL=...` assignment, and the OpenAI block is labeled for OpenAI-speaking clients. ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update - [ ] Performance improvement - [ ] Code refactoring (no functional changes) ## Changes Made - `headroom wrap antigravity` help text and printed setup instructions no longer reference IDE model-provider settings; they point at MCP registration and the native endpoint, and name the CLI separately. - The `agy` note now shows the Gemini-compatible base URL explicitly (`GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:<port>`), with the project prefix (`/p/<name>`) applied like the other URLs. - `docs/content/docs/proxy.mdx` Antigravity section corrected the same way. - Tests updated to assert the corrected wording. ## Testing - [x] Unit tests pass (`pytest`) ### Test Output ```text $ pytest tests/test_provider_antigravity.py -q 12 passed, 1 warning in 2.07s $ pytest tests/test_mcp_registry/test_antigravity_registrar.py -q 25 passed, 1 warning in 0.82s ``` (`test_cli/test_wrap_antigravity.py` was not run locally — `typer` is not installed in this environment; CI covers it.) ## Real Behavior Proof - Environment: docs/string-only change; no runtime behavior affected. - What was checked: the removed claim ("add a custom OpenAI-compatible model provider in Antigravity’s model-provider settings") was verified false three ways — the reporter’s own `~/.gemini/settings.json` has no model-provider keys; Antigravity IDE 2.5.5 exposes no third-party model-provider settings panel (upstream report plus current docs); and the `google-antigravity` clients the new text names really do speak Cloud Code Assist (`POST /v1internal:streamGenerateContent` is served by the proxy — see `CLOUDCODE_HANDLER_ROUTES` in `route_specs.py`). - Observed result: `render_setup_lines(8787)` now prints the corrected IDE/MCP/native-traffic text, `GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:8787` for `agy`, and the OpenAI block labeled for OpenAI-speaking clients; the 37 tests above pass. - Not tested: a live Antigravity IDE run — no Mac with the IDE installed in this environment, and nothing in this change touches a runtime path, so there is no behavior to smoke-test. ## Runtime Rollout Safety - Rollout-managed feature(s): none — documentation/strings only. - Minimum rollout channel: n/a. - Stable/default behavior changed: no; rendered CLI text only. - Kill switch / disable path: n/a. - Unsafe override required: n/a. - Qualification impact: none. - Rollback path: revert the commit. ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] My code follows the project’s style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] I did **not** edit `CHANGELOG.md` — it is generated by release-please from my Conventional Commit PR title (a CI guard enforces this) ## Additional Notes Docs-only PR; the remaining `wrap` CLI test module is covered by CI. <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4258" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4" alt="Devin Review"></picture></a> <!-- devin-review-badge-end -->
95 lines
3.5 KiB
Python
95 lines
3.5 KiB
Python
from __future__ import annotations
|
|
|
|
from headroom.providers.antigravity import (
|
|
build_install_env,
|
|
build_proxy_targets,
|
|
render_setup_lines,
|
|
)
|
|
|
|
|
|
def test_antigravity_proxy_targets_openai_base_url() -> None:
|
|
targets = build_proxy_targets(8787)
|
|
assert targets.openai_base_url == "http://127.0.0.1:8787/v1"
|
|
|
|
|
|
def test_antigravity_proxy_targets_anthropic_base_url() -> None:
|
|
targets = build_proxy_targets(8787)
|
|
assert targets.anthropic_base_url == "http://127.0.0.1:8787"
|
|
|
|
|
|
def test_antigravity_proxy_targets_use_given_port() -> None:
|
|
targets = build_proxy_targets(9999)
|
|
assert targets.openai_base_url == "http://127.0.0.1:9999/v1"
|
|
assert targets.anthropic_base_url == "http://127.0.0.1:9999"
|
|
|
|
|
|
def test_antigravity_proxy_targets_apply_project_prefix() -> None:
|
|
targets = build_proxy_targets(8787, project="myrepo")
|
|
assert targets.openai_base_url == "http://127.0.0.1:8787/p/myrepo/v1"
|
|
assert targets.anthropic_base_url == "http://127.0.0.1:8787/p/myrepo"
|
|
|
|
|
|
def test_antigravity_proxy_targets_ignore_blank_project() -> None:
|
|
targets = build_proxy_targets(8787, project=" ")
|
|
assert targets.openai_base_url == "http://127.0.0.1:8787/v1"
|
|
assert targets.anthropic_base_url == "http://127.0.0.1:8787"
|
|
|
|
|
|
def test_antigravity_build_install_env_sets_base_urls() -> None:
|
|
env = build_install_env(port=8787, backend="ignored")
|
|
assert env == {
|
|
"OPENAI_BASE_URL": "http://127.0.0.1:8787/v1",
|
|
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8787",
|
|
}
|
|
|
|
|
|
def test_antigravity_build_install_env_uses_given_port() -> None:
|
|
env = build_install_env(port=9999, backend="ignored")
|
|
assert env["OPENAI_BASE_URL"] == "http://127.0.0.1:9999/v1"
|
|
assert env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9999"
|
|
|
|
|
|
def test_antigravity_render_setup_lines_contains_proxy_url() -> None:
|
|
lines = render_setup_lines(8787)
|
|
joined = "\n".join(lines)
|
|
assert "http://127.0.0.1:8787/v1" in joined
|
|
assert "Antigravity" in joined
|
|
|
|
|
|
def test_antigravity_setup_lines_do_not_claim_ide_provider_settings() -> None:
|
|
joined = "\n".join(render_setup_lines(8787))
|
|
assert "does not support third-party model providers" in joined
|
|
assert "Add a custom OpenAI-compatible" not in joined
|
|
assert "model-provider settings" not in joined
|
|
assert "mcp install --agent antigravity" in joined
|
|
assert "/v1internal:streamGenerateContent" in joined
|
|
assert "GOOGLE_GEMINI_BASE_URL" in joined
|
|
assert "GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:8787" in joined
|
|
assert "For OpenAI-speaking clients" in joined
|
|
|
|
|
|
def test_antigravity_render_setup_lines_project_attribution() -> None:
|
|
lines = render_setup_lines(8787, project="my-sf-project")
|
|
joined = "\n".join(lines)
|
|
assert "my-sf-project" in joined
|
|
plain = "\n".join(render_setup_lines(8787))
|
|
assert "attributed" not in plain
|
|
|
|
|
|
def test_antigravity_install_registry_includes_antigravity() -> None:
|
|
from headroom.providers.install_registry import build_install_target_envs
|
|
|
|
result = build_install_target_envs(port=1234, backend="ignored", targets=["antigravity"])
|
|
assert result["antigravity"]["OPENAI_BASE_URL"] == "http://127.0.0.1:1234/v1"
|
|
assert result["antigravity"]["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:1234"
|
|
|
|
|
|
def test_antigravity_install_registry_unknown_target_skipped() -> None:
|
|
from headroom.providers.install_registry import build_install_target_envs
|
|
|
|
result = build_install_target_envs(
|
|
port=1234, backend="ignored", targets=["antigravity", "unknown-tool"]
|
|
)
|
|
assert "unknown-tool" not in result
|
|
assert "antigravity" in result
|