fix: execute mode cards through deterministic assistant route

This commit is contained in:
vee
2026-09-09 09:04:55 +08:00
parent 2af8b8f9ac
commit 76057be044
12 changed files with 257 additions and 18 deletions
+28
View File
@@ -757,6 +757,34 @@ class TestCodexAssistantWebApi:
assert not FAKE_CODEX.turn_calls
assert not FAKE_CODEX.bridge_results
def test_saved_mode_execution_uses_deterministic_route_over_http(self) -> None:
message = "进入办公模式"
FAKE_CODEX.available = False
with patch.object(
AssistantApiHandler,
"assistant_capability_catalog",
StaticSavedModeCatalog(),
):
events = self.post_assistant(
{
"message": message,
"conversation_id": "conv-api-saved-mode-execute",
"execution_mode": "dry_run",
}
)
assert events[0]["route"] == "mode_profile_execute"
assert events[0]["engine"] == "n7web-mode-profile-runner"
action = next(event for event in events if event["type"] == "action.completed")
assert action["success"] is True
assert action["payload"]["execution_mode"] == "dry_run"
assert events[-1]["route"] == "mode_profile_execute"
assert "模拟编排" in events[-1]["answer"]
assert len(AssistantApiHandler.service.calls) == 1
assert AssistantApiHandler.service.calls[0]["utterance"] == message
assert not FAKE_CODEX.turn_calls
assert not FAKE_CODEX.bridge_results
def test_saved_mode_update_uses_deterministic_management_route_over_http(
self,
) -> None: