conversation-session-subagent-cold-failed-resume.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-subagent-cold-failed-resume",
  4. "spec": "./test/e2e/conversation-session/subagents/conversation-session-subagent-cold-failed-resume.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "subagent-cold-failed-resume-title",
  8. "description": "本例标题旁路响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "source": "synthetic",
  12. "timingPolicy": "fast-text",
  13. "syntheticReason": "标题生成不属于 SAT32,只需稳定返回以免误匹配业务 fixture。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_SAT32_PARENT"]
  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-subagent-cold-failed-resume-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"SAT32 Cold Failed Resume\\\"}\"}],\"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-cold-failed-resume-parent-agent",
  31. "description": "父模型启动一个前台 Agent。",
  32. "metadata": {
  33. "kind": "main",
  34. "source": "synthetic",
  35. "timingPolicy": "fast-tool-use",
  36. "syntheticReason": "固定派发真实前台 Agent;child 失败、落盘、冷恢复与 UI 投影都走生产代码。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_SAT32_PARENT"],
  43. "bodyExcludes": [
  44. "Generate a concise title",
  45. "CRITICAL: Respond with TEXT ONLY",
  46. "E2E_SAT32_CHILD:"
  47. ]
  48. },
  49. "response": {
  50. "statusCode": 200,
  51. "toolUse": {
  52. "id": "toolu_e2e_sat32_agent",
  53. "name": "Agent",
  54. "input": {
  55. "description": "SAT32 failing child",
  56. "prompt": "E2E_SAT32_CHILD: reply with exactly E2E_SAT32_CHILD_FIRST_DONE",
  57. "run_in_background": false,
  58. "subagent_type": "general-purpose"
  59. }
  60. }
  61. }
  62. },
  63. {
  64. "id": "subagent-cold-failed-resume-child-400",
  65. "description": "child 首个请求返回 400,前台 Agent 失败。",
  66. "metadata": {
  67. "kind": "subagent",
  68. "source": "synthetic",
  69. "timingPolicy": "fault-stream",
  70. "syntheticReason": "400 不重试;child session 已就绪后失败,Agent 工具调用保持失败,agentId 行只进入模型可见的 modelContent。"
  71. },
  72. "maxMatches": 1,
  73. "match": {
  74. "method": "POST",
  75. "pathIncludes": "/messages",
  76. "lastUserMessageIncludes": ["E2E_SAT32_CHILD:"],
  77. "bodyExcludes": [
  78. "Generate a concise title",
  79. "CRITICAL: Respond with TEXT ONLY",
  80. "E2E_SAT32_CHILD_RESUME"
  81. ]
  82. },
  83. "response": {
  84. "statusCode": 400,
  85. "delayMs": 200,
  86. "headers": {
  87. "content-type": "application/json"
  88. },
  89. "body": "{\"type\": \"error\", \"error\": {\"type\": \"invalid_request_error\", \"message\": \"E2E_SAT32_CHILD_INVALID_REQUEST\"}}"
  90. }
  91. },
  92. {
  93. "id": "subagent-cold-failed-resume-parent-after-failure",
  94. "description": "父模型收到带 agentId 的失败结果后结束当前 turn。",
  95. "metadata": {
  96. "kind": "main",
  97. "source": "synthetic",
  98. "timingPolicy": "fast-text",
  99. "syntheticReason": "bodyIncludes 的 agentId 行证明同步失败结果交出了续接身份。"
  100. },
  101. "maxMatches": 1,
  102. "match": {
  103. "method": "POST",
  104. "pathIncludes": "/messages",
  105. "bodyIncludes": ["E2E_SAT32_PARENT", "toolu_e2e_sat32_agent", "agentId: agent_"],
  106. "bodyExcludes": [
  107. "Generate a concise title",
  108. "CRITICAL: Respond with TEXT ONLY",
  109. "E2E_SAT32_RESUME"
  110. ]
  111. },
  112. "response": {
  113. "statusCode": 200,
  114. "text": {
  115. "id": "upstream-e2e-sat32-parent-after-failure",
  116. "text": "E2E_SAT32_PARENT_AFTER_FAILURE",
  117. "inputTokens": 64,
  118. "outputTokens": 8
  119. }
  120. }
  121. },
  122. {
  123. "id": "subagent-cold-failed-resume-parent-send-message",
  124. "description": "App 重启后,父模型用 transcript 里的 agentId 调用 SendMessage。",
  125. "metadata": {
  126. "kind": "main",
  127. "source": "synthetic",
  128. "timingPolicy": "fast-tool-use",
  129. "syntheticReason": "使用 replay 从请求里读出的真实 agentId;冷恢复后 registry 为空,SendMessage 必须按 metadata.json 找回。"
  130. },
  131. "maxMatches": 1,
  132. "match": {
  133. "method": "POST",
  134. "pathIncludes": "/messages",
  135. "lastUserMessageIncludes": ["E2E_SAT32_RESUME"],
  136. "bodyIncludes": ["agentId: agent_"],
  137. "bodyExcludes": [
  138. "Generate a concise title",
  139. "CRITICAL: Respond with TEXT ONLY",
  140. "toolu_e2e_sat32_send_message"
  141. ]
  142. },
  143. "response": {
  144. "statusCode": 200,
  145. "toolUse": {
  146. "id": "toolu_e2e_sat32_send_message",
  147. "name": "SendMessage",
  148. "input": {
  149. "to": "{{latestAgentId}}",
  150. "message": "E2E_SAT32_CHILD_RESUME: reply with exactly E2E_SAT32_CHILD_DONE"
  151. }
  152. }
  153. }
  154. },
  155. {
  156. "id": "subagent-cold-failed-resume-child-resumed",
  157. "description": "恢复的 child 带着原历史完成;输出停在半途,等测试释放。",
  158. "metadata": {
  159. "kind": "subagent",
  160. "source": "synthetic",
  161. "timingPolicy": "controlled-stream",
  162. "syntheticReason": "bodyIncludes 原 child 任务证明续接的是同一个 child session;续接的 child 停在半途,测试检查续接进行中只有原 Agent 卡片里的一个子会话入口后再释放,父 turn 先收口,完成通知再单独唤醒父会话。"
  163. },
  164. "maxMatches": 1,
  165. "match": {
  166. "method": "POST",
  167. "pathIncludes": "/messages",
  168. "lastUserMessageIncludes": ["E2E_SAT32_CHILD_RESUME"],
  169. "bodyIncludes": ["E2E_SAT32_CHILD:"],
  170. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  171. },
  172. "response": {
  173. "statusCode": 200,
  174. "headers": {
  175. "content-type": "text/event-stream; charset=utf-8"
  176. },
  177. "chunks": [
  178. {
  179. "offsetMs": 0,
  180. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-sat32-child-resumed\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":64,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0}}}\n\n"
  181. },
  182. {
  183. "offsetMs": 0,
  184. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  185. },
  186. {
  187. "offsetMs": 0,
  188. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_SAT32_CHILD_\"}}\n\n"
  189. },
  190. {
  191. "offsetMs": 0,
  192. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"DONE\"}}\n\n"
  193. },
  194. {
  195. "offsetMs": 0,
  196. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  197. },
  198. {
  199. "offsetMs": 0,
  200. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":64,\"output_tokens\":8}}\n\n"
  201. },
  202. {
  203. "offsetMs": 0,
  204. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  205. }
  206. ],
  207. "releaseAfterChunks": 3
  208. }
  209. },
  210. {
  211. "id": "subagent-cold-failed-resume-parent-resume-ack",
  212. "description": "SendMessage 恢复成功后父模型结束当前 turn。",
  213. "metadata": {
  214. "kind": "main",
  215. "source": "synthetic",
  216. "timingPolicy": "fast-text",
  217. "syntheticReason": "让父会话先回 idle,随后由 completed task notification 唤醒。"
  218. },
  219. "maxMatches": 1,
  220. "match": {
  221. "method": "POST",
  222. "pathIncludes": "/messages",
  223. "bodyIncludes": [
  224. "E2E_SAT32_RESUME",
  225. "toolu_e2e_sat32_send_message",
  226. "resumed it in the background"
  227. ],
  228. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  229. "lastUserMessageExcludes": ["<task-notification>"]
  230. },
  231. "response": {
  232. "statusCode": 200,
  233. "text": {
  234. "id": "upstream-e2e-sat32-parent-resume-ack",
  235. "text": "E2E_SAT32_RESUME_ACK",
  236. "inputTokens": 64,
  237. "outputTokens": 8
  238. }
  239. }
  240. },
  241. {
  242. "id": "subagent-cold-failed-resume-parent-notification",
  243. "description": "恢复的 child 完成通知回到父模型。",
  244. "metadata": {
  245. "kind": "main",
  246. "source": "synthetic",
  247. "timingPolicy": "task-notification",
  248. "syntheticReason": "证明续接的运行完成后通知经 runtime command queue 回到父模型并正常收口。"
  249. },
  250. "maxMatches": 1,
  251. "match": {
  252. "method": "POST",
  253. "pathIncludes": "/messages",
  254. "lastUserMessageIncludes": ["<task-notification>", "<status>completed</status>"],
  255. "bodyIncludes": ["E2E_SAT32_RESUME", "E2E_SAT32_CHILD_DONE"],
  256. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  257. },
  258. "response": {
  259. "statusCode": 200,
  260. "text": {
  261. "id": "upstream-e2e-sat32-parent-notification",
  262. "text": "E2E_SAT32_NOTIFICATION_DONE",
  263. "inputTokens": 64,
  264. "outputTokens": 8
  265. }
  266. }
  267. }
  268. ]
  269. }