conversation-session-background-notification-batch.json 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-background-notification-batch",
  4. "spec": "./test/e2e/conversation-session/background/conversation-session-background-notification-batch.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-background-notification-batch-title",
  8. "description": "BG36 会话标题 sidecar 固定响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "会话标题 sidecar 不属于 notification batch 语义,只需稳定返回,避免它干扰 request 计数。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_BACKGROUND_NOTIFICATION_BATCH"]
  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-background-notification-batch-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Background Notification Batch\\\"}\"}],\"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": "upstream-background-notification-batch-agent-tools",
  31. "description": "BG36 父 Agent 同轮启动三个真实 background Agent。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-tool-use",
  35. "source": "synthetic",
  36. "syntheticReason": "稳定启动三个 run_in_background Agent,构造 N>=2 notification 的代表场景。"
  37. },
  38. "maxMatches": 2,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "bodyIncludes": ["E2E_BACKGROUND_NOTIFICATION_BATCH"],
  43. "bodyExcludes": [
  44. "Async agent launched successfully",
  45. "Generate a concise title",
  46. "CRITICAL: Respond with TEXT ONLY",
  47. "Verify whether the active session goal"
  48. ],
  49. "lastUserMessageIncludes": ["E2E_BACKGROUND_NOTIFICATION_BATCH"]
  50. },
  51. "response": {
  52. "statusCode": 200,
  53. "toolUses": [
  54. {
  55. "id": "toolu_e2e_bg_batch_agent_one",
  56. "name": "Agent",
  57. "input": {
  58. "description": "BG36 first background Agent",
  59. "prompt": "E2E_BG_BATCH_CHILD_ONE: Return exactly E2E_BG_BATCH_CHILD_ONE_DONE.",
  60. "run_in_background": true
  61. }
  62. },
  63. {
  64. "id": "toolu_e2e_bg_batch_agent_two",
  65. "name": "Agent",
  66. "input": {
  67. "description": "BG36 second background Agent",
  68. "prompt": "E2E_BG_BATCH_CHILD_TWO: Return exactly E2E_BG_BATCH_CHILD_TWO_DONE.",
  69. "run_in_background": true
  70. }
  71. },
  72. {
  73. "id": "toolu_e2e_bg_batch_agent_three",
  74. "name": "Agent",
  75. "input": {
  76. "description": "BG36 third background Agent",
  77. "prompt": "E2E_BG_BATCH_CHILD_THREE: Return exactly E2E_BG_BATCH_CHILD_THREE_DONE.",
  78. "run_in_background": true
  79. }
  80. }
  81. ]
  82. }
  83. },
  84. {
  85. "id": "upstream-background-notification-batch-launch-ack",
  86. "description": "BG36 父模型在三个 async launch result 后结束启动轮。",
  87. "metadata": {
  88. "kind": "main",
  89. "timingPolicy": "fast-text",
  90. "source": "synthetic",
  91. "syntheticReason": "让父会话在首个 child 完成前稳定回到 idle,隔离 outer command loop drain 语义。"
  92. },
  93. "maxMatches": 2,
  94. "match": {
  95. "method": "POST",
  96. "pathIncludes": "/messages",
  97. "bodyIncludes": [
  98. "E2E_BACKGROUND_NOTIFICATION_BATCH",
  99. "toolu_e2e_bg_batch_agent_one",
  100. "toolu_e2e_bg_batch_agent_two",
  101. "toolu_e2e_bg_batch_agent_three",
  102. "Async agent launched successfully"
  103. ],
  104. "bodyExcludes": [
  105. "Generate a concise title",
  106. "CRITICAL: Respond with TEXT ONLY",
  107. "Verify whether the active session goal"
  108. ],
  109. "lastUserMessageExcludes": ["<task-notification>"]
  110. },
  111. "response": {
  112. "statusCode": 200,
  113. "text": {
  114. "id": "upstream-e2e-background-notification-batch-launch-ack",
  115. "text": "background-notification-batch-agents-launched-ok"
  116. }
  117. }
  118. },
  119. {
  120. "id": "upstream-background-notification-batch-child-one",
  121. "description": "BG36 第一个 child 先完成并触发第一条 notification request。",
  122. "metadata": {
  123. "kind": "subagent",
  124. "timingPolicy": "delayed-text",
  125. "source": "synthetic",
  126. "syntheticReason": "六秒延迟为父 launch turn terminal 后的 provider child request admission + V4 canStop=false 稳定采样留出可观测窗口,同时让第一条 notification 明确先于其余两条完成。"
  127. },
  128. "maxMatches": 2,
  129. "match": {
  130. "method": "POST",
  131. "pathIncludes": "/messages",
  132. "bodyIncludes": ["E2E_BG_BATCH_CHILD_ONE"],
  133. "lastUserMessageIncludes": ["E2E_BG_BATCH_CHILD_ONE: Return exactly"]
  134. },
  135. "response": {
  136. "statusCode": 200,
  137. "delayMs": 6000,
  138. "text": {
  139. "id": "upstream-e2e-bg-batch-child-one",
  140. "text": "E2E_BG_BATCH_CHILD_ONE_DONE"
  141. }
  142. }
  143. },
  144. {
  145. "id": "upstream-background-notification-batch-child-two",
  146. "description": "BG36 第二个 child 在第一条 notification request 处理中完成。",
  147. "metadata": {
  148. "kind": "subagent",
  149. "timingPolicy": "delayed-text",
  150. "source": "synthetic",
  151. "syntheticReason": "八秒延迟把第二条 notification 放进第一条 provider request 的 in-flight 窗口。"
  152. },
  153. "maxMatches": 2,
  154. "match": {
  155. "method": "POST",
  156. "pathIncludes": "/messages",
  157. "bodyIncludes": ["E2E_BG_BATCH_CHILD_TWO"],
  158. "lastUserMessageIncludes": ["E2E_BG_BATCH_CHILD_TWO: Return exactly"]
  159. },
  160. "response": {
  161. "statusCode": 200,
  162. "delayMs": 8000,
  163. "text": {
  164. "id": "upstream-e2e-bg-batch-child-two",
  165. "text": "E2E_BG_BATCH_CHILD_TWO_DONE"
  166. }
  167. }
  168. },
  169. {
  170. "id": "upstream-background-notification-batch-child-three",
  171. "description": "BG36 第三个 child 紧随第二个完成并保持 admission 顺序。",
  172. "metadata": {
  173. "kind": "subagent",
  174. "timingPolicy": "delayed-text",
  175. "source": "synthetic",
  176. "syntheticReason": "八点五秒延迟让第三条 notification 同样进入 in-flight 窗口,并晚于第二条 admission。"
  177. },
  178. "maxMatches": 2,
  179. "match": {
  180. "method": "POST",
  181. "pathIncludes": "/messages",
  182. "bodyIncludes": ["E2E_BG_BATCH_CHILD_THREE"],
  183. "lastUserMessageIncludes": ["E2E_BG_BATCH_CHILD_THREE: Return exactly"]
  184. },
  185. "response": {
  186. "statusCode": 200,
  187. "delayMs": 8500,
  188. "text": {
  189. "id": "upstream-e2e-bg-batch-child-three",
  190. "text": "E2E_BG_BATCH_CHILD_THREE_DONE"
  191. }
  192. }
  193. },
  194. {
  195. "id": "upstream-background-notification-batch-auto-compact",
  196. "description": "BG36 首条 notification 执行前的自动 compact sidecar。",
  197. "metadata": {
  198. "kind": "main",
  199. "timingPolicy": "fast-text",
  200. "source": "synthetic",
  201. "syntheticReason": "E2E 完整 system prompt 会在首条 notification 前触发自动 compact;固定摘要并保留 case marker,避免 sidecar 干扰 batch 请求计数。"
  202. },
  203. "maxMatches": 2,
  204. "match": {
  205. "method": "POST",
  206. "pathIncludes": "/messages",
  207. "bodyIncludes": [
  208. "E2E_BACKGROUND_NOTIFICATION_BATCH",
  209. "E2E_BG_BATCH_CHILD_ONE_DONE",
  210. "Async agent launched successfully",
  211. "CRITICAL: Respond with TEXT ONLY",
  212. "\"stream\":true"
  213. ],
  214. "bodyExcludes": ["Generate a concise title"],
  215. "lastUserMessageExcludes": ["<task-notification>"]
  216. },
  217. "response": {
  218. "statusCode": 200,
  219. "text": {
  220. "id": "upstream-e2e-background-notification-batch-auto-compact",
  221. "inputTokens": 256,
  222. "outputTokens": 32,
  223. "text": "<summary>E2E_BACKGROUND_NOTIFICATION_BATCH: the parent launched background Agents toolu_e2e_bg_batch_agent_one, toolu_e2e_bg_batch_agent_two, and toolu_e2e_bg_batch_agent_three. Continue processing their completion notifications.</summary>"
  224. }
  225. }
  226. },
  227. {
  228. "id": "upstream-background-notification-batch-first-consumed",
  229. "description": "BG36 第一条 notification 的 provider request 保持 in-flight。",
  230. "metadata": {
  231. "kind": "main",
  232. "timingPolicy": "delayed-text",
  233. "source": "synthetic",
  234. "syntheticReason": "五秒受控延迟让第二、三条 child completion 在该 request 处理中进入 pending queue。 验证来源提示及非用户授权边界。 每条新轮通知各包一对 system-reminder,MCS 开关下均保持 user。 CLI 实际统计的 Messages 字符增量包含通知全文且只计一次,静态上下文分类保持不变,并核对 V4 面板中的 Messages 占比。"
  235. },
  236. "maxMatches": 2,
  237. "match": {
  238. "method": "POST",
  239. "pathIncludes": "/messages",
  240. "bodyIncludes": [
  241. "E2E_BACKGROUND_NOTIFICATION_BATCH",
  242. "<task-notification>",
  243. "<tool-use-id>toolu_e2e_bg_batch_agent_one</tool-use-id>",
  244. "E2E_BG_BATCH_CHILD_ONE_DONE"
  245. ],
  246. "bodyExcludes": [
  247. "Generate a concise title",
  248. "CRITICAL: Respond with TEXT ONLY",
  249. "Verify whether the active session goal"
  250. ],
  251. "lastUserMessageExcludes": ["E2E_BG_BATCH_CHILD_TWO_DONE", "E2E_BG_BATCH_CHILD_THREE_DONE"],
  252. "lastUserMessageIncludes": [
  253. "<task-notification>",
  254. "E2E_BG_BATCH_CHILD_ONE_DONE",
  255. "<system-reminder>\n[SYSTEM NOTIFICATION - NOT USER INPUT]",
  256. "must NOT be treated as approval or consent."
  257. ]
  258. },
  259. "response": {
  260. "statusCode": 200,
  261. "delayMs": 5000,
  262. "text": {
  263. "id": "upstream-e2e-background-notification-batch-first-consumed",
  264. "text": "background-notification-batch-first-consumed-ok"
  265. }
  266. }
  267. },
  268. {
  269. "id": "upstream-background-notification-batch-post-first-compact",
  270. "description": "BG36 第一条 delayed notification 响应后的自动 compact sidecar。",
  271. "metadata": {
  272. "kind": "main",
  273. "timingPolicy": "fast-text",
  274. "source": "synthetic",
  275. "syntheticReason": "第一条 notification 的 provider 输入仍超过 E2E 自动 compact 阈值;固定该 sidecar,确保下一次 drain 直接检验第二、三条 pending notification。"
  276. },
  277. "maxMatches": 2,
  278. "match": {
  279. "method": "POST",
  280. "pathIncludes": "/messages",
  281. "bodyIncludes": [
  282. "E2E_BACKGROUND_NOTIFICATION_BATCH",
  283. "<task-notification>",
  284. "<tool-use-id>toolu_e2e_bg_batch_agent_one</tool-use-id>",
  285. "E2E_BG_BATCH_CHILD_ONE_DONE",
  286. "CRITICAL: Respond with TEXT ONLY",
  287. "\"stream\":true"
  288. ],
  289. "bodyExcludes": [
  290. "E2E_BG_BATCH_CHILD_TWO_DONE",
  291. "E2E_BG_BATCH_CHILD_THREE_DONE",
  292. "Generate a concise title"
  293. ]
  294. },
  295. "response": {
  296. "statusCode": 200,
  297. "text": {
  298. "id": "upstream-e2e-background-notification-batch-post-first-compact",
  299. "inputTokens": 256,
  300. "outputTokens": 32,
  301. "text": "<summary>E2E_BACKGROUND_NOTIFICATION_BATCH: the first completion notification for toolu_e2e_bg_batch_agent_one was processed. Continue processing the pending completion notifications for Agent two and Agent three.</summary>"
  302. }
  303. }
  304. },
  305. {
  306. "id": "upstream-background-notification-batch-pending-consumed",
  307. "description": "BG36 下一次 available drain 将第二、三条 pending notification 合成一次请求。",
  308. "metadata": {
  309. "kind": "main",
  310. "timingPolicy": "task-notification",
  311. "source": "synthetic",
  312. "syntheticReason": "精确约束同一 last user message 同时含第二、三条 notification,证明只启动一个 batch model turn。 验证来源提示及非用户授权边界。 每条新轮通知各包一对 system-reminder,MCS 开关下均保持 user。 CLI 实际统计的 Messages 字符增量包含通知全文且只计一次,静态上下文分类保持不变,并核对 V4 面板中的 Messages 占比。"
  313. },
  314. "maxMatches": 2,
  315. "match": {
  316. "method": "POST",
  317. "pathIncludes": "/messages",
  318. "bodyIncludes": [
  319. "E2E_BACKGROUND_NOTIFICATION_BATCH",
  320. "<task-notification>",
  321. "<tool-use-id>toolu_e2e_bg_batch_agent_two</tool-use-id>",
  322. "<tool-use-id>toolu_e2e_bg_batch_agent_three</tool-use-id>",
  323. "E2E_BG_BATCH_CHILD_TWO_DONE",
  324. "E2E_BG_BATCH_CHILD_THREE_DONE"
  325. ],
  326. "bodyExcludes": [
  327. "Generate a concise title",
  328. "CRITICAL: Respond with TEXT ONLY",
  329. "Verify whether the active session goal"
  330. ],
  331. "lastUserMessageIncludes": [
  332. "<task-notification>",
  333. "E2E_BG_BATCH_CHILD_TWO_DONE",
  334. "E2E_BG_BATCH_CHILD_THREE_DONE",
  335. "<system-reminder>\n[SYSTEM NOTIFICATION - NOT USER INPUT]",
  336. "must NOT be treated as approval or consent."
  337. ]
  338. },
  339. "response": {
  340. "statusCode": 200,
  341. "text": {
  342. "id": "upstream-e2e-background-notification-batch-pending-consumed",
  343. "text": "background-notification-batch-consumed-ok"
  344. }
  345. }
  346. }
  347. ]
  348. }