From 2c2fadba4780531bfb635bd43d9c59d3a9def920 Mon Sep 17 00:00:00 2001 From: majdyz Date: Sun, 12 Apr 2026 12:04:15 +0000 Subject: [PATCH] fix(backend): add env var test coverage and fix stale comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS assertion in env_test.py - Fix stale references to service.py → build_sdk_env() in env.py --- .../backend/backend/copilot/sdk/cli_openrouter_compat_test.py | 4 ++-- autogpt_platform/backend/backend/copilot/sdk/env_test.py | 2 ++ .../backend/backend/copilot/sdk/sdk_compat_test.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/autogpt_platform/backend/backend/copilot/sdk/cli_openrouter_compat_test.py b/autogpt_platform/backend/backend/copilot/sdk/cli_openrouter_compat_test.py index 20c40cc850..64bdf5f656 100644 --- a/autogpt_platform/backend/backend/copilot/sdk/cli_openrouter_compat_test.py +++ b/autogpt_platform/backend/backend/copilot/sdk/cli_openrouter_compat_test.py @@ -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"}, diff --git a/autogpt_platform/backend/backend/copilot/sdk/env_test.py b/autogpt_platform/backend/backend/copilot/sdk/env_test.py index e387499816..cfc1fd3e3f 100644 --- a/autogpt_platform/backend/backend/copilot/sdk/env_test.py +++ b/autogpt_platform/backend/backend/copilot/sdk/env_test.py @@ -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.""" diff --git a/autogpt_platform/backend/backend/copilot/sdk/sdk_compat_test.py b/autogpt_platform/backend/backend/copilot/sdk/sdk_compat_test.py index eba8c843c5..b5ed5004b6 100644 --- a/autogpt_platform/backend/backend/copilot/sdk/sdk_compat_test.py +++ b/autogpt_platform/backend/backend/copilot/sdk/sdk_compat_test.py @@ -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