conversation-session-subagent-model-boundary.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-subagent-model-boundary",
  4. "spec": "./test/e2e/conversation-session/subagents/conversation-session-subagent-model-boundary.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "conversation-session-subagent-model-boundary-title-sidecar",
  8. "description": "本例标题旁路响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "source": "synthetic",
  12. "timingPolicy": "fast-text",
  13. "syntheticReason": "运行时证据显示标题旁路缺少响应;在本例显式登记固定标题,避免依赖 legacy fixture 或触发后台网络重试。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "statusMessage": "OK",
  23. "headers": {
  24. "content-type": "application/json; charset=utf-8"
  25. },
  26. "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\"}}"
  27. }
  28. },
  29. {
  30. "id": "subagent-boundary-parent-agent",
  31. "description": "父会话触发没有显式模型覆盖的 general-purpose child。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "固定 Agent tool_use,模型身份由真实运行时请求断言。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "bodyIncludes": ["E2E_SUBAGENT_MODEL_BOUNDARY_PARENT", "E2E_SUBAGENT_MODEL_BOUNDARY_CHILD"],
  43. "bodyExcludes": [
  44. "toolu_e2e_subagent_model_boundary",
  45. "Generate a concise title",
  46. "CRITICAL: Respond with TEXT ONLY"
  47. ]
  48. },
  49. "response": {
  50. "statusCode": 200,
  51. "toolUse": {
  52. "id": "toolu_e2e_subagent_model_boundary",
  53. "name": "Agent",
  54. "input": {
  55. "description": "Run inherited child",
  56. "prompt": "E2E_SUBAGENT_MODEL_BOUNDARY_CHILD: reply exactly E2E_SUBAGENT_MODEL_BOUNDARY_CHILD_DONE and no other text.",
  57. "subagent_type": "general-purpose"
  58. }
  59. }
  60. }
  61. },
  62. {
  63. "id": "subagent-boundary-child-delayed",
  64. "description": "子请求保持创建时模型,父模型选择完成后显式释放响应。",
  65. "metadata": {
  66. "kind": "main",
  67. "timingPolicy": "controlled-stream",
  68. "source": "synthetic",
  69. "syntheticReason": "门闩确定性保持子响应在途,父模型改选后再完成子请求。"
  70. },
  71. "maxMatches": 1,
  72. "match": {
  73. "method": "POST",
  74. "pathIncludes": "/messages",
  75. "bodyIncludes": ["E2E_SUBAGENT_MODEL_BOUNDARY_CHILD"],
  76. "bodyExcludes": [
  77. "E2E_SUBAGENT_MODEL_BOUNDARY_PARENT",
  78. "Generate a concise title",
  79. "CRITICAL: Respond with TEXT ONLY"
  80. ]
  81. },
  82. "response": {
  83. "statusCode": 200,
  84. "headers": {
  85. "content-type": "text/event-stream; charset=utf-8"
  86. },
  87. "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",
  88. "chunks": [
  89. {
  90. "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",
  91. "delayMs": 0
  92. },
  93. {
  94. "text": "event: content_block_start\ndata: {\"type\": \"content_block_start\", \"index\": 0, \"content_block\": {\"type\": \"text\", \"text\": \"\"}}\n\n",
  95. "delayMs": 0
  96. },
  97. {
  98. "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",
  99. "delayMs": 0
  100. },
  101. {
  102. "text": "event: content_block_stop\ndata: {\"type\": \"content_block_stop\", \"index\": 0}\n\n",
  103. "delayMs": 0
  104. },
  105. {
  106. "text": "event: message_delta\ndata: {\"type\": \"message_delta\", \"delta\": {\"stop_reason\": \"end_turn\"}, \"usage\": {\"output_tokens\": 8}}\n\n",
  107. "delayMs": 0
  108. },
  109. {
  110. "text": "event: message_stop\ndata: {\"type\": \"message_stop\"}\n\n",
  111. "delayMs": 0
  112. }
  113. ],
  114. "releaseAfterChunks": 2
  115. }
  116. },
  117. {
  118. "id": "subagent-boundary-parent-final",
  119. "description": "父会话消费 child 结果并完成。",
  120. "metadata": {
  121. "kind": "main",
  122. "timingPolicy": "fast-text",
  123. "source": "synthetic",
  124. "syntheticReason": "验证父 continuation 仍能完成。"
  125. },
  126. "match": {
  127. "method": "POST",
  128. "pathIncludes": "/messages",
  129. "bodyIncludes": [
  130. "E2E_SUBAGENT_MODEL_BOUNDARY_PARENT",
  131. "E2E_SUBAGENT_MODEL_BOUNDARY_CHILD_DONE",
  132. "toolu_e2e_subagent_model_boundary",
  133. "tool_result"
  134. ],
  135. "bodyExcludes": [
  136. "Generate a concise title",
  137. "CRITICAL: Respond with TEXT ONLY",
  138. "E2E_SUBAGENT_MODEL_BOUNDARY_NEXT_INPUT"
  139. ]
  140. },
  141. "response": {
  142. "statusCode": 200,
  143. "text": {
  144. "id": "subagent-boundary-parent-final",
  145. "inputTokens": 60,
  146. "outputTokens": 8,
  147. "text": "E2E_SUBAGENT_MODEL_BOUNDARY_PARENT_DONE"
  148. }
  149. }
  150. },
  151. {
  152. "id": "subagent-nested-parent-agent",
  153. "description": "父会话启动唯一允许的子 Agent 层级。",
  154. "metadata": {
  155. "kind": "main",
  156. "timingPolicy": "fast-text",
  157. "source": "synthetic",
  158. "syntheticReason": "固定第一层 child。"
  159. },
  160. "maxMatches": 1,
  161. "match": {
  162. "method": "POST",
  163. "pathIncludes": "/messages",
  164. "bodyIncludes": ["E2E_SUBAGENT_NESTED_PARENT", "E2E_SUBAGENT_NESTED_CHILD"],
  165. "bodyExcludes": [
  166. "toolu_e2e_subagent_nested_child",
  167. "Generate a concise title",
  168. "CRITICAL: Respond with TEXT ONLY"
  169. ]
  170. },
  171. "response": {
  172. "statusCode": 200,
  173. "toolUse": {
  174. "id": "toolu_e2e_subagent_nested_child",
  175. "name": "Agent",
  176. "input": {
  177. "description": "Run nested child",
  178. "prompt": "E2E_SUBAGENT_NESTED_CHILD: launch a grandchild Agent for E2E_SUBAGENT_NESTED_GRANDCHILD, then reply exactly E2E_SUBAGENT_NESTED_CHILD_DONE.",
  179. "subagent_type": "general-purpose"
  180. }
  181. }
  182. }
  183. },
  184. {
  185. "id": "subagent-nested-child-agent",
  186. "description": "模拟模型调用未暴露的递归 Agent 工具,必须被运行时拒绝。",
  187. "metadata": {
  188. "kind": "main",
  189. "timingPolicy": "fast-text",
  190. "source": "synthetic",
  191. "syntheticReason": "注入非法递归工具调用,验证工具权限边界。"
  192. },
  193. "maxMatches": 1,
  194. "match": {
  195. "method": "POST",
  196. "pathIncludes": "/messages",
  197. "bodyIncludes": ["E2E_SUBAGENT_NESTED_CHILD", "E2E_SUBAGENT_NESTED_GRANDCHILD"],
  198. "bodyExcludes": [
  199. "toolu_e2e_subagent_nested_grandchild",
  200. "Generate a concise title",
  201. "CRITICAL: Respond with TEXT ONLY",
  202. "E2E_SUBAGENT_NESTED_PARENT"
  203. ]
  204. },
  205. "response": {
  206. "statusCode": 200,
  207. "toolUse": {
  208. "id": "toolu_e2e_subagent_nested_grandchild",
  209. "name": "Agent",
  210. "input": {
  211. "description": "Run nested grandchild",
  212. "prompt": "E2E_SUBAGENT_NESTED_GRANDCHILD: reply exactly E2E_SUBAGENT_NESTED_GRANDCHILD_DONE and no other text.",
  213. "subagent_type": "general-purpose"
  214. }
  215. }
  216. }
  217. },
  218. {
  219. "id": "subagent-nested-child-final",
  220. "description": "子 Agent 收到递归工具拒绝结果后正常结束。",
  221. "metadata": {
  222. "kind": "main",
  223. "timingPolicy": "fast-text",
  224. "source": "synthetic",
  225. "syntheticReason": "验证运行时拒绝未暴露的 Agent 工具,不产生孙级请求。"
  226. },
  227. "match": {
  228. "method": "POST",
  229. "pathIncludes": "/messages",
  230. "bodyIncludes": [
  231. "E2E_SUBAGENT_NESTED_CHILD",
  232. "No such tool available: Agent",
  233. "toolu_e2e_subagent_nested_grandchild",
  234. "tool_result"
  235. ],
  236. "bodyExcludes": [
  237. "Generate a concise title",
  238. "CRITICAL: Respond with TEXT ONLY",
  239. "E2E_SUBAGENT_NESTED_PARENT"
  240. ]
  241. },
  242. "response": {
  243. "statusCode": 200,
  244. "text": {
  245. "id": "subagent-nested-child-final",
  246. "inputTokens": 48,
  247. "outputTokens": 8,
  248. "text": "E2E_SUBAGENT_NESTED_CHILD_DONE"
  249. }
  250. }
  251. },
  252. {
  253. "id": "subagent-nested-parent-final",
  254. "description": "父会话消费第二层 child 结果。",
  255. "metadata": {
  256. "kind": "main",
  257. "timingPolicy": "fast-text",
  258. "source": "synthetic",
  259. "syntheticReason": "验证递归拒绝后父会话仍正常完成。"
  260. },
  261. "match": {
  262. "method": "POST",
  263. "pathIncludes": "/messages",
  264. "bodyIncludes": [
  265. "E2E_SUBAGENT_NESTED_PARENT",
  266. "E2E_SUBAGENT_NESTED_CHILD_DONE",
  267. "toolu_e2e_subagent_nested_child",
  268. "tool_result"
  269. ],
  270. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  271. },
  272. "response": {
  273. "statusCode": 200,
  274. "text": {
  275. "id": "subagent-nested-parent-final",
  276. "inputTokens": 56,
  277. "outputTokens": 8,
  278. "text": "E2E_SUBAGENT_NESTED_PARENT_DONE"
  279. }
  280. }
  281. },
  282. {
  283. "id": "subagent-boundary-next-input",
  284. "description": "父会话切换模型后,新提交输入使用新模型。",
  285. "metadata": {
  286. "kind": "main",
  287. "timingPolicy": "fast-text",
  288. "source": "synthetic",
  289. "syntheticReason": "提供后续普通输入响应,真实请求断言切换后的模型身份。"
  290. },
  291. "match": {
  292. "method": "POST",
  293. "pathIncludes": "/messages",
  294. "lastUserMessageIncludes": ["E2E_SUBAGENT_MODEL_BOUNDARY_NEXT_INPUT"],
  295. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  296. },
  297. "response": {
  298. "statusCode": 200,
  299. "text": {
  300. "id": "subagent-boundary-next-input",
  301. "inputTokens": 60,
  302. "outputTokens": 8,
  303. "text": "E2E_SUBAGENT_NEXT_DONE"
  304. }
  305. }
  306. }
  307. ]
  308. }