conversation-session-agent-always-background.json 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-agent-always-background",
  4. "spec": "./test/e2e/conversation-session/subagents/conversation-session-agent-always-background.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "aab-title-a",
  8. "description": "E2E_AAB_A1 首发的确定性标题响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "首发会异步触发 title sidecar;用首轮 marker 隔离并固定标题响应。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["Generate a concise title", "E2E_AAB_A1"]
  20. },
  21. "response": {
  22. "statusCode": 200,
  23. "text": {
  24. "id": "aab-title-a",
  25. "inputTokens": 64,
  26. "outputTokens": 8,
  27. "text": "{\"title\":\"Agent Always Background A\"}"
  28. }
  29. }
  30. },
  31. {
  32. "id": "aab-a1",
  33. "description": "A 首个请求:同一回复里两个 Agent 调用,一个没有 run_in_background,一个带 run_in_background: false。",
  34. "metadata": {
  35. "kind": "main",
  36. "timingPolicy": "fast-tool-use",
  37. "source": "synthetic",
  38. "syntheticReason": "固定两个 Agent 调用;spec 读取请求体,断言 Agent schema 没有 run_in_background,且两个调用都在后台启动。"
  39. },
  40. "maxMatches": 1,
  41. "match": {
  42. "method": "POST",
  43. "pathIncludes": "/messages",
  44. "lastUserMessageIncludes": ["E2E_AAB_A1"],
  45. "bodyExcludes": [
  46. "Generate a concise title",
  47. "CRITICAL: Respond with TEXT ONLY",
  48. "toolu_aab_a_plain"
  49. ]
  50. },
  51. "response": {
  52. "statusCode": 200,
  53. "toolUses": [
  54. {
  55. "id": "toolu_aab_a_plain",
  56. "name": "Agent",
  57. "input": {
  58. "description": "AAB plain agent",
  59. "prompt": "E2E_AAB_CHILD_PLAIN: Return exactly E2E_AAB_CHILD_PLAIN_DONE."
  60. }
  61. },
  62. {
  63. "id": "toolu_aab_a_legacy",
  64. "name": "Agent",
  65. "input": {
  66. "description": "AAB legacy field agent",
  67. "prompt": "E2E_AAB_CHILD_LEGACY: Return exactly E2E_AAB_CHILD_LEGACY_DONE.",
  68. "run_in_background": false
  69. }
  70. }
  71. ]
  72. }
  73. },
  74. {
  75. "id": "aab-a2",
  76. "description": "A 工具批次之后:两个启动回执,父会话文字收尾。",
  77. "metadata": {
  78. "kind": "main",
  79. "timingPolicy": "fast-text",
  80. "source": "synthetic",
  81. "syntheticReason": "启动回执之后固定收尾文字,让父会话在子代理完成前回到 idle。"
  82. },
  83. "maxMatches": 1,
  84. "match": {
  85. "method": "POST",
  86. "pathIncludes": "/messages",
  87. "bodyIncludes": [
  88. "E2E_AAB_A1",
  89. "toolu_aab_a_plain",
  90. "toolu_aab_a_legacy",
  91. "Async agent launched successfully"
  92. ],
  93. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  94. "lastUserMessageExcludes": ["<task-notification>", "E2E_AAB_A3"]
  95. },
  96. "response": {
  97. "statusCode": 200,
  98. "text": {
  99. "id": "aab-a2",
  100. "text": "AAB_A_LAUNCHED"
  101. }
  102. }
  103. },
  104. {
  105. "id": "aab-child-plain",
  106. "description": "子代理 E2E_AAB_CHILD_PLAIN 返回固定结果。",
  107. "metadata": {
  108. "kind": "subagent",
  109. "timingPolicy": "delayed-text",
  110. "source": "synthetic",
  111. "syntheticReason": "延迟 8 秒以上完成:父会话的启动轮先结束,Composer 在子代理运行期间显示后台计数,再由完成通知开启新一轮。"
  112. },
  113. "maxMatches": 1,
  114. "match": {
  115. "method": "POST",
  116. "pathIncludes": "/messages",
  117. "lastUserMessageIncludes": ["E2E_AAB_CHILD_PLAIN: Return exactly"],
  118. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  119. },
  120. "response": {
  121. "statusCode": 200,
  122. "delayMs": 8000,
  123. "text": {
  124. "id": "aab-child-plain",
  125. "text": "E2E_AAB_CHILD_PLAIN_DONE"
  126. }
  127. }
  128. },
  129. {
  130. "id": "aab-child-legacy",
  131. "description": "子代理 E2E_AAB_CHILD_LEGACY 返回固定结果。",
  132. "metadata": {
  133. "kind": "subagent",
  134. "timingPolicy": "delayed-text",
  135. "source": "synthetic",
  136. "syntheticReason": "延迟 8 秒以上完成:父会话的启动轮先结束,Composer 在子代理运行期间显示后台计数,再由完成通知开启新一轮。"
  137. },
  138. "maxMatches": 1,
  139. "match": {
  140. "method": "POST",
  141. "pathIncludes": "/messages",
  142. "lastUserMessageIncludes": ["E2E_AAB_CHILD_LEGACY: Return exactly"],
  143. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  144. },
  145. "response": {
  146. "statusCode": 200,
  147. "delayMs": 10000,
  148. "text": {
  149. "id": "aab-child-legacy",
  150. "text": "E2E_AAB_CHILD_LEGACY_DONE"
  151. }
  152. }
  153. },
  154. {
  155. "id": "aab-a-notify",
  156. "description": "子代理完成通知开启的父会话新一轮;两个通知可能分两轮,也可能合为一轮。",
  157. "metadata": {
  158. "kind": "main",
  159. "timingPolicy": "task-notification",
  160. "source": "synthetic",
  161. "syntheticReason": "通知轮只需固定收尾文字;spec 从请求体核对两个调用都收到通知。"
  162. },
  163. "maxMatches": 2,
  164. "match": {
  165. "method": "POST",
  166. "pathIncludes": "/messages",
  167. "bodyIncludes": ["E2E_AAB_A1", "<task-notification>"],
  168. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  169. "lastUserMessageIncludes": ["<task-notification>"]
  170. },
  171. "response": {
  172. "statusCode": 200,
  173. "text": {
  174. "id": "aab-a-notify",
  175. "text": "AAB_A_NOTIFIED"
  176. }
  177. }
  178. },
  179. {
  180. "id": "aab-a3",
  181. "description": "开关关闭后 A 的下一轮:文字收尾。",
  182. "metadata": {
  183. "kind": "main",
  184. "timingPolicy": "fast-text",
  185. "source": "synthetic",
  186. "syntheticReason": "spec 读取请求体,断言运行中的 A 仍没有 run_in_background。"
  187. },
  188. "maxMatches": 1,
  189. "match": {
  190. "method": "POST",
  191. "pathIncludes": "/messages",
  192. "lastUserMessageIncludes": ["E2E_AAB_A3"],
  193. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  194. },
  195. "response": {
  196. "statusCode": 200,
  197. "text": {
  198. "id": "aab-a3",
  199. "text": "AAB_A3_DONE"
  200. }
  201. }
  202. },
  203. {
  204. "id": "aab-title-b",
  205. "description": "E2E_AAB_B1 首发的确定性标题响应。",
  206. "metadata": {
  207. "kind": "common",
  208. "timingPolicy": "fast-text",
  209. "source": "synthetic",
  210. "syntheticReason": "首发会异步触发 title sidecar;用首轮 marker 隔离并固定标题响应。"
  211. },
  212. "maxMatches": 1,
  213. "match": {
  214. "method": "POST",
  215. "pathIncludes": "/messages",
  216. "bodyIncludes": ["Generate a concise title", "E2E_AAB_B1"]
  217. },
  218. "response": {
  219. "statusCode": 200,
  220. "text": {
  221. "id": "aab-title-b",
  222. "inputTokens": 64,
  223. "outputTokens": 8,
  224. "text": "{\"title\":\"Agent Always Background B\"}"
  225. }
  226. }
  227. },
  228. {
  229. "id": "aab-b1",
  230. "description": "B 首个请求:一个没有 run_in_background 的 Agent 调用。",
  231. "metadata": {
  232. "kind": "main",
  233. "timingPolicy": "fast-tool-use",
  234. "source": "synthetic",
  235. "syntheticReason": "开关关闭后新建的任务按旧形态运行;spec 断言 schema 有 run_in_background,且 Agent 在前台运行。"
  236. },
  237. "maxMatches": 1,
  238. "match": {
  239. "method": "POST",
  240. "pathIncludes": "/messages",
  241. "lastUserMessageIncludes": ["E2E_AAB_B1"],
  242. "bodyExcludes": [
  243. "Generate a concise title",
  244. "CRITICAL: Respond with TEXT ONLY",
  245. "toolu_aab_b_plain"
  246. ]
  247. },
  248. "response": {
  249. "statusCode": 200,
  250. "toolUse": {
  251. "id": "toolu_aab_b_plain",
  252. "name": "Agent",
  253. "input": {
  254. "description": "AAB foreground agent",
  255. "prompt": "E2E_AAB_CHILD_B: Return exactly E2E_AAB_CHILD_B_DONE."
  256. }
  257. }
  258. }
  259. },
  260. {
  261. "id": "aab-child-b",
  262. "description": "子代理 E2E_AAB_CHILD_B 返回固定结果。",
  263. "metadata": {
  264. "kind": "subagent",
  265. "timingPolicy": "fast-text",
  266. "source": "synthetic",
  267. "syntheticReason": "前台子代理只需固定结果;断言在父会话工具批次后的请求里读取它。"
  268. },
  269. "maxMatches": 1,
  270. "match": {
  271. "method": "POST",
  272. "pathIncludes": "/messages",
  273. "lastUserMessageIncludes": ["E2E_AAB_CHILD_B: Return exactly"],
  274. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  275. },
  276. "response": {
  277. "statusCode": 200,
  278. "text": {
  279. "id": "aab-child-b",
  280. "text": "E2E_AAB_CHILD_B_DONE"
  281. }
  282. }
  283. },
  284. {
  285. "id": "aab-b2",
  286. "description": "B 工具批次之后:前台子代理的结果,父会话文字收尾。",
  287. "metadata": {
  288. "kind": "main",
  289. "timingPolicy": "fast-text",
  290. "source": "synthetic",
  291. "syntheticReason": "前台子代理结果之后固定收尾文字;spec 读取请求体,断言 tool_result 是子代理结果、没有启动回执。"
  292. },
  293. "maxMatches": 1,
  294. "match": {
  295. "method": "POST",
  296. "pathIncludes": "/messages",
  297. "bodyIncludes": ["E2E_AAB_B1", "toolu_aab_b_plain", "E2E_AAB_CHILD_B_DONE"],
  298. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  299. },
  300. "response": {
  301. "statusCode": 200,
  302. "text": {
  303. "id": "aab-b2",
  304. "text": "AAB_B_DONE"
  305. }
  306. }
  307. }
  308. ]
  309. }