conversation-session-subagent-runtime-refresh.json 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-subagent-runtime-refresh",
  4. "spec": "./test/e2e/conversation-session/conversation-session-subagent-runtime-refresh.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "shr-title",
  8. "description": "shr-title",
  9. "metadata": {
  10. "kind": "common",
  11. "source": "synthetic",
  12. "timingPolicy": "fast-text",
  13. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["Generate a concise title", "E2E_SHR_FAIL_PARENT"]
  20. },
  21. "response": {
  22. "statusCode": 200,
  23. "text": {
  24. "id": "shr-title",
  25. "inputTokens": 32,
  26. "text": "{\"title\":\"Subagent runtime refresh\"}"
  27. }
  28. }
  29. },
  30. {
  31. "id": "shr-fail-parent-tool",
  32. "description": "shr-fail-parent-tool",
  33. "metadata": {
  34. "kind": "main",
  35. "source": "synthetic",
  36. "timingPolicy": "fast-text",
  37. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  38. },
  39. "maxMatches": 1,
  40. "match": {
  41. "method": "POST",
  42. "pathIncludes": "/messages",
  43. "lastUserMessageIncludes": ["E2E_SHR_FAIL_PARENT"],
  44. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  45. },
  46. "response": {
  47. "statusCode": 200,
  48. "toolUse": {
  49. "id": "toolu_shr_fail",
  50. "name": "Agent",
  51. "inputTokens": 32,
  52. "input": {
  53. "description": "Runtime refresh fail",
  54. "prompt": "E2E_SHR_FAIL_CHILD",
  55. "subagent_type": "e2e-runtime-reviewer",
  56. "run_in_background": true
  57. }
  58. }
  59. }
  60. },
  61. {
  62. "id": "shr-fail-child",
  63. "description": "shr-fail-child",
  64. "metadata": {
  65. "kind": "subagent",
  66. "source": "synthetic",
  67. "timingPolicy": "fault-stream",
  68. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  69. },
  70. "maxMatches": 1,
  71. "match": {
  72. "method": "POST",
  73. "pathIncludes": "/messages",
  74. "lastUserMessageIncludes": ["E2E_SHR_FAIL_CHILD"],
  75. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  76. },
  77. "response": {
  78. "statusCode": 400,
  79. "delayMs": 2000,
  80. "headers": {
  81. "content-type": "application/json"
  82. },
  83. "body": "{\"type\": \"error\", \"error\": {\"type\": \"invalid_request_error\", \"message\": \"E2E_SHR_INVALID_MODEL_CONFIGURATION\"}}"
  84. }
  85. },
  86. {
  87. "id": "shr-fail-parent-final",
  88. "description": "shr-fail-parent-final",
  89. "metadata": {
  90. "kind": "main",
  91. "source": "synthetic",
  92. "timingPolicy": "fast-text",
  93. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  94. },
  95. "maxMatches": 1,
  96. "match": {
  97. "method": "POST",
  98. "pathIncludes": "/messages",
  99. "bodyIncludes": ["E2E_SHR_FAIL_PARENT", "agentId: agent_"],
  100. "bodyExcludes": [
  101. "Generate a concise title",
  102. "CRITICAL: Respond with TEXT ONLY",
  103. "E2E_SHR_RESUME_PARENT"
  104. ]
  105. },
  106. "response": {
  107. "statusCode": 200,
  108. "text": {
  109. "id": "shr-fail-parent-final",
  110. "inputTokens": 32,
  111. "text": "E2E_SHR_FAIL_PARENT_DONE"
  112. }
  113. }
  114. },
  115. {
  116. "id": "shr-stable-parent-tool",
  117. "description": "shr-stable-parent-tool",
  118. "metadata": {
  119. "kind": "main",
  120. "source": "synthetic",
  121. "timingPolicy": "controlled-stream",
  122. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  123. },
  124. "maxMatches": 1,
  125. "match": {
  126. "method": "POST",
  127. "pathIncludes": "/messages",
  128. "lastUserMessageIncludes": ["E2E_SHR_STABLE_PARENT"],
  129. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  130. },
  131. "response": {
  132. "statusCode": 200,
  133. "toolUse": {
  134. "id": "toolu_shr_stable",
  135. "name": "Agent",
  136. "inputTokens": 32,
  137. "input": {
  138. "description": "Runtime refresh stable",
  139. "prompt": "E2E_SHR_STABLE_CHILD",
  140. "subagent_type": "e2e-runtime-reviewer",
  141. "run_in_background": false
  142. }
  143. },
  144. "delayMs": 40000
  145. }
  146. },
  147. {
  148. "id": "shr-stable-child",
  149. "description": "shr-stable-child",
  150. "metadata": {
  151. "kind": "subagent",
  152. "source": "synthetic",
  153. "timingPolicy": "fast-text",
  154. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  155. },
  156. "maxMatches": 1,
  157. "match": {
  158. "method": "POST",
  159. "pathIncludes": "/messages",
  160. "lastUserMessageIncludes": ["E2E_SHR_STABLE_CHILD"],
  161. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  162. },
  163. "response": {
  164. "statusCode": 200,
  165. "text": {
  166. "id": "shr-stable-child",
  167. "inputTokens": 32,
  168. "text": "E2E_SHR_STABLE_CHILD_DONE"
  169. }
  170. }
  171. },
  172. {
  173. "id": "shr-stable-parent-final",
  174. "description": "shr-stable-parent-final",
  175. "metadata": {
  176. "kind": "main",
  177. "source": "synthetic",
  178. "timingPolicy": "fast-text",
  179. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  180. },
  181. "maxMatches": 1,
  182. "match": {
  183. "method": "POST",
  184. "pathIncludes": "/messages",
  185. "bodyIncludes": ["toolu_shr_stable", "E2E_SHR_STABLE_CHILD_DONE", "agentId: agent_"],
  186. "bodyExcludes": [
  187. "Generate a concise title",
  188. "CRITICAL: Respond with TEXT ONLY",
  189. "E2E_SHR_NEXT_PARENT"
  190. ]
  191. },
  192. "response": {
  193. "statusCode": 200,
  194. "text": {
  195. "id": "shr-stable-parent-final",
  196. "inputTokens": 32,
  197. "text": "E2E_SHR_STABLE_PARENT_DONE"
  198. }
  199. }
  200. },
  201. {
  202. "id": "shr-next-parent-tool",
  203. "description": "shr-next-parent-tool",
  204. "metadata": {
  205. "kind": "main",
  206. "source": "synthetic",
  207. "timingPolicy": "fast-text",
  208. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  209. },
  210. "maxMatches": 1,
  211. "match": {
  212. "method": "POST",
  213. "pathIncludes": "/messages",
  214. "lastUserMessageIncludes": ["E2E_SHR_NEXT_PARENT"],
  215. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  216. },
  217. "response": {
  218. "statusCode": 200,
  219. "toolUse": {
  220. "id": "toolu_shr_next",
  221. "name": "Agent",
  222. "inputTokens": 32,
  223. "input": {
  224. "description": "Runtime refresh next",
  225. "prompt": "E2E_SHR_NEXT_CHILD",
  226. "subagent_type": "e2e-runtime-reviewer",
  227. "run_in_background": false
  228. }
  229. }
  230. }
  231. },
  232. {
  233. "id": "shr-next-child",
  234. "description": "shr-next-child",
  235. "metadata": {
  236. "kind": "subagent",
  237. "source": "synthetic",
  238. "timingPolicy": "fast-text",
  239. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  240. },
  241. "maxMatches": 1,
  242. "match": {
  243. "method": "POST",
  244. "pathIncludes": "/messages",
  245. "lastUserMessageIncludes": ["E2E_SHR_NEXT_CHILD"],
  246. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  247. },
  248. "response": {
  249. "statusCode": 200,
  250. "text": {
  251. "id": "shr-next-child",
  252. "inputTokens": 32,
  253. "text": "E2E_SHR_NEXT_CHILD_DONE"
  254. }
  255. }
  256. },
  257. {
  258. "id": "shr-next-parent-final",
  259. "description": "shr-next-parent-final",
  260. "metadata": {
  261. "kind": "main",
  262. "source": "synthetic",
  263. "timingPolicy": "fast-text",
  264. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  265. },
  266. "maxMatches": 1,
  267. "match": {
  268. "method": "POST",
  269. "pathIncludes": "/messages",
  270. "bodyIncludes": ["toolu_shr_next", "E2E_SHR_NEXT_CHILD_DONE", "agentId: agent_"],
  271. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  272. },
  273. "response": {
  274. "statusCode": 200,
  275. "text": {
  276. "id": "shr-next-parent-final",
  277. "inputTokens": 32,
  278. "text": "E2E_SHR_NEXT_PARENT_DONE"
  279. }
  280. }
  281. },
  282. {
  283. "id": "shr-failure-notification",
  284. "description": "shr-failure-notification",
  285. "metadata": {
  286. "kind": "main",
  287. "source": "synthetic",
  288. "timingPolicy": "fast-text",
  289. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  290. },
  291. "maxMatches": 1,
  292. "match": {
  293. "method": "POST",
  294. "pathIncludes": "/messages",
  295. "lastUserMessageIncludes": ["<task-notification>", "<status>failed</status>"],
  296. "bodyIncludes": ["E2E_SHR_FAIL_PARENT"],
  297. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  298. },
  299. "response": {
  300. "statusCode": 200,
  301. "text": {
  302. "id": "shr-failure-notification",
  303. "inputTokens": 32,
  304. "text": "E2E_SHR_FAILURE_NOTED"
  305. }
  306. }
  307. },
  308. {
  309. "id": "shr-resume-parent-tool",
  310. "description": "shr-resume-parent-tool",
  311. "metadata": {
  312. "kind": "main",
  313. "source": "synthetic",
  314. "timingPolicy": "fast-text",
  315. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  316. },
  317. "maxMatches": 1,
  318. "match": {
  319. "method": "POST",
  320. "pathIncludes": "/messages",
  321. "lastUserMessageIncludes": ["E2E_SHR_RESUME_PARENT"],
  322. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  323. },
  324. "response": {
  325. "statusCode": 200,
  326. "toolUse": {
  327. "id": "toolu_shr_resume",
  328. "name": "SendMessage",
  329. "inputTokens": 32,
  330. "input": {
  331. "to": "{{latestAgentId}}",
  332. "summary": "Retry corrected profile",
  333. "message": "E2E_SHR_RESUME_CHILD"
  334. }
  335. }
  336. }
  337. },
  338. {
  339. "id": "shr-resume-child",
  340. "description": "shr-resume-child",
  341. "metadata": {
  342. "kind": "subagent",
  343. "source": "synthetic",
  344. "timingPolicy": "controlled-stream",
  345. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  346. },
  347. "maxMatches": 1,
  348. "match": {
  349. "method": "POST",
  350. "pathIncludes": "/messages",
  351. "lastUserMessageIncludes": ["E2E_SHR_RESUME_CHILD"],
  352. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  353. },
  354. "response": {
  355. "statusCode": 200,
  356. "text": {
  357. "id": "shr-resume-child",
  358. "inputTokens": 32,
  359. "text": "E2E_SHR_RESUME_CHILD_DONE"
  360. },
  361. "delayMs": 2000
  362. }
  363. },
  364. {
  365. "id": "shr-resume-parent-final",
  366. "description": "shr-resume-parent-final",
  367. "metadata": {
  368. "kind": "main",
  369. "source": "synthetic",
  370. "timingPolicy": "fast-text",
  371. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  372. },
  373. "maxMatches": 1,
  374. "match": {
  375. "method": "POST",
  376. "pathIncludes": "/messages",
  377. "bodyIncludes": ["E2E_SHR_RESUME_PARENT", "resumed it in the background"],
  378. "bodyExcludes": [
  379. "Generate a concise title",
  380. "CRITICAL: Respond with TEXT ONLY",
  381. "E2E_SHR_STABLE_PARENT"
  382. ]
  383. },
  384. "response": {
  385. "statusCode": 200,
  386. "text": {
  387. "id": "shr-resume-parent-final",
  388. "inputTokens": 32,
  389. "text": "E2E_SHR_RESUME_PARENT_DONE"
  390. }
  391. }
  392. },
  393. {
  394. "id": "shr-resume-notification",
  395. "description": "shr-resume-notification",
  396. "metadata": {
  397. "kind": "main",
  398. "source": "synthetic",
  399. "timingPolicy": "fast-text",
  400. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  401. },
  402. "maxMatches": 1,
  403. "match": {
  404. "method": "POST",
  405. "pathIncludes": "/messages",
  406. "lastUserMessageIncludes": ["<task-notification>", "<status>completed</status>"],
  407. "bodyIncludes": ["E2E_SHR_RESUME_PARENT"],
  408. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  409. },
  410. "response": {
  411. "statusCode": 200,
  412. "text": {
  413. "id": "shr-resume-notification",
  414. "inputTokens": 32,
  415. "text": "E2E_SHR_RESUME_NOTED"
  416. }
  417. }
  418. },
  419. {
  420. "id": "shr-compact",
  421. "description": "shr-compact",
  422. "metadata": {
  423. "kind": "common",
  424. "source": "synthetic",
  425. "timingPolicy": "fast-text",
  426. "syntheticReason": "固定工具调用和模型响应,以实际 provider 请求验证父上下文快照、Settings 保存及失败 child 恢复。"
  427. },
  428. "match": {
  429. "method": "POST",
  430. "pathIncludes": "/messages",
  431. "bodyIncludes": ["CRITICAL: Respond with TEXT ONLY", "E2E_SHR_FAIL_PARENT"]
  432. },
  433. "response": {
  434. "statusCode": 200,
  435. "text": {
  436. "id": "shr-compact",
  437. "inputTokens": 32,
  438. "text": "Preserve original failed child and recovery. agentId: {{latestAgentId}}. E2E_SHR_FAIL_PARENT E2E_SHR_RESUME_PARENT."
  439. }
  440. }
  441. }
  442. ]
  443. }