| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- {
- "version": 1,
- "caseName": "conversation-session-subagent-model-boundary",
- "spec": "./test/e2e/conversation-session/subagents/conversation-session-subagent-model-boundary.test.ts",
- "fixtures": [
- {
- "id": "conversation-session-subagent-model-boundary-title-sidecar",
- "description": "本例标题旁路响应。",
- "metadata": {
- "kind": "common",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "运行时证据显示标题旁路缺少响应;在本例显式登记固定标题,避免依赖 legacy fixture 或触发后台网络重试。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["Generate a concise title"]
- },
- "response": {
- "statusCode": 200,
- "statusMessage": "OK",
- "headers": {
- "content-type": "application/json; charset=utf-8"
- },
- "body": "{\"id\":\"upstream-e2e-title-fixture\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Upstream E2E Fixture\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":125,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}"
- }
- },
- {
- "id": "subagent-boundary-parent-agent",
- "description": "父会话触发没有显式模型覆盖的 general-purpose child。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "固定 Agent tool_use,模型身份由真实运行时请求断言。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_SUBAGENT_MODEL_BOUNDARY_PARENT", "E2E_SUBAGENT_MODEL_BOUNDARY_CHILD"],
- "bodyExcludes": [
- "toolu_e2e_subagent_model_boundary",
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_e2e_subagent_model_boundary",
- "name": "Agent",
- "input": {
- "description": "Run inherited child",
- "prompt": "E2E_SUBAGENT_MODEL_BOUNDARY_CHILD: reply exactly E2E_SUBAGENT_MODEL_BOUNDARY_CHILD_DONE and no other text.",
- "subagent_type": "general-purpose"
- }
- }
- }
- },
- {
- "id": "subagent-boundary-child-delayed",
- "description": "子请求保持创建时模型,父模型选择完成后显式释放响应。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "controlled-stream",
- "source": "synthetic",
- "syntheticReason": "门闩确定性保持子响应在途,父模型改选后再完成子请求。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_SUBAGENT_MODEL_BOUNDARY_CHILD"],
- "bodyExcludes": [
- "E2E_SUBAGENT_MODEL_BOUNDARY_PARENT",
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "headers": {
- "content-type": "text/event-stream; charset=utf-8"
- },
- "body": "event: message_start\ndata: {\"type\": \"message_start\", \"message\": {\"id\": \"subagent-child\", \"type\": \"message\", \"role\": \"assistant\", \"model\": \"start-subagent-boundary-model\", \"content\": [], \"stop_reason\": null, \"usage\": {\"input_tokens\": 40, \"output_tokens\": 0}}}\n\nevent: content_block_start\ndata: {\"type\": \"content_block_start\", \"index\": 0, \"content_block\": {\"type\": \"text\", \"text\": \"\"}}\n\nevent: content_block_delta\ndata: {\"type\": \"content_block_delta\", \"index\": 0, \"delta\": {\"type\": \"text_delta\", \"text\": \"E2E_SUBAGENT_MODEL_BOUNDARY_CHILD_DONE\"}}\n\nevent: content_block_stop\ndata: {\"type\": \"content_block_stop\", \"index\": 0}\n\nevent: message_delta\ndata: {\"type\": \"message_delta\", \"delta\": {\"stop_reason\": \"end_turn\"}, \"usage\": {\"output_tokens\": 8}}\n\nevent: message_stop\ndata: {\"type\": \"message_stop\"}\n\n",
- "chunks": [
- {
- "text": "event: message_start\ndata: {\"type\": \"message_start\", \"message\": {\"id\": \"subagent-child\", \"type\": \"message\", \"role\": \"assistant\", \"model\": \"start-subagent-boundary-model\", \"content\": [], \"stop_reason\": null, \"usage\": {\"input_tokens\": 40, \"output_tokens\": 0}}}\n\n",
- "delayMs": 0
- },
- {
- "text": "event: content_block_start\ndata: {\"type\": \"content_block_start\", \"index\": 0, \"content_block\": {\"type\": \"text\", \"text\": \"\"}}\n\n",
- "delayMs": 0
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\": \"content_block_delta\", \"index\": 0, \"delta\": {\"type\": \"text_delta\", \"text\": \"E2E_SUBAGENT_MODEL_BOUNDARY_CHILD_DONE\"}}\n\n",
- "delayMs": 0
- },
- {
- "text": "event: content_block_stop\ndata: {\"type\": \"content_block_stop\", \"index\": 0}\n\n",
- "delayMs": 0
- },
- {
- "text": "event: message_delta\ndata: {\"type\": \"message_delta\", \"delta\": {\"stop_reason\": \"end_turn\"}, \"usage\": {\"output_tokens\": 8}}\n\n",
- "delayMs": 0
- },
- {
- "text": "event: message_stop\ndata: {\"type\": \"message_stop\"}\n\n",
- "delayMs": 0
- }
- ],
- "releaseAfterChunks": 2
- }
- },
- {
- "id": "subagent-boundary-parent-final",
- "description": "父会话消费 child 结果并完成。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "验证父 continuation 仍能完成。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_SUBAGENT_MODEL_BOUNDARY_PARENT",
- "E2E_SUBAGENT_MODEL_BOUNDARY_CHILD_DONE",
- "toolu_e2e_subagent_model_boundary",
- "tool_result"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "E2E_SUBAGENT_MODEL_BOUNDARY_NEXT_INPUT"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "subagent-boundary-parent-final",
- "inputTokens": 60,
- "outputTokens": 8,
- "text": "E2E_SUBAGENT_MODEL_BOUNDARY_PARENT_DONE"
- }
- }
- },
- {
- "id": "subagent-nested-parent-agent",
- "description": "父会话启动唯一允许的子 Agent 层级。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "固定第一层 child。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_SUBAGENT_NESTED_PARENT", "E2E_SUBAGENT_NESTED_CHILD"],
- "bodyExcludes": [
- "toolu_e2e_subagent_nested_child",
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_e2e_subagent_nested_child",
- "name": "Agent",
- "input": {
- "description": "Run nested child",
- "prompt": "E2E_SUBAGENT_NESTED_CHILD: launch a grandchild Agent for E2E_SUBAGENT_NESTED_GRANDCHILD, then reply exactly E2E_SUBAGENT_NESTED_CHILD_DONE.",
- "subagent_type": "general-purpose"
- }
- }
- }
- },
- {
- "id": "subagent-nested-child-agent",
- "description": "模拟模型调用未暴露的递归 Agent 工具,必须被运行时拒绝。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "注入非法递归工具调用,验证工具权限边界。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_SUBAGENT_NESTED_CHILD", "E2E_SUBAGENT_NESTED_GRANDCHILD"],
- "bodyExcludes": [
- "toolu_e2e_subagent_nested_grandchild",
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "E2E_SUBAGENT_NESTED_PARENT"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_e2e_subagent_nested_grandchild",
- "name": "Agent",
- "input": {
- "description": "Run nested grandchild",
- "prompt": "E2E_SUBAGENT_NESTED_GRANDCHILD: reply exactly E2E_SUBAGENT_NESTED_GRANDCHILD_DONE and no other text.",
- "subagent_type": "general-purpose"
- }
- }
- }
- },
- {
- "id": "subagent-nested-child-final",
- "description": "子 Agent 收到递归工具拒绝结果后正常结束。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "验证运行时拒绝未暴露的 Agent 工具,不产生孙级请求。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_SUBAGENT_NESTED_CHILD",
- "No such tool available: Agent",
- "toolu_e2e_subagent_nested_grandchild",
- "tool_result"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "E2E_SUBAGENT_NESTED_PARENT"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "subagent-nested-child-final",
- "inputTokens": 48,
- "outputTokens": 8,
- "text": "E2E_SUBAGENT_NESTED_CHILD_DONE"
- }
- }
- },
- {
- "id": "subagent-nested-parent-final",
- "description": "父会话消费第二层 child 结果。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "验证递归拒绝后父会话仍正常完成。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_SUBAGENT_NESTED_PARENT",
- "E2E_SUBAGENT_NESTED_CHILD_DONE",
- "toolu_e2e_subagent_nested_child",
- "tool_result"
- ],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "subagent-nested-parent-final",
- "inputTokens": 56,
- "outputTokens": 8,
- "text": "E2E_SUBAGENT_NESTED_PARENT_DONE"
- }
- }
- },
- {
- "id": "subagent-boundary-next-input",
- "description": "父会话切换模型后,新提交输入使用新模型。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "提供后续普通输入响应,真实请求断言切换后的模型身份。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_SUBAGENT_MODEL_BOUNDARY_NEXT_INPUT"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "subagent-boundary-next-input",
- "inputTokens": 60,
- "outputTokens": 8,
- "text": "E2E_SUBAGENT_NEXT_DONE"
- }
- }
- }
- ]
- }
|