conversation-session-r3-subagent.json 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-r3-subagent",
  4. "spec": "./test/e2e/conversation-session/conversation-session-r3-subagent.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "r3-sub-title",
  8. "description": "标题",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题不属于断言"
  14. },
  15. "maxMatches": 8,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["Generate a concise title", "E2E_R3_SUBAGENT"]
  20. },
  21. "response": {
  22. "statusCode": 200,
  23. "text": {
  24. "id": "r3-stale-title",
  25. "inputTokens": 64,
  26. "outputTokens": 8,
  27. "text": "{\"title\":\"R3 subagent\"}"
  28. }
  29. }
  30. },
  31. {
  32. "id": "r3-workflow-skill",
  33. "description": "远端工作流及辅助对话会话归属回归",
  34. "metadata": {
  35. "kind": "main",
  36. "timingPolicy": "fast-tool-use",
  37. "source": "synthetic",
  38. "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
  39. },
  40. "maxMatches": 3,
  41. "match": {
  42. "method": "POST",
  43. "pathIncludes": "/messages",
  44. "bodyExcludes": [
  45. "Generate a concise title",
  46. "CRITICAL: Respond with TEXT ONLY",
  47. "You are now acting as the memory extraction subagent"
  48. ],
  49. "lastUserMessageIncludes": ["E2E_R3_WORKFLOW_START"]
  50. },
  51. "response": {
  52. "statusCode": 200,
  53. "toolUse": {
  54. "id": "toolu_r3_workflow_skill",
  55. "name": "Skill",
  56. "input": {
  57. "skill": "dynamic-workflows"
  58. }
  59. }
  60. }
  61. },
  62. {
  63. "id": "r3-workflow-create",
  64. "description": "远端工作流及辅助对话会话归属回归",
  65. "metadata": {
  66. "kind": "main",
  67. "timingPolicy": "fast-tool-use",
  68. "source": "synthetic",
  69. "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
  70. },
  71. "maxMatches": 3,
  72. "match": {
  73. "method": "POST",
  74. "pathIncludes": "/messages",
  75. "bodyExcludes": [
  76. "Generate a concise title",
  77. "CRITICAL: Respond with TEXT ONLY",
  78. "You are now acting as the memory extraction subagent"
  79. ],
  80. "lastUserMessageIncludes": ["Writing dynamic workflows"],
  81. "bodyIncludes": ["E2E_R3_WORKFLOW_START"]
  82. },
  83. "response": {
  84. "statusCode": 200,
  85. "toolUse": {
  86. "id": "toolu_r3_workflow_create",
  87. "name": "CreateWorkflow",
  88. "input": {
  89. "name": "Remote workflow regression",
  90. "script": "return await agent(\"remote-reviewer\").ask(\"E2E_R3_WORKFLOW_CHILD: Reply exactly R3_WORKFLOW_CHILD_DONE\");",
  91. "subagent_model": "e2e-workflow-actors/GLM-5.3"
  92. }
  93. }
  94. }
  95. },
  96. {
  97. "id": "r3-workflow-started",
  98. "description": "远端工作流及辅助对话会话归属回归",
  99. "metadata": {
  100. "kind": "main",
  101. "timingPolicy": "fast-text",
  102. "source": "synthetic",
  103. "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
  104. },
  105. "maxMatches": 3,
  106. "match": {
  107. "method": "POST",
  108. "pathIncludes": "/messages",
  109. "bodyExcludes": [
  110. "Generate a concise title",
  111. "CRITICAL: Respond with TEXT ONLY",
  112. "You are now acting as the memory extraction subagent"
  113. ],
  114. "lastUserMessageIncludes": ["run started in the background with ID:"],
  115. "bodyIncludes": ["E2E_R3_WORKFLOW_START"]
  116. },
  117. "response": {
  118. "statusCode": 200,
  119. "text": {
  120. "id": "r3-workflow-started",
  121. "text": "R3_WORKFLOW_STARTED"
  122. }
  123. }
  124. },
  125. {
  126. "id": "r3-workflow-child",
  127. "description": "远端工作流及辅助对话会话归属回归",
  128. "metadata": {
  129. "kind": "main",
  130. "timingPolicy": "fast-text",
  131. "source": "synthetic",
  132. "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
  133. },
  134. "maxMatches": 3,
  135. "match": {
  136. "method": "POST",
  137. "pathIncludes": "/messages",
  138. "bodyExcludes": [
  139. "Generate a concise title",
  140. "CRITICAL: Respond with TEXT ONLY",
  141. "You are now acting as the memory extraction subagent"
  142. ],
  143. "lastUserMessageIncludes": ["E2E_R3_WORKFLOW_CHILD"]
  144. },
  145. "response": {
  146. "statusCode": 200,
  147. "text": {
  148. "id": "r3-workflow-child",
  149. "text": "R3_WORKFLOW_CHILD_DONE"
  150. }
  151. }
  152. },
  153. {
  154. "id": "r3-workflow-notification",
  155. "description": "远端工作流及辅助对话会话归属回归",
  156. "metadata": {
  157. "kind": "main",
  158. "timingPolicy": "fast-text",
  159. "source": "synthetic",
  160. "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
  161. },
  162. "maxMatches": 3,
  163. "match": {
  164. "method": "POST",
  165. "pathIncludes": "/messages",
  166. "bodyExcludes": [
  167. "Generate a concise title",
  168. "CRITICAL: Respond with TEXT ONLY",
  169. "You are now acting as the memory extraction subagent"
  170. ],
  171. "lastUserMessageIncludes": ["workflow"],
  172. "bodyIncludes": ["E2E_R3_WORKFLOW_START", "R3_WORKFLOW_STARTED"]
  173. },
  174. "response": {
  175. "statusCode": 200,
  176. "text": {
  177. "id": "r3-workflow-notification",
  178. "text": "R3_WORKFLOW_COMPLETED"
  179. }
  180. }
  181. },
  182. {
  183. "id": "r3-side-chat",
  184. "description": "远端工作流及辅助对话会话归属回归",
  185. "metadata": {
  186. "kind": "main",
  187. "timingPolicy": "fast-text",
  188. "source": "synthetic",
  189. "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
  190. },
  191. "maxMatches": 3,
  192. "match": {
  193. "method": "POST",
  194. "pathIncludes": "/messages",
  195. "bodyExcludes": [
  196. "Generate a concise title",
  197. "CRITICAL: Respond with TEXT ONLY",
  198. "You are now acting as the memory extraction subagent"
  199. ],
  200. "lastUserMessageIncludes": ["E2E_R3_SIDE_CHAT"]
  201. },
  202. "response": {
  203. "statusCode": 200,
  204. "text": {
  205. "id": "r3-side-chat",
  206. "text": "R3_SIDE_CHAT_DONE"
  207. }
  208. }
  209. },
  210. {
  211. "id": "r3-side-followup",
  212. "description": "远端工作流及辅助对话会话归属回归",
  213. "metadata": {
  214. "kind": "main",
  215. "timingPolicy": "fast-text",
  216. "source": "synthetic",
  217. "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
  218. },
  219. "maxMatches": 3,
  220. "match": {
  221. "method": "POST",
  222. "pathIncludes": "/messages",
  223. "bodyExcludes": [
  224. "Generate a concise title",
  225. "CRITICAL: Respond with TEXT ONLY",
  226. "You are now acting as the memory extraction subagent"
  227. ],
  228. "lastUserMessageIncludes": ["E2E_R3_SIDE_FOLLOWUP"]
  229. },
  230. "response": {
  231. "statusCode": 200,
  232. "text": {
  233. "id": "r3-side-followup",
  234. "text": "R3_SIDE_FOLLOWUP_DONE"
  235. }
  236. }
  237. },
  238. {
  239. "id": "r3-sub-parent-agent",
  240. "description": "BG25: main launches a long-running background Agent.",
  241. "metadata": {
  242. "kind": "main",
  243. "timingPolicy": "fast-tool-use",
  244. "source": "synthetic",
  245. "syntheticReason": "稳定启动 background child,并用文件 barrier 保持 running 窗口。"
  246. },
  247. "maxMatches": 1,
  248. "match": {
  249. "method": "POST",
  250. "pathIncludes": "/messages",
  251. "bodyIncludes": ["E2E_R3_SUBAGENT_PARENT"],
  252. "bodyExcludes": [
  253. "Async agent launched successfully",
  254. "E2E_R3_SUBAGENT_PARENT2",
  255. "Generate a concise title",
  256. "CRITICAL: Respond with TEXT ONLY",
  257. "Verify whether the active session goal"
  258. ],
  259. "lastUserMessageIncludes": ["E2E_R3_SUBAGENT_PARENT"]
  260. },
  261. "response": {
  262. "statusCode": 200,
  263. "toolUse": {
  264. "id": "toolu_r3_sub_agent",
  265. "name": "Agent",
  266. "input": {
  267. "description": "R3 remote subagent child",
  268. "prompt": "R3_SUBAGENT_CHILD_TASK: Run the Bash tool to wait for the release file, then reply R3_SUBAGENT_CHILD_DONE.",
  269. "run_in_background": true
  270. }
  271. }
  272. }
  273. },
  274. {
  275. "id": "r3-sub-parent-launched",
  276. "description": "O19: parent finishes the background Agent launch turn.",
  277. "metadata": {
  278. "kind": "main",
  279. "timingPolicy": "fast-text",
  280. "source": "synthetic",
  281. "syntheticReason": "先让 parent 启动 turn 回到 idle,再释放 child 输入错误,避免 completion notification 合流竞态。"
  282. },
  283. "maxMatches": 1,
  284. "match": {
  285. "method": "POST",
  286. "pathIncludes": "/messages",
  287. "bodyIncludes": ["E2E_R3_SUBAGENT_PARENT", "Async agent launched successfully"],
  288. "lastUserMessageIncludes": ["Async agent launched successfully"],
  289. "bodyExcludes": [
  290. "Generate a concise title",
  291. "CRITICAL: Respond with TEXT ONLY",
  292. "Verify whether the active session goal"
  293. ]
  294. },
  295. "response": {
  296. "statusCode": 200,
  297. "text": {
  298. "id": "r3-sub-parent-launched",
  299. "text": "R3_SUBAGENT_PARENT_LAUNCHED"
  300. }
  301. }
  302. },
  303. {
  304. "id": "r3-sub-child-bash",
  305. "description": "BG25: child starts a foreground Bash barrier before coordinator steer arrives.",
  306. "metadata": {
  307. "kind": "main",
  308. "timingPolicy": "controlled-tool-use",
  309. "source": "synthetic",
  310. "syntheticReason": "文件 barrier 稳定制造第一个 child tool call 尚未完成的 steer 窗口。"
  311. },
  312. "maxMatches": 1,
  313. "match": {
  314. "method": "POST",
  315. "pathIncludes": "/messages",
  316. "bodyIncludes": ["R3_SUBAGENT_CHILD_TASK"],
  317. "bodyExcludes": [
  318. "R3_SUBAGENT_CHILD_BASH_RELEASED",
  319. "Generate a concise title",
  320. "CRITICAL: Respond with TEXT ONLY",
  321. "Verify whether the active session goal"
  322. ],
  323. "lastUserMessageIncludes": ["R3_SUBAGENT_CHILD_TASK"]
  324. },
  325. "response": {
  326. "statusCode": 200,
  327. "toolUse": {
  328. "id": "toolu_r3_sub_child_bash",
  329. "name": "Bash",
  330. "input": {
  331. "command": "while [ ! -f '.zcode-e2e/r3-subagent/release-child' ]; do sleep 0.2; done; printf 'R3_SUBAGENT_CHILD_BASH_RELEASED\\n'",
  332. "description": "Wait for remote release file"
  333. }
  334. }
  335. }
  336. },
  337. {
  338. "id": "r3-sub-child-final",
  339. "description": "BG25: child finishes normally after continued work.",
  340. "metadata": {
  341. "kind": "main",
  342. "timingPolicy": "fast-text",
  343. "source": "synthetic",
  344. "syntheticReason": "证明 child 回复后继续普通工具,并最终通过正常 completion 收口。"
  345. },
  346. "maxMatches": 1,
  347. "match": {
  348. "method": "POST",
  349. "pathIncludes": "/messages",
  350. "bodyIncludes": ["R3_SUBAGENT_CHILD_BASH_RELEASED"],
  351. "bodyExcludes": [
  352. "Generate a concise title",
  353. "CRITICAL: Respond with TEXT ONLY",
  354. "Verify whether the active session goal"
  355. ]
  356. },
  357. "response": {
  358. "statusCode": 200,
  359. "text": {
  360. "id": "r3-sub-child-final",
  361. "text": "R3_SUBAGENT_CHILD_DONE"
  362. }
  363. }
  364. },
  365. {
  366. "id": "r3-sub-notification",
  367. "description": "BG25: parent consumes the child final completion notification.",
  368. "metadata": {
  369. "kind": "main",
  370. "timingPolicy": "task-notification",
  371. "source": "synthetic",
  372. "syntheticReason": "证明 child 最终仍通过标准 background completion notification 收口。"
  373. },
  374. "maxMatches": 4,
  375. "match": {
  376. "method": "POST",
  377. "pathIncludes": "/messages",
  378. "bodyIncludes": ["<task-notification>"],
  379. "bodyExcludes": [
  380. "Generate a concise title",
  381. "CRITICAL: Respond with TEXT ONLY",
  382. "Verify whether the active session goal"
  383. ],
  384. "lastUserMessageIncludes": ["<task-notification>"]
  385. },
  386. "response": {
  387. "statusCode": 200,
  388. "text": {
  389. "id": "r3-sub-notification",
  390. "text": "R3_SUBAGENT_NOTIFICATION_CONSUMED"
  391. }
  392. }
  393. },
  394. {
  395. "id": "r3-sub-memory-noop",
  396. "description": "BG25/O18: background Main memory extraction remains non-semantic for this renderer case.",
  397. "metadata": {
  398. "kind": "main",
  399. "timingPolicy": "fast-text",
  400. "source": "synthetic",
  401. "syntheticReason": "Memory extraction 默认在成功 Main turn 后异步运行;本 case 仅用 Nothing to save 收口,避免隐藏请求干扰严格 replay,不扩展 Memory 产品语义。"
  402. },
  403. "maxMatches": 8,
  404. "match": {
  405. "method": "POST",
  406. "pathIncludes": "/messages",
  407. "bodyIncludes": ["You are now acting as the memory extraction subagent"]
  408. },
  409. "response": {
  410. "statusCode": 200,
  411. "text": {
  412. "id": "deepseek-e2e-subagent-response-memory-extraction-noop",
  413. "text": "Nothing to save."
  414. }
  415. }
  416. },
  417. {
  418. "id": "r3-sub-parent2-slow",
  419. "description": "Model A 慢回合",
  420. "metadata": {
  421. "kind": "main",
  422. "timingPolicy": "controlled-stream",
  423. "source": "synthetic",
  424. "syntheticReason": "在明确点击父会话 Stop 前保持运行窗口,停止需真实取消流,不能依赖45秒自然完成。"
  425. },
  426. "maxMatches": 2,
  427. "match": {
  428. "method": "POST",
  429. "pathIncludes": "/messages",
  430. "lastUserMessageIncludes": ["E2E_R3_SUBAGENT_PARENT2"],
  431. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  432. },
  433. "response": {
  434. "statusCode": 200,
  435. "statusMessage": "OK",
  436. "headers": {
  437. "cache-control": "no-cache",
  438. "content-type": "text/event-stream; charset=utf-8"
  439. },
  440. "chunks": [
  441. {
  442. "offsetMs": 0,
  443. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"r3-stale-slow\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":80,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  444. },
  445. {
  446. "offsetMs": 250,
  447. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  448. },
  449. {
  450. "offsetMs": 500,
  451. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"R3_SUBAGENT_PARENT2_STREAMING \"}}\n\n"
  452. },
  453. {
  454. "offsetMs": 45000,
  455. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  456. },
  457. {
  458. "offsetMs": 45100,
  459. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":80,\"output_tokens\":4,\"service_tier\":\"standard\"}}\n\n"
  460. },
  461. {
  462. "offsetMs": 45200,
  463. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  464. }
  465. ],
  466. "text": {
  467. "id": "v4-queue-slow",
  468. "inputTokens": 80,
  469. "outputTokens": 4,
  470. "text": "V4_QUEUE_STREAMING"
  471. },
  472. "releaseAfterChunks": 3
  473. }
  474. },
  475. {
  476. "id": "r3-sub-main",
  477. "description": "其它",
  478. "metadata": {
  479. "kind": "main",
  480. "timingPolicy": "fast-text",
  481. "source": "synthetic",
  482. "syntheticReason": "首发/fork/edit"
  483. },
  484. "maxMatches": 12,
  485. "match": {
  486. "method": "POST",
  487. "pathIncludes": "/messages",
  488. "bodyIncludes": ["E2E_R3_SUBAGENT_A_FIRST_PROMPT"],
  489. "bodyExcludes": [
  490. "E2E_R3_SUBAGENT_PARENT",
  491. "Generate a concise title",
  492. "CRITICAL: Respond with TEXT ONLY",
  493. "Verify whether the active session goal"
  494. ],
  495. "lastUserMessageIncludes": ["E2E_R3_SUBAGENT_A_FIRST_PROMPT"]
  496. },
  497. "response": {
  498. "statusCode": 200,
  499. "text": {
  500. "id": "r3-stale-main",
  501. "inputTokens": 64,
  502. "outputTokens": 8,
  503. "text": "R3_SUBAGENT_REPLY"
  504. }
  505. }
  506. }
  507. ]
  508. }