mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(backend): move CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS into build_sdk_env
Moves the env var injection from service.py into build_sdk_env() in env.py so all callers (including orchestrator.py) get it automatically. Also changes xfail(strict=False) to strict=True so CI fails if the upstream fix lands and we can remove the workaround.
This commit is contained in:
@@ -460,7 +460,7 @@ def _assert_no_forbidden_patterns(
|
||||
"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,
|
||||
strict=True,
|
||||
)
|
||||
async def test_bare_cli_does_not_send_openrouter_incompatible_features():
|
||||
"""Bare CLI reproduction (no env var workaround).
|
||||
|
||||
@@ -96,5 +96,8 @@ def build_sdk_env(
|
||||
env["CLAUDE_CODE_DISABLE_CLAUDE_MDS"] = "1"
|
||||
env["CLAUDE_CODE_DISABLE_AUTO_MEMORY"] = "1"
|
||||
env["CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"] = "1"
|
||||
# Strip Anthropic-specific beta headers (e.g. context-management-2025-06-27)
|
||||
# that OpenRouter rejects. Safe for all modes — direct Anthropic ignores it.
|
||||
env["CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS"] = "1"
|
||||
|
||||
return env
|
||||
|
||||
@@ -2242,15 +2242,6 @@ async def stream_chat_completion_sdk(
|
||||
if sdk_model:
|
||||
sdk_options_kwargs["model"] = sdk_model
|
||||
|
||||
# Tell the CLI to strip experimental betas (e.g.
|
||||
# ``context-management-2025-06-27``) and ``tool_reference``
|
||||
# content blocks so newer SDK / CLI versions work with
|
||||
# OpenRouter's stricter validation. This single env var
|
||||
# replaces the old in-process compat proxy.
|
||||
if sdk_env is None:
|
||||
sdk_env = {}
|
||||
sdk_env["CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS"] = "1"
|
||||
|
||||
if sdk_env:
|
||||
sdk_options_kwargs["env"] = sdk_env
|
||||
if use_resume and resume_file:
|
||||
|
||||
Reference in New Issue
Block a user