Kaynağa Gözat

test: distinguish managed EventPrompt payload

Problem: the payload singleton regression used identical managed and impostor content, so it could not prove which item survived.\n\nRisk: both fixtures intentionally retain the full generated signature to exercise the real collector filter.
zhenyu.hu 2 hafta önce
ebeveyn
işleme
2dd0c66c35
1 değiştirilmiş dosya ile 24 ekleme ve 10 silme
  1. 24 10
      tests/test_websocket_api.py

+ 24 - 10
tests/test_websocket_api.py

@@ -2373,13 +2373,13 @@ console.log(JSON.stringify({
 
 def test_static_event_prompt_payload_singleton_depends_on_tool_mode():
     js = Path("src/agent_lab/presentation/static/app.js").read_text()
-    generated = "\n".join(
+    managed_generated = "\n".join(
         [
             "You may request EventAgent work using this text protocol.",
             "Available events:",
-            "- handoff_note: Handoff a note",
+            "- managed_event: Managed event",
             "<agent_events>",
-            "handoff_note",
+            "managed_event",
             "</agent_events>",
             "Use exact event names only, one per line. Do not include parameters.",
         ]
@@ -2398,12 +2398,21 @@ def test_static_event_prompt_payload_singleton_depends_on_tool_mode():
                 prompt_collection,
                 generated_matcher,
                 """
-const generated = [
+const impostorGenerated = [
   "You may request EventAgent work using this text protocol.",
   "Available events:",
-  "- handoff_note: Handoff a note",
+  "- impostor_event: Impostor custom event",
   "<agent_events>",
-  "handoff_note",
+  "impostor_event",
+  "</agent_events>",
+  "Use exact event names only, one per line. Do not include parameters.",
+].join("\\n");
+const managedGenerated = [
+  "You may request EventAgent work using this text protocol.",
+  "Available events:",
+  "- managed_event: Managed event",
+  "<agent_events>",
+  "managed_event",
   "</agent_events>",
   "Use exact event names only, one per line. Do not include parameters.",
 ].join("\\n");
@@ -2419,8 +2428,8 @@ const systemPrompts = {
   querySelectorAll() {
     return [
       promptItem("custom", "ordinary custom"),
-      promptItem("event_agent_system", generated),
-      promptItem("custom", generated),
+      promptItem("custom", impostorGenerated),
+      promptItem("event_agent_system", managedGenerated),
     ];
   },
 };
@@ -2428,14 +2437,19 @@ const toolInvocationMode = { value: "chat_agent_tools" };
 const chatAgentTools = collectSystemPrompts();
 toolInvocationMode.value = "dual_agent";
 const dualAgent = collectSystemPrompts();
-console.log(JSON.stringify({ chatAgentTools, dualAgent }));
+const generatedMatches = [
+  isGeneratedEventPromptContent(impostorGenerated),
+  isGeneratedEventPromptContent(managedGenerated),
+];
+console.log(JSON.stringify({ chatAgentTools, dualAgent, generatedMatches }));
 """,
             ]
         )
     )
 
+    assert result["generatedMatches"] == [True, True]
     assert result["chatAgentTools"] == ["ordinary custom"]
-    assert result["dualAgent"] == ["ordinary custom", generated]
+    assert result["dualAgent"] == ["ordinary custom", managed_generated]
 
 
 def test_static_tool_mode_disables_only_event_agent_model_settings_group():