conversation-session-send-message-resume-stop.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-send-message-resume-stop",
  4. "spec": "./test/e2e/conversation-session/execution/conversation-session-send-message-resume-stop.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "send-message-resume-stop-title",
  8. "description": "固定本 case 的 session title generation。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题生成不属于 SAT12 语义;固定响应避免隐藏请求重试阻塞主 turn。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["Generate a concise title", "E2E_SEND_MESSAGE_RESUME_STOP_PARENT"]
  20. },
  21. "response": {
  22. "statusCode": 200,
  23. "statusMessage": "OK",
  24. "headers": {
  25. "content-type": "application/json; charset=utf-8"
  26. },
  27. "body": "{\"id\":\"upstream-e2e-send-message-resume-stop-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"SendMessage Resume Stop E2E\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":12,\"service_tier\":\"standard\"}}"
  28. }
  29. },
  30. {
  31. "id": "send-message-resume-stop-parent-agent",
  32. "description": "父模型启动一个 foreground Agent。",
  33. "metadata": {
  34. "kind": "main",
  35. "timingPolicy": "fast-tool-use",
  36. "source": "synthetic",
  37. "syntheticReason": "固定 foreground Agent 启动,避免 live 模型改变 SAT12 前置状态。"
  38. },
  39. "maxMatches": 1,
  40. "match": {
  41. "method": "POST",
  42. "pathIncludes": "/messages",
  43. "lastUserMessageIncludes": ["E2E_SEND_MESSAGE_RESUME_STOP_PARENT"],
  44. "bodyIncludes": ["E2E_SEND_MESSAGE_RESUME_STOP_PARENT"],
  45. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  46. },
  47. "response": {
  48. "statusCode": 200,
  49. "toolUse": {
  50. "id": "toolu_e2e_send_message_resume_stop_agent",
  51. "name": "Agent",
  52. "inputTokens": 32,
  53. "input": {
  54. "description": "E2E foreground agent for resume stop",
  55. "prompt": "Reply with exactly E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_DONE.",
  56. "run_in_background": false,
  57. "subagent_type": "general-purpose"
  58. }
  59. }
  60. }
  61. },
  62. {
  63. "id": "send-message-resume-stop-foreground-child",
  64. "description": "foreground child 完成并进入 terminal。",
  65. "metadata": {
  66. "kind": "subagent",
  67. "timingPolicy": "fast-text",
  68. "source": "synthetic",
  69. "syntheticReason": "稳定形成可由 SendMessage resume 的 terminal local agent。"
  70. },
  71. "maxMatches": 1,
  72. "match": {
  73. "method": "POST",
  74. "pathIncludes": "/messages",
  75. "lastUserMessageIncludes": ["E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_DONE"],
  76. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  77. },
  78. "response": {
  79. "statusCode": 200,
  80. "text": {
  81. "id": "upstream-e2e-send-message-resume-stop-foreground-done",
  82. "inputTokens": 32,
  83. "text": "E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_DONE"
  84. }
  85. }
  86. },
  87. {
  88. "id": "send-message-resume-stop-parent-foreground-idle",
  89. "description": "foreground Agent 完成后父模型结束第一个 turn。",
  90. "metadata": {
  91. "kind": "main",
  92. "timingPolicy": "fast-text",
  93. "source": "synthetic",
  94. "syntheticReason": "在 SendMessage 前形成稳定 idle 边界,供 E2E 固化原 foreground identity。"
  95. },
  96. "maxMatches": 1,
  97. "match": {
  98. "method": "POST",
  99. "pathIncludes": "/messages",
  100. "bodyIncludes": [
  101. "E2E_SEND_MESSAGE_RESUME_STOP_PARENT",
  102. "E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_DONE",
  103. "agentId: agent_"
  104. ],
  105. "bodyExcludes": [
  106. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  107. "resumed it in the background",
  108. "Generate a concise title",
  109. "CRITICAL: Respond with TEXT ONLY"
  110. ]
  111. },
  112. "response": {
  113. "statusCode": 200,
  114. "text": {
  115. "id": "upstream-e2e-send-message-resume-stop-foreground-parent-idle",
  116. "inputTokens": 32,
  117. "text": "E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_PARENT_IDLE"
  118. }
  119. }
  120. },
  121. {
  122. "id": "send-message-resume-stop-parent-send-message",
  123. "description": "第二个用户 turn 让父模型向已完成的同一 agent 发送 SendMessage。",
  124. "metadata": {
  125. "kind": "main",
  126. "timingPolicy": "fast-tool-use",
  127. "source": "synthetic",
  128. "syntheticReason": "使用 replay 注入的真实 agentId,固定触发 terminal resume。"
  129. },
  130. "maxMatches": 1,
  131. "match": {
  132. "method": "POST",
  133. "pathIncludes": "/messages",
  134. "bodyIncludes": ["E2E_SEND_MESSAGE_RESUME_STOP_RESUME", "agentId: agent_"],
  135. "bodyExcludes": [
  136. "resumed it in the background",
  137. "Generate a concise title",
  138. "CRITICAL: Respond with TEXT ONLY"
  139. ]
  140. },
  141. "response": {
  142. "statusCode": 200,
  143. "toolUse": {
  144. "id": "toolu_e2e_send_message_resume_stop_send_message",
  145. "name": "SendMessage",
  146. "inputTokens": 32,
  147. "input": {
  148. "to": "{{latestAgentId}}",
  149. "message": "You MUST invoke the Bash tool with command \"sh -c 'sleep 120'\". Do not send any text before the Bash tool finishes. After it finishes, reply with exactly E2E_SEND_MESSAGE_RESUME_STOP_CHILD_DONE."
  150. }
  151. }
  152. }
  153. },
  154. {
  155. "id": "send-message-resume-stop-parent-idle",
  156. "description": "SendMessage 成功后父模型结束 resume turn。",
  157. "metadata": {
  158. "kind": "main",
  159. "timingPolicy": "fast-text",
  160. "source": "synthetic",
  161. "syntheticReason": "固定 SendMessage 成功后的 parent idle 边界,避免 live 模型额外调用 TaskOutput。"
  162. },
  163. "maxMatches": 1,
  164. "match": {
  165. "method": "POST",
  166. "pathIncludes": "/messages",
  167. "bodyIncludes": ["E2E_SEND_MESSAGE_RESUME_STOP_RESUME", "resumed it in the background"],
  168. "bodyExcludes": [
  169. "<status>killed</status>",
  170. "Generate a concise title",
  171. "CRITICAL: Respond with TEXT ONLY"
  172. ]
  173. },
  174. "response": {
  175. "statusCode": 200,
  176. "text": {
  177. "id": "upstream-e2e-send-message-resume-stop-parent-idle",
  178. "inputTokens": 32,
  179. "text": "E2E_SEND_MESSAGE_RESUME_STOP_PARENT_IDLE"
  180. }
  181. }
  182. },
  183. {
  184. "id": "send-message-resume-stop-stop-notification",
  185. "description": "Stop completion notification 被父模型消费并结束 turn。",
  186. "metadata": {
  187. "kind": "main",
  188. "timingPolicy": "fast-text",
  189. "source": "synthetic",
  190. "syntheticReason": "为 Stop 后的后台 completion notification turn 提供唯一完成屏障。"
  191. },
  192. "maxMatches": 1,
  193. "match": {
  194. "method": "POST",
  195. "pathIncludes": "/messages",
  196. "lastUserMessageIncludes": ["<task-notification>", "<status>killed</status>"],
  197. "bodyIncludes": [
  198. "E2E_SEND_MESSAGE_RESUME_STOP_PARENT",
  199. "<task-notification>",
  200. "<tool-use-id>toolu_e2e_send_message_resume_stop_send_message</tool-use-id>",
  201. "<status>killed</status>"
  202. ],
  203. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  204. },
  205. "response": {
  206. "statusCode": 200,
  207. "text": {
  208. "id": "upstream-e2e-send-message-resume-stop-notification-done",
  209. "inputTokens": 32,
  210. "text": "E2E_SEND_MESSAGE_RESUME_STOP_NOTIFICATION_DONE"
  211. }
  212. }
  213. },
  214. {
  215. "id": "send-message-resume-stop-foreground-compact",
  216. "description": "foreground Agent 完成后的自动 compact 保留原 agent identity。",
  217. "metadata": {
  218. "kind": "main",
  219. "timingPolicy": "fast-text",
  220. "source": "synthetic",
  221. "syntheticReason": "E2E 默认模型窗口会在 foreground tool result 后 compact;固定 summary 保留第二个 turn 所需 identity。"
  222. },
  223. "maxMatches": 1,
  224. "match": {
  225. "method": "POST",
  226. "pathIncludes": "/messages",
  227. "bodyIncludes": [
  228. "CRITICAL: Respond with TEXT ONLY",
  229. "E2E_SEND_MESSAGE_RESUME_STOP_PARENT",
  230. "E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_DONE",
  231. "agentId: agent_"
  232. ],
  233. "bodyExcludes": [
  234. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  235. "resumed it in the background",
  236. "<status>killed</status>"
  237. ]
  238. },
  239. "response": {
  240. "statusCode": 200,
  241. "text": {
  242. "id": "upstream-e2e-send-message-resume-stop-foreground-compact",
  243. "inputTokens": 32,
  244. "text": "<summary>E2E_SEND_MESSAGE_RESUME_STOP_PARENT: foreground Agent returned E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_DONE and completed. agentId: {{latestAgentId}}. Finish this foreground-only turn without another tool call.</summary>"
  245. }
  246. }
  247. },
  248. {
  249. "id": "send-message-resume-stop-resume-pending-compact",
  250. "description": "SendMessage tool result 进入上下文前的自动 compact 保留目标 agent。",
  251. "metadata": {
  252. "kind": "main",
  253. "timingPolicy": "fast-text",
  254. "source": "synthetic",
  255. "syntheticReason": "SendMessage tool call/result 位于 compact 保留段;summary 只保留当前用户请求和原 agent identity。"
  256. },
  257. "maxMatches": 1,
  258. "match": {
  259. "method": "POST",
  260. "pathIncludes": "/messages",
  261. "bodyIncludes": [
  262. "CRITICAL: Respond with TEXT ONLY",
  263. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  264. "agentId: agent_"
  265. ],
  266. "bodyExcludes": ["<status>killed</status>"]
  267. },
  268. "response": {
  269. "statusCode": 200,
  270. "text": {
  271. "id": "upstream-e2e-send-message-resume-stop-resume-pending-compact",
  272. "inputTokens": 32,
  273. "text": "<summary>E2E_SEND_MESSAGE_RESUME_STOP_PARENT E2E_SEND_MESSAGE_RESUME_STOP_RESUME: the user requested one SendMessage call to agentId: {{latestAgentId}}. Preserve the in-flight tool call and result outside this summary, then finish the parent turn without another tool call.</summary>"
  274. }
  275. }
  276. },
  277. {
  278. "id": "send-message-resume-stop-resumed-compact",
  279. "description": "SendMessage 成功后的自动 compact 保留 resume 状态。",
  280. "metadata": {
  281. "kind": "main",
  282. "timingPolicy": "fast-text",
  283. "source": "synthetic",
  284. "syntheticReason": "父 turn 结束后的 compact 必须保留真实 SendMessage 成功结果,供 Stop notification turn 继续。"
  285. },
  286. "maxMatches": 1,
  287. "match": {
  288. "method": "POST",
  289. "pathIncludes": "/messages",
  290. "bodyIncludes": [
  291. "CRITICAL: Respond with TEXT ONLY",
  292. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  293. "toolu_e2e_send_message_resume_stop_send_message",
  294. "resumed it in the background",
  295. "agentId: agent_"
  296. ],
  297. "bodyExcludes": ["<status>killed</status>"]
  298. },
  299. "response": {
  300. "statusCode": 200,
  301. "text": {
  302. "id": "upstream-e2e-send-message-resume-stop-resumed-compact",
  303. "inputTokens": 32,
  304. "text": "<summary>E2E_SEND_MESSAGE_RESUME_STOP_PARENT E2E_SEND_MESSAGE_RESUME_STOP_RESUME: SendMessage toolu_e2e_send_message_resume_stop_send_message resumed agentId: {{latestAgentId}} in the background. Wait for its task notification.</summary>"
  305. }
  306. }
  307. },
  308. {
  309. "id": "send-message-resume-stop-child-bash",
  310. "description": "resumed child 启动可取消的长时间 Bash。用 sh -c 包一层:第一个子命令是 sleep 25 秒以上的前台命令会在执行前被拒绝。",
  311. "metadata": {
  312. "kind": "subagent",
  313. "timingPolicy": "controlled-stream",
  314. "source": "synthetic",
  315. "syntheticReason": "固定 resumed child running 窗口,以验证 Stop 可见和 accepted cancel。"
  316. },
  317. "maxMatches": 1,
  318. "match": {
  319. "method": "POST",
  320. "pathIncludes": "/messages",
  321. "lastUserMessageIncludes": ["E2E_SEND_MESSAGE_RESUME_STOP_CHILD_DONE"],
  322. "bodyIncludes": ["sh -c 'sleep 120'"],
  323. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  324. },
  325. "response": {
  326. "statusCode": 200,
  327. "toolUse": {
  328. "id": "toolu_e2e_send_message_resume_stop_bash",
  329. "name": "Bash",
  330. "inputTokens": 32,
  331. "input": {
  332. "command": "sh -c 'sleep 120'",
  333. "description": "Keep resumed child running for Stop"
  334. }
  335. }
  336. }
  337. }
  338. ]
  339. }