Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

test(backend/copilot): let the recorded-turn drift tests run without a model key (#15339)

Reinier van der Leerbc8cb06003b0
diff --git a/autogpt_platform/backend/backend/copilot/stream_drift/conftest.py b/autogpt_platform/backend/backend/copilot/stream_drift/conftest.py
index 69d59b1737..7288e6561f 100644
--- a/autogpt_platform/backend/backend/copilot/stream_drift/conftest.py
+++ b/autogpt_platform/backend/backend/copilot/stream_drift/conftest.py
@@ -13,6 +13,7 @@ from backend.copilot.model import ChatSession
from backend.copilot.model_router import ResolvedModel
from .recording import saving_into
+from .scripted import UNSENT_MODEL_KEY
@pytest_asyncio.fixture(scope="session", loop_scope="session")
@@ -45,7 +46,11 @@ def baseline_offline(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
baseline,
"config",
baseline.config.model_copy(
- update={"use_e2b_sandbox": False, "use_local": False}
+ update={
+ "api_key": UNSENT_MODEL_KEY,
+ "use_e2b_sandbox": False,
+ "use_local": False,
+ }
),
)
for name, value in {
diff --git a/autogpt_platform/backend/backend/copilot/stream_drift/scripted.py b/autogpt_platform/backend/backend/copilot/stream_drift/scripted.py
index 9a3dddc9e6..a9d08ecc6a 100644
--- a/autogpt_platform/backend/backend/copilot/stream_drift/scripted.py
+++ b/autogpt_platform/backend/backend/copilot/stream_drift/scripted.py
@@ -21,6 +21,10 @@ from backend.copilot.sdk.response_adapter import SDKResponseAdapter
from backend.copilot.stream_checkpoint import turn_checkpoint
from backend.copilot.tree import root_envelope
+# Its presence alone picks the OpenRouter transport the fixtures were recorded
+# under; without a key (fork PRs have no secrets) the turns record differently.
+UNSENT_MODEL_KEY = "test-placeholder-not-a-key"
+
def session_with_prompt(prompt: str) -> ChatSession:
session = ChatSession.new("drift-user", dry_run=False)
@@ -200,6 +204,7 @@ async def sdk_service_turn(
"clear_pending_question": AsyncMock(),
"config": sdk.config.model_copy(
update={
+ "api_key": UNSENT_MODEL_KEY,
"use_claude_code_subscription": False,
"use_e2b_sandbox": False,
"claude_agent_fallback_model": None,