conversation-session-subagent-provider-retry-status.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-subagent-provider-retry-status",
  4. "spec": "./test/e2e/conversation-session/subagents/conversation-session-subagent-provider-retry-status.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "subagent-provider-retry-title",
  8. "description": "Subagent retry case 固定标题响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题生成不属于本 case,只需稳定返回。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_SUBAGENT_PROVIDER_RETRY_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-provider-retry-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Subagent Provider Retry\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":12,\"service_tier\":\"standard\"}}"
  27. }
  28. },
  29. {
  30. "id": "subagent-provider-retry-main-first-429",
  31. "description": "Main 首个请求延迟返回可重试 429。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fault-stream",
  35. "source": "synthetic",
  36. "syntheticReason": "首个 Main 请求返回可重试 429,验证主会话当前 turn 的 apiRetry 展示。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROVIDER_RETRY_PARENT"],
  43. "lastUserMessageExcludes": ["<task-notification>"],
  44. "bodyIncludes": [
  45. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT",
  46. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT_DONE"
  47. ],
  48. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  49. },
  50. "response": {
  51. "statusCode": 429,
  52. "statusMessage": "Too Many Requests",
  53. "delayMs": 1200,
  54. "headers": {
  55. "content-type": "application/json; charset=utf-8",
  56. "retry-after": "0"
  57. },
  58. "body": "{\"error\":{\"code\":\"AccountRateLimitExceeded\",\"message\":\"retry once for the E2E main session\",\"type\":\"TooManyRequests\"}}"
  59. }
  60. },
  61. {
  62. "id": "subagent-provider-retry-main-second-429",
  63. "description": "Main 第二次请求继续返回可重试 429,保持早期 retry 仍按 loading 展示。",
  64. "metadata": {
  65. "kind": "main",
  66. "timingPolicy": "fault-stream",
  67. "source": "synthetic",
  68. "syntheticReason": "第二次 Main retry 仍失败,确保 attempt=2 不显示计数。"
  69. },
  70. "maxMatches": 1,
  71. "match": {
  72. "method": "POST",
  73. "pathIncludes": "/messages",
  74. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROVIDER_RETRY_PARENT"],
  75. "lastUserMessageExcludes": ["<task-notification>"],
  76. "bodyIncludes": [
  77. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT",
  78. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT_DONE"
  79. ],
  80. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  81. },
  82. "response": {
  83. "statusCode": 429,
  84. "statusMessage": "Too Many Requests",
  85. "delayMs": 1200,
  86. "headers": {
  87. "content-type": "application/json; charset=utf-8",
  88. "retry-after": "0"
  89. },
  90. "body": "{\"error\":{\"code\":\"AccountRateLimitExceeded\",\"message\":\"retry twice for the E2E main session\",\"type\":\"TooManyRequests\"}}"
  91. }
  92. },
  93. {
  94. "id": "subagent-provider-retry-main-third-429",
  95. "description": "Main 第三次请求继续返回可重试 429,随后进入可见的 3/10 retry。",
  96. "metadata": {
  97. "kind": "main",
  98. "timingPolicy": "fault-stream",
  99. "source": "synthetic",
  100. "syntheticReason": "第三次 Main retry 仍失败,确保 attempt=3 达到 UI 显示阈值。"
  101. },
  102. "maxMatches": 1,
  103. "match": {
  104. "method": "POST",
  105. "pathIncludes": "/messages",
  106. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROVIDER_RETRY_PARENT"],
  107. "lastUserMessageExcludes": ["<task-notification>"],
  108. "bodyIncludes": [
  109. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT",
  110. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT_DONE"
  111. ],
  112. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  113. },
  114. "response": {
  115. "statusCode": 429,
  116. "statusMessage": "Too Many Requests",
  117. "delayMs": 1200,
  118. "headers": {
  119. "content-type": "application/json; charset=utf-8",
  120. "retry-after": "0"
  121. },
  122. "body": "{\"error\":{\"code\":\"AccountRateLimitExceeded\",\"message\":\"retry three times for the E2E main session\",\"type\":\"TooManyRequests\"}}"
  123. }
  124. },
  125. {
  126. "id": "subagent-provider-retry-parent-launch",
  127. "description": "Main 第三次 retry 后延迟成功并启动一个 background Agent。",
  128. "metadata": {
  129. "kind": "main",
  130. "timingPolicy": "delayed-tool-use",
  131. "source": "synthetic",
  132. "syntheticReason": "延迟 Main 第三次 retry 后的首个有效工具进展,为主会话 3/10 UI 留出稳定观察窗口,然后创建 background child。"
  133. },
  134. "maxMatches": 1,
  135. "match": {
  136. "method": "POST",
  137. "pathIncludes": "/messages",
  138. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROVIDER_RETRY_PARENT"],
  139. "bodyIncludes": [
  140. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT",
  141. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT_DONE"
  142. ],
  143. "bodyExcludes": ["Async agent launched successfully", "Generate a concise title"]
  144. },
  145. "response": {
  146. "statusCode": 200,
  147. "delayMs": 4000,
  148. "toolUse": {
  149. "id": "toolu_e2e_subagent_provider_retry_agent",
  150. "name": "Agent",
  151. "input": {
  152. "description": "Exercise child provider retry",
  153. "prompt": "E2E_SUBAGENT_PROVIDER_RETRY_CHILD: make one provider request and then finish normally.",
  154. "run_in_background": true,
  155. "subagent_type": "general-purpose"
  156. }
  157. }
  158. }
  159. },
  160. {
  161. "id": "subagent-provider-retry-parent-ack",
  162. "description": "父模型在 background Agent launch ACK 后结束当前轮。",
  163. "metadata": {
  164. "kind": "main",
  165. "timingPolicy": "fast-text",
  166. "source": "synthetic",
  167. "syntheticReason": "父轮先收口,child retry 继续由 child session 独立展示。"
  168. },
  169. "maxMatches": 1,
  170. "match": {
  171. "method": "POST",
  172. "pathIncludes": "/messages",
  173. "bodyIncludes": [
  174. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT",
  175. "Async agent launched successfully",
  176. "toolu_e2e_subagent_provider_retry_agent"
  177. ],
  178. "lastUserMessageExcludes": ["<task-notification>"]
  179. },
  180. "response": {
  181. "statusCode": 200,
  182. "text": {
  183. "id": "upstream-e2e-subagent-provider-retry-ack",
  184. "text": "subagent-provider-retry-launched"
  185. }
  186. }
  187. },
  188. {
  189. "id": "subagent-provider-retry-child-first-429",
  190. "description": "child 首个请求延迟返回可重试 429。",
  191. "metadata": {
  192. "kind": "subagent",
  193. "timingPolicy": "fault-stream",
  194. "source": "synthetic",
  195. "syntheticReason": "首个 child 请求返回可重试 429,产生 apiRetry 内存态。"
  196. },
  197. "maxMatches": 1,
  198. "match": {
  199. "method": "POST",
  200. "pathIncludes": "/messages",
  201. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROVIDER_RETRY_CHILD"]
  202. },
  203. "response": {
  204. "statusCode": 429,
  205. "statusMessage": "Too Many Requests",
  206. "delayMs": 1200,
  207. "headers": {
  208. "content-type": "application/json; charset=utf-8",
  209. "retry-after": "0"
  210. },
  211. "body": "{\"error\":{\"code\":\"AccountRateLimitExceeded\",\"message\":\"retry once for the E2E child\",\"type\":\"TooManyRequests\"}}"
  212. }
  213. },
  214. {
  215. "id": "subagent-provider-retry-child-success",
  216. "description": "child 第二次请求延迟返回正文成功。",
  217. "metadata": {
  218. "kind": "subagent",
  219. "timingPolicy": "delayed-text",
  220. "source": "synthetic",
  221. "syntheticReason": "第二次请求延迟成功,为 UI 留出观察 retry 的窗口,并用正文进展清除状态。"
  222. },
  223. "maxMatches": 1,
  224. "match": {
  225. "method": "POST",
  226. "pathIncludes": "/messages",
  227. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROVIDER_RETRY_CHILD"]
  228. },
  229. "response": {
  230. "statusCode": 200,
  231. "statusMessage": "OK",
  232. "delayMs": 4000,
  233. "text": {
  234. "id": "upstream-e2e-subagent-provider-retry-child-success",
  235. "text": "E2E_SUBAGENT_PROVIDER_RETRY_CHILD_DONE"
  236. }
  237. }
  238. },
  239. {
  240. "id": "subagent-provider-retry-parent-auto-compact",
  241. "description": "父会话消费 completed child notification 前的自动 compact sidecar。",
  242. "metadata": {
  243. "kind": "main",
  244. "timingPolicy": "fast-text",
  245. "source": "synthetic",
  246. "syntheticReason": "E2E 完整 system prompt 会在 child completion notification 前触发自动 compact;固定摘要并保留后续 notification matcher 所需事实。"
  247. },
  248. "maxMatches": 1,
  249. "match": {
  250. "method": "POST",
  251. "pathIncludes": "/messages",
  252. "bodyIncludes": [
  253. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT",
  254. "toolu_e2e_subagent_provider_retry_agent",
  255. "CRITICAL: Respond with TEXT ONLY",
  256. "\"stream\":true"
  257. ],
  258. "bodyExcludes": ["Generate a concise title"],
  259. "lastUserMessageExcludes": ["<task-notification>"]
  260. },
  261. "response": {
  262. "statusCode": 200,
  263. "text": {
  264. "id": "upstream-e2e-subagent-provider-retry-auto-compact",
  265. "inputTokens": 256,
  266. "outputTokens": 32,
  267. "text": "<summary>E2E_SUBAGENT_PROVIDER_RETRY_PARENT: background Agent toolu_e2e_subagent_provider_retry_agent was launched. Continue processing its completion notification and finish with E2E_SUBAGENT_PROVIDER_RETRY_PARENT_DONE.</summary>"
  268. }
  269. }
  270. },
  271. {
  272. "id": "subagent-provider-retry-parent-notification",
  273. "description": "父模型消费 completed background Agent notification。",
  274. "metadata": {
  275. "kind": "main",
  276. "timingPolicy": "task-notification",
  277. "source": "synthetic",
  278. "syntheticReason": "证明 child retry 成功后完成通知仍正常回到父会话。"
  279. },
  280. "maxMatches": 1,
  281. "match": {
  282. "method": "POST",
  283. "pathIncludes": "/messages",
  284. "lastUserMessageIncludes": ["<task-notification>", "<status>completed</status>"],
  285. "bodyIncludes": [
  286. "E2E_SUBAGENT_PROVIDER_RETRY_PARENT",
  287. "E2E_SUBAGENT_PROVIDER_RETRY_CHILD_DONE",
  288. "toolu_e2e_subagent_provider_retry_agent"
  289. ]
  290. },
  291. "response": {
  292. "statusCode": 200,
  293. "text": {
  294. "id": "upstream-e2e-subagent-provider-retry-parent-done",
  295. "text": "E2E_SUBAGENT_PROVIDER_RETRY_PARENT_DONE"
  296. }
  297. }
  298. }
  299. ]
  300. }