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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-send-message-resume-stop",
  4. "spec": "./test/e2e/conversation-session/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": [
  135. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  136. "agentId: agent_"
  137. ],
  138. "bodyExcludes": [
  139. "resumed it in the background",
  140. "Generate a concise title",
  141. "CRITICAL: Respond with TEXT ONLY"
  142. ]
  143. },
  144. "response": {
  145. "statusCode": 200,
  146. "toolUse": {
  147. "id": "toolu_e2e_send_message_resume_stop_send_message",
  148. "name": "SendMessage",
  149. "inputTokens": 32,
  150. "input": {
  151. "to": "{{latestAgentId}}",
  152. "summary": "resume stopped agent for stop check",
  153. "message": "You MUST invoke the Bash tool with command \"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."
  154. }
  155. }
  156. }
  157. },
  158. {
  159. "id": "send-message-resume-stop-parent-idle",
  160. "description": "SendMessage 成功后父模型结束 resume turn。",
  161. "metadata": {
  162. "kind": "main",
  163. "timingPolicy": "fast-text",
  164. "source": "synthetic",
  165. "syntheticReason": "固定 SendMessage 成功后的 parent idle 边界,避免 live 模型额外调用 TaskOutput。"
  166. },
  167. "maxMatches": 1,
  168. "match": {
  169. "method": "POST",
  170. "pathIncludes": "/messages",
  171. "bodyIncludes": [
  172. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  173. "resumed it in the background"
  174. ],
  175. "bodyExcludes": [
  176. "<status>stopped</status>",
  177. "Generate a concise title",
  178. "CRITICAL: Respond with TEXT ONLY"
  179. ]
  180. },
  181. "response": {
  182. "statusCode": 200,
  183. "text": {
  184. "id": "upstream-e2e-send-message-resume-stop-parent-idle",
  185. "inputTokens": 32,
  186. "text": "E2E_SEND_MESSAGE_RESUME_STOP_PARENT_IDLE"
  187. }
  188. }
  189. },
  190. {
  191. "id": "send-message-resume-stop-stop-notification",
  192. "description": "Stop completion notification 被父模型消费并结束 turn。",
  193. "metadata": {
  194. "kind": "main",
  195. "timingPolicy": "fast-text",
  196. "source": "synthetic",
  197. "syntheticReason": "为 Stop 后的后台 completion notification turn 提供唯一完成屏障。"
  198. },
  199. "maxMatches": 1,
  200. "match": {
  201. "method": "POST",
  202. "pathIncludes": "/messages",
  203. "lastUserMessageIncludes": [
  204. "<task-notification>",
  205. "<status>stopped</status>"
  206. ],
  207. "bodyIncludes": [
  208. "E2E_SEND_MESSAGE_RESUME_STOP_PARENT",
  209. "<task-notification>",
  210. "<tool-use-id>toolu_e2e_send_message_resume_stop_send_message</tool-use-id>",
  211. "<status>stopped</status>"
  212. ],
  213. "bodyExcludes": [
  214. "Generate a concise title",
  215. "CRITICAL: Respond with TEXT ONLY"
  216. ]
  217. },
  218. "response": {
  219. "statusCode": 200,
  220. "text": {
  221. "id": "upstream-e2e-send-message-resume-stop-notification-done",
  222. "inputTokens": 32,
  223. "text": "E2E_SEND_MESSAGE_RESUME_STOP_NOTIFICATION_DONE"
  224. }
  225. }
  226. },
  227. {
  228. "id": "send-message-resume-stop-foreground-compact",
  229. "description": "foreground Agent 完成后的自动 compact 保留原 agent identity。",
  230. "metadata": {
  231. "kind": "main",
  232. "timingPolicy": "fast-text",
  233. "source": "synthetic",
  234. "syntheticReason": "E2E 默认模型窗口会在 foreground tool result 后 compact;固定 summary 保留第二个 turn 所需 identity。"
  235. },
  236. "maxMatches": 1,
  237. "match": {
  238. "method": "POST",
  239. "pathIncludes": "/messages",
  240. "bodyIncludes": [
  241. "CRITICAL: Respond with TEXT ONLY",
  242. "E2E_SEND_MESSAGE_RESUME_STOP_PARENT",
  243. "E2E_SEND_MESSAGE_RESUME_STOP_FOREGROUND_DONE",
  244. "agentId: agent_"
  245. ],
  246. "bodyExcludes": [
  247. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  248. "resumed it in the background",
  249. "<status>stopped</status>"
  250. ]
  251. },
  252. "response": {
  253. "statusCode": 200,
  254. "text": {
  255. "id": "upstream-e2e-send-message-resume-stop-foreground-compact",
  256. "inputTokens": 32,
  257. "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>"
  258. }
  259. }
  260. },
  261. {
  262. "id": "send-message-resume-stop-resume-pending-compact",
  263. "description": "SendMessage tool result 进入上下文前的自动 compact 保留目标 agent。",
  264. "metadata": {
  265. "kind": "main",
  266. "timingPolicy": "fast-text",
  267. "source": "synthetic",
  268. "syntheticReason": "SendMessage tool call/result 位于 compact 保留段;summary 只保留当前用户请求和原 agent identity。"
  269. },
  270. "maxMatches": 1,
  271. "match": {
  272. "method": "POST",
  273. "pathIncludes": "/messages",
  274. "bodyIncludes": [
  275. "CRITICAL: Respond with TEXT ONLY",
  276. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  277. "agentId: agent_"
  278. ],
  279. "bodyExcludes": ["<status>stopped</status>"]
  280. },
  281. "response": {
  282. "statusCode": 200,
  283. "text": {
  284. "id": "upstream-e2e-send-message-resume-stop-resume-pending-compact",
  285. "inputTokens": 32,
  286. "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>"
  287. }
  288. }
  289. },
  290. {
  291. "id": "send-message-resume-stop-resumed-compact",
  292. "description": "SendMessage 成功后的自动 compact 保留 resume 状态。",
  293. "metadata": {
  294. "kind": "main",
  295. "timingPolicy": "fast-text",
  296. "source": "synthetic",
  297. "syntheticReason": "父 turn 结束后的 compact 必须保留真实 SendMessage 成功结果,供 Stop notification turn 继续。"
  298. },
  299. "maxMatches": 1,
  300. "match": {
  301. "method": "POST",
  302. "pathIncludes": "/messages",
  303. "bodyIncludes": [
  304. "CRITICAL: Respond with TEXT ONLY",
  305. "E2E_SEND_MESSAGE_RESUME_STOP_RESUME",
  306. "toolu_e2e_send_message_resume_stop_send_message",
  307. "resumed it in the background",
  308. "agentId: agent_"
  309. ],
  310. "bodyExcludes": ["<status>stopped</status>"]
  311. },
  312. "response": {
  313. "statusCode": 200,
  314. "text": {
  315. "id": "upstream-e2e-send-message-resume-stop-resumed-compact",
  316. "inputTokens": 32,
  317. "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>"
  318. }
  319. }
  320. },
  321. {
  322. "id": "send-message-resume-stop-child-bash",
  323. "description": "resumed child 启动可取消的长时间 Bash。",
  324. "metadata": {
  325. "kind": "subagent",
  326. "timingPolicy": "controlled-stream",
  327. "source": "synthetic",
  328. "syntheticReason": "固定 resumed child running 窗口,以验证 Stop 可见和 accepted cancel。"
  329. },
  330. "maxMatches": 1,
  331. "match": {
  332. "method": "POST",
  333. "pathIncludes": "/messages",
  334. "lastUserMessageIncludes": ["E2E_SEND_MESSAGE_RESUME_STOP_CHILD_DONE"],
  335. "bodyIncludes": ["sleep 120"],
  336. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  337. },
  338. "response": {
  339. "statusCode": 200,
  340. "toolUse": {
  341. "id": "toolu_e2e_send_message_resume_stop_bash",
  342. "name": "Bash",
  343. "inputTokens": 32,
  344. "input": {
  345. "command": "sleep 120",
  346. "description": "Keep resumed child running for Stop"
  347. }
  348. }
  349. }
  350. }
  351. ]
  352. }