mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(backend): add env var test coverage and fix stale comments
- Add CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS assertion in env_test.py - Fix stale references to service.py → build_sdk_env() in env.py
This commit is contained in:
@@ -482,8 +482,8 @@ async def test_disable_experimental_betas_env_var_strips_headers():
|
||||
OpenRouter).
|
||||
|
||||
This is the main regression guard: the env var is injected by
|
||||
``service.py`` into every CLI subprocess so newer SDK / CLI versions
|
||||
work with OpenRouter without any proxy.
|
||||
``build_sdk_env()`` in ``env.py`` into every CLI subprocess so newer
|
||||
SDK / CLI versions work with OpenRouter without any proxy.
|
||||
"""
|
||||
returncode, _stdout, stderr, captured = await _run_reproduction(
|
||||
extra_env={"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"},
|
||||
|
||||
@@ -123,6 +123,8 @@ class TestBuildSdkEnvOpenRouter:
|
||||
assert result["ANTHROPIC_AUTH_TOKEN"] == "sk-or-test-key"
|
||||
assert result["ANTHROPIC_API_KEY"] == ""
|
||||
assert "ANTHROPIC_CUSTOM_HEADERS" not in result
|
||||
# OpenRouter compat: env var must always be present
|
||||
assert result.get("CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS") == "1"
|
||||
|
||||
def test_strips_trailing_v1(self):
|
||||
"""The /v1 suffix is stripped from the base URL."""
|
||||
|
||||
@@ -206,7 +206,7 @@ def test_sdk_exports_hook_event_type(hook_event: str):
|
||||
# features incompatible with OpenRouter (``tool_reference`` content
|
||||
# blocks, ``context-management-2025-06-27`` beta). We neutralise these
|
||||
# at runtime by injecting ``CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1``
|
||||
# into the CLI subprocess env (see ``service.py``).
|
||||
# into the CLI subprocess env (see ``build_sdk_env()`` in ``env.py``).
|
||||
#
|
||||
# This test is the cheapest possible regression guard: it pins the
|
||||
# bundled CLI to a known-good version. If anyone bumps
|
||||
|
||||
Reference in New Issue
Block a user