conversation-session-running-send-now.json 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-running-send-now",
  4. "spec": "./test/e2e/conversation-session/queue/conversation-session-running-send-now.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-running-send-now-head-base",
  8. "description": "M07a 队首 send-now 的基础 running 窗口。",
  9. "metadata": {
  10. "kind": "main",
  11. "timingPolicy": "controlled-stream",
  12. "source": "synthetic",
  13. "syntheticReason": "固定当前轮的 text-only assistant 输出并保持运行,验证抢占后 human reminder 的 MCS 位置降级。"
  14. },
  15. "maxMatches": 2,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["E2E_HOLD_STREAM", "E2E_RUNNING_SEND_NOW_HEAD_BASE"],
  20. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  21. "lastUserMessageIncludes": ["E2E_RUNNING_SEND_NOW_HEAD_BASE"]
  22. },
  23. "response": {
  24. "statusCode": 200,
  25. "headers": {
  26. "content-type": "text/event-stream; charset=utf-8"
  27. },
  28. "events": [
  29. {
  30. "sequence": 0,
  31. "offsetMs": 0,
  32. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"send-now-head-partial\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":120,\"output_tokens\":0}}}\n\n"
  33. },
  34. {
  35. "sequence": 1,
  36. "offsetMs": 0,
  37. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  38. },
  39. {
  40. "sequence": 2,
  41. "offsetMs": 0,
  42. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"send-now-head-partial\"}}\n\n"
  43. },
  44. {
  45. "sequence": 3,
  46. "offsetMs": 60000,
  47. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  48. },
  49. {
  50. "sequence": 4,
  51. "offsetMs": 60000,
  52. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"output_tokens\":8}}\n\n"
  53. },
  54. {
  55. "sequence": 5,
  56. "offsetMs": 60000,
  57. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  58. }
  59. ]
  60. }
  61. },
  62. {
  63. "id": "upstream-running-send-now-head-selected",
  64. "description": "M07a 被点队首项提升后的慢响应。",
  65. "metadata": {
  66. "kind": "main",
  67. "timingPolicy": "controlled-stream",
  68. "source": "synthetic",
  69. "syntheticReason": "保持下一轮 streaming,便于同时断言 user 投影、queue 清空与请求次数。"
  70. },
  71. "maxMatches": 2,
  72. "match": {
  73. "method": "POST",
  74. "pathIncludes": "/messages",
  75. "bodyIncludes": ["E2E_RUNNING_SEND_NOW_HEAD"],
  76. "bodyExcludes": [
  77. "Generate a concise title",
  78. "CRITICAL: Respond with TEXT ONLY",
  79. "The user sent a new message while you were working:"
  80. ],
  81. "lastUserMessageIncludes": ["E2E_RUNNING_SEND_NOW_HEAD"],
  82. "lastUserMessageExcludes": ["E2E_RUNNING_SEND_NOW_HEAD_BASE"]
  83. },
  84. "response": {
  85. "statusCode": 200,
  86. "delayMs": 60000,
  87. "text": {
  88. "id": "upstream-e2e-running-send-now-head-selected",
  89. "inputTokens": 140,
  90. "outputTokens": 12,
  91. "text": "upstream-e2e-ok"
  92. }
  93. }
  94. },
  95. {
  96. "id": "upstream-running-send-now-promote-base",
  97. "description": "M07b 非队首提升的基础 running 窗口。",
  98. "metadata": {
  99. "kind": "main",
  100. "timingPolicy": "controlled-stream",
  101. "source": "synthetic",
  102. "syntheticReason": "稳定保留两条 typed queue,避免首轮提前完成并自动 drain。"
  103. },
  104. "maxMatches": 1,
  105. "match": {
  106. "method": "POST",
  107. "pathIncludes": "/messages",
  108. "bodyIncludes": ["E2E_HOLD_STREAM", "E2E_RUNNING_SEND_NOW_PROMOTE_BASE"],
  109. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  110. "lastUserMessageIncludes": ["E2E_RUNNING_SEND_NOW_PROMOTE_BASE"]
  111. },
  112. "response": {
  113. "statusCode": 200,
  114. "delayMs": 60000,
  115. "text": {
  116. "id": "upstream-e2e-running-send-now-promote-base",
  117. "inputTokens": 120,
  118. "outputTokens": 12,
  119. "text": "upstream-e2e-ok"
  120. }
  121. }
  122. },
  123. {
  124. "id": "upstream-running-send-now-promote-first-not-selected",
  125. "description": "M07b 未点队首项不得产生 provider 请求。",
  126. "metadata": {
  127. "kind": "main",
  128. "timingPolicy": "fast-text",
  129. "source": "synthetic",
  130. "syntheticReason": "maxMatches=0 把未点项保持在 queue 的负向合同纳入 replay ledger。"
  131. },
  132. "maxMatches": 0,
  133. "match": {
  134. "method": "POST",
  135. "pathIncludes": "/messages",
  136. "bodyIncludes": ["E2E_RUNNING_SEND_NOW_PROMOTE_FIRST"],
  137. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  138. },
  139. "response": {
  140. "statusCode": 200,
  141. "text": {
  142. "id": "upstream-e2e-running-send-now-promote-first-should-not-send",
  143. "inputTokens": 120,
  144. "outputTokens": 12,
  145. "text": "upstream-e2e-ok"
  146. }
  147. }
  148. },
  149. {
  150. "id": "upstream-running-send-now-promote-second-selected",
  151. "description": "M07b 被点非队首项提升后的慢响应。",
  152. "metadata": {
  153. "kind": "main",
  154. "timingPolicy": "controlled-stream",
  155. "source": "synthetic",
  156. "syntheticReason": "稳定验证被点项成为 active,未点项仍保留。"
  157. },
  158. "maxMatches": 1,
  159. "match": {
  160. "method": "POST",
  161. "pathIncludes": "/messages",
  162. "bodyIncludes": ["E2E_SLOW_STREAM", "E2E_RUNNING_SEND_NOW_PROMOTE_SECOND"],
  163. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  164. "lastUserMessageIncludes": ["E2E_RUNNING_SEND_NOW_PROMOTE_SECOND"]
  165. },
  166. "response": {
  167. "statusCode": 200,
  168. "delayMs": 60000,
  169. "text": {
  170. "id": "upstream-e2e-running-send-now-promote-second-selected",
  171. "inputTokens": 140,
  172. "outputTokens": 12,
  173. "text": "upstream-e2e-ok"
  174. }
  175. }
  176. },
  177. {
  178. "id": "upstream-running-send-now-goal-base",
  179. "description": "M07c queued goal send-now 的基础 running 窗口。",
  180. "metadata": {
  181. "kind": "main",
  182. "timingPolicy": "controlled-stream",
  183. "source": "synthetic",
  184. "syntheticReason": "确保 /goal 先形成 typed queue,再由用户显式提升。"
  185. },
  186. "maxMatches": 1,
  187. "match": {
  188. "method": "POST",
  189. "pathIncludes": "/messages",
  190. "bodyIncludes": ["E2E_HOLD_STREAM", "E2E_RUNNING_SEND_NOW_GOAL_BASE"],
  191. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  192. "lastUserMessageIncludes": ["E2E_RUNNING_SEND_NOW_GOAL_BASE"]
  193. },
  194. "response": {
  195. "statusCode": 200,
  196. "delayMs": 60000,
  197. "text": {
  198. "id": "upstream-e2e-running-send-now-goal-base",
  199. "inputTokens": 120,
  200. "outputTokens": 12,
  201. "text": "upstream-e2e-ok"
  202. }
  203. }
  204. },
  205. {
  206. "id": "upstream-running-send-now-goal-continuation",
  207. "description": "M07c goal item 提升后启动的目标 continuation。",
  208. "metadata": {
  209. "kind": "main",
  210. "timingPolicy": "controlled-stream",
  211. "source": "synthetic",
  212. "syntheticReason": "保持 active target + streaming 窗口,直接验证 intent 未退化成普通 text。"
  213. },
  214. "maxMatches": 1,
  215. "match": {
  216. "method": "POST",
  217. "pathIncludes": "/messages",
  218. "bodyIncludes": ["Continue working toward the active session goal"],
  219. "bodyExcludes": [
  220. "Generate a concise title",
  221. "CRITICAL: Respond with TEXT ONLY",
  222. "Verify whether the active session goal"
  223. ]
  224. },
  225. "response": {
  226. "statusCode": 200,
  227. "delayMs": 60000,
  228. "text": {
  229. "id": "upstream-e2e-running-send-now-goal-continuation",
  230. "inputTokens": 160,
  231. "outputTokens": 12,
  232. "text": "upstream-e2e-ok"
  233. }
  234. }
  235. },
  236. {
  237. "id": "upstream-running-send-now-double-base",
  238. "description": "M07g 双击幂等的基础 running 窗口。",
  239. "metadata": {
  240. "kind": "main",
  241. "timingPolicy": "controlled-stream",
  242. "source": "synthetic",
  243. "syntheticReason": "让两个 click 在同一 active turn 和同一 React 刷新边界内发生。"
  244. },
  245. "maxMatches": 1,
  246. "match": {
  247. "method": "POST",
  248. "pathIncludes": "/messages",
  249. "bodyIncludes": ["E2E_HOLD_STREAM", "E2E_RUNNING_SEND_NOW_DOUBLE_BASE"],
  250. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  251. "lastUserMessageIncludes": ["E2E_RUNNING_SEND_NOW_DOUBLE_BASE"]
  252. },
  253. "response": {
  254. "statusCode": 200,
  255. "delayMs": 60000,
  256. "text": {
  257. "id": "upstream-e2e-running-send-now-double-base",
  258. "inputTokens": 120,
  259. "outputTokens": 12,
  260. "text": "upstream-e2e-ok"
  261. }
  262. }
  263. },
  264. {
  265. "id": "upstream-running-send-now-double-first-not-selected",
  266. "description": "M07g 双击期间未点队首项不得被误消费。",
  267. "metadata": {
  268. "kind": "main",
  269. "timingPolicy": "fast-text",
  270. "source": "synthetic",
  271. "syntheticReason": "maxMatches=0 证明第二条 command 不会触发普通 drain 消费 sibling queue item。"
  272. },
  273. "maxMatches": 0,
  274. "match": {
  275. "method": "POST",
  276. "pathIncludes": "/messages",
  277. "bodyIncludes": ["E2E_RUNNING_SEND_NOW_DOUBLE_FIRST"],
  278. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  279. },
  280. "response": {
  281. "statusCode": 200,
  282. "text": {
  283. "id": "upstream-e2e-running-send-now-double-first-should-not-send",
  284. "inputTokens": 120,
  285. "outputTokens": 12,
  286. "text": "upstream-e2e-ok"
  287. }
  288. }
  289. },
  290. {
  291. "id": "upstream-running-send-now-double-second-selected-once",
  292. "description": "M07g 被点项只能提升并发送一次。",
  293. "metadata": {
  294. "kind": "main",
  295. "timingPolicy": "controlled-stream",
  296. "source": "synthetic",
  297. "syntheticReason": "maxMatches=1 将重复 provider 请求直接视为 replay 失败,并保留 streaming 断言窗口。"
  298. },
  299. "maxMatches": 1,
  300. "match": {
  301. "method": "POST",
  302. "pathIncludes": "/messages",
  303. "bodyIncludes": ["E2E_SLOW_STREAM", "E2E_RUNNING_SEND_NOW_DOUBLE_SECOND"],
  304. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  305. "lastUserMessageIncludes": ["E2E_RUNNING_SEND_NOW_DOUBLE_SECOND"]
  306. },
  307. "response": {
  308. "statusCode": 200,
  309. "delayMs": 60000,
  310. "text": {
  311. "id": "upstream-e2e-running-send-now-double-second-selected-once",
  312. "inputTokens": 140,
  313. "outputTokens": 12,
  314. "text": "upstream-e2e-ok"
  315. }
  316. }
  317. },
  318. {
  319. "id": "upstream-running-send-now-segment-read",
  320. "description": "M07m 当前轮先完成一次 Read,形成工作段。",
  321. "metadata": {
  322. "kind": "main",
  323. "timingPolicy": "fast-text",
  324. "source": "synthetic",
  325. "syntheticReason": "当前轮必须先有工具工作,才能观察立即发送后工作段归属哪一轮。"
  326. },
  327. "maxMatches": 1,
  328. "match": {
  329. "method": "POST",
  330. "pathIncludes": "/messages",
  331. "bodyIncludes": ["E2E_RUNNING_SEND_NOW_SEGMENT_BASE_"],
  332. "bodyExcludes": [
  333. "Generate a concise title",
  334. "CRITICAL: Respond with TEXT ONLY",
  335. "E2E_READONLY_TOOL_FILE_CONTENT",
  336. "E2E_RUNNING_SEND_NOW_SEGMENT_ITEM_"
  337. ]
  338. },
  339. "response": {
  340. "statusCode": 200,
  341. "toolUse": {
  342. "id": "toolu_running_send_now_segment_read",
  343. "messageId": "msg_running_send_now_segment_read",
  344. "name": "Read",
  345. "input": {
  346. "file_path": "{{e2eRuntimeRoot}}/shared/readonly-tool.txt"
  347. }
  348. }
  349. }
  350. },
  351. {
  352. "id": "upstream-running-send-now-segment-hold",
  353. "description": "M07m Read 结果后的下一次请求保持运行,等待用户点立即。",
  354. "metadata": {
  355. "kind": "main",
  356. "timingPolicy": "controlled-stream",
  357. "source": "synthetic",
  358. "syntheticReason": "固定 Read 结果后的 running 窗口,让普通 queue 项在同一轮内入队并被立即发送抢占。"
  359. },
  360. "maxMatches": 1,
  361. "match": {
  362. "method": "POST",
  363. "pathIncludes": "/messages",
  364. "bodyIncludes": ["E2E_RUNNING_SEND_NOW_SEGMENT_BASE_", "E2E_READONLY_TOOL_FILE_CONTENT"],
  365. "bodyExcludes": [
  366. "Generate a concise title",
  367. "CRITICAL: Respond with TEXT ONLY",
  368. "E2E_RUNNING_SEND_NOW_SEGMENT_ITEM_"
  369. ]
  370. },
  371. "response": {
  372. "statusCode": 200,
  373. "delayMs": 60000,
  374. "text": {
  375. "id": "upstream-e2e-running-send-now-segment-hold",
  376. "inputTokens": 120,
  377. "outputTokens": 8,
  378. "text": "send-now-segment-should-be-interrupted"
  379. }
  380. }
  381. },
  382. {
  383. "id": "upstream-running-send-now-segment-selected",
  384. "description": "M07m 被点的 queue 项带着原轮 Read 结果开始下一轮。",
  385. "metadata": {
  386. "kind": "main",
  387. "timingPolicy": "fast-text",
  388. "source": "synthetic",
  389. "syntheticReason": "只在请求同时带原轮 Read 结果和被点项时返回回复,证明抢占后才消费被点项。"
  390. },
  391. "maxMatches": 1,
  392. "match": {
  393. "method": "POST",
  394. "pathIncludes": "/messages",
  395. "bodyIncludes": [
  396. "E2E_RUNNING_SEND_NOW_SEGMENT_BASE_",
  397. "E2E_READONLY_TOOL_FILE_CONTENT",
  398. "E2E_RUNNING_SEND_NOW_SEGMENT_ITEM_"
  399. ],
  400. "bodyExcludes": [
  401. "Generate a concise title",
  402. "CRITICAL: Respond with TEXT ONLY",
  403. "send-now-segment-should-be-interrupted",
  404. "The user sent a new message while you were working:"
  405. ]
  406. },
  407. "response": {
  408. "statusCode": 200,
  409. "text": {
  410. "id": "upstream-e2e-running-send-now-segment-selected",
  411. "inputTokens": 160,
  412. "outputTokens": 8,
  413. "text": "send-now-segment-reply-ok"
  414. }
  415. }
  416. }
  417. ]
  418. }