diff --git a/autogpt_platform/backend/backend/copilot/config.py b/autogpt_platform/backend/backend/copilot/config.py index a26b105347..bd1acbce83 100644 --- a/autogpt_platform/backend/backend/copilot/config.py +++ b/autogpt_platform/backend/backend/copilot/config.py @@ -326,10 +326,10 @@ class ChatConfig(BaseSettings): v = os.getenv("CHAT_CLAUDE_AGENT_CLI_PATH") if not v: v = os.getenv("CLAUDE_AGENT_CLI_PATH") - if v and not os.access(v, os.X_OK): + if v and os.path.exists(v) and not os.access(v, os.X_OK): raise ValueError( - f"claude_agent_cli_path '{v}' is not an executable file. " - "Check the path and file permissions." + f"claude_agent_cli_path '{v}' exists but is not executable. " + "Check file permissions." ) return v 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 3b20cd2b68..7605c39172 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 @@ -455,18 +455,20 @@ def _assert_no_forbidden_patterns( @pytest.mark.asyncio -async def test_cli_does_not_send_openrouter_incompatible_features(): - """End-to-end OpenRouter compatibility reproduction (bare CLI path). +@pytest.mark.xfail( + reason="CLI 2.1.97 (SDK 0.1.58) sends context-management beta without " + "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. This is expected — the env " + "var guard in test_disable_experimental_betas_env_var_strips_headers " + "is the real regression test.", + strict=False, +) +async def test_bare_cli_does_not_send_openrouter_incompatible_features(): + """Bare CLI reproduction (no env var workaround). - Spawns the bundled (or overridden) Claude Code CLI against a fake - Anthropic API server, captures every request body it sends, and - asserts that none of them contain the two known OpenRouter-breaking - features. - - On a clean SDK pin (0.1.45 or 0.1.47, bundled CLI 2.1.63 or 2.1.70) - this passes naturally. On a broken pin (0.1.55+, bundled CLI 2.1.91+) - it fails — that failure IS the bisect signal we use to verify which - SDK versions need the workaround. + Documents whether the bundled CLI sends OpenRouter-incompatible + features without the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS env var. + On SDK 0.1.58 (CLI 2.1.97) this is expected to fail — the env var + test above is the actual regression guard. """ returncode, _stdout, stderr, captured = await _run_reproduction() _assert_no_forbidden_patterns(captured, returncode, stderr)