conversation-session-sse-stall-diagnostic.json 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-sse-stall-diagnostic",
  4. "spec": "./test/e2e/conversation-session/runtime/conversation-session-sse-stall-diagnostic.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "sse-stall-diagnostic-title",
  8. "description": "六类 SSE stall diagnostic 共用的固定标题响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题生成不是本 diagnostic 的验证目标,只需稳定收口。"
  14. },
  15. "maxMatches": 6,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["Generate a concise title", "E2E_SSE_STALL_"]
  20. },
  21. "response": {
  22. "statusCode": 200,
  23. "statusMessage": "OK",
  24. "headers": {
  25. "content-type": "application/json; charset=utf-8"
  26. },
  27. "body": "{\"id\":\"msg_e2e_sse_stall_title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"SSE Stall Diagnostic\\\"}\"}],\"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\"}}"
  28. }
  29. },
  30. {
  31. "id": "sse-stall-prelude-stalled",
  32. "description": "只发送 message_start,随后保持无 event 超过 E2E idle timeout。",
  33. "metadata": {
  34. "kind": "main",
  35. "timingPolicy": "fault-stream",
  36. "source": "synthetic",
  37. "syntheticReason": "在 retry-safe prelude 边界制造真实 SSE stall。"
  38. },
  39. "maxMatches": 1,
  40. "match": {
  41. "method": "POST",
  42. "pathIncludes": "/messages",
  43. "lastUserMessageIncludes": ["E2E_SSE_STALL_PRELUDE"],
  44. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  45. },
  46. "response": {
  47. "statusCode": 200,
  48. "statusMessage": "OK",
  49. "headers": {
  50. "cache-control": "no-cache",
  51. "content-type": "text/event-stream; charset=utf-8"
  52. },
  53. "events": [
  54. {
  55. "sequence": 0,
  56. "offsetMs": 0,
  57. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_sse_stall_prelude_partial\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  58. },
  59. {
  60. "sequence": 1,
  61. "offsetMs": 5000,
  62. "text": "event: ping\ndata: {\"type\":\"ping\"}\n\n"
  63. }
  64. ]
  65. }
  66. },
  67. {
  68. "id": "sse-stall-prelude-recovered",
  69. "description": "prelude stall 的第二次主请求立即成功。",
  70. "metadata": {
  71. "kind": "main",
  72. "timingPolicy": "fast-text",
  73. "source": "synthetic",
  74. "syntheticReason": "证明 retry-safe prelude 能通过真实第二次 provider request 收口。"
  75. },
  76. "maxMatches": 1,
  77. "match": {
  78. "method": "POST",
  79. "pathIncludes": "/messages",
  80. "lastUserMessageIncludes": ["E2E_SSE_STALL_PRELUDE"],
  81. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  82. },
  83. "response": {
  84. "statusCode": 200,
  85. "statusMessage": "OK",
  86. "text": {
  87. "id": "msg_e2e_sse_stall_prelude_recovered",
  88. "text": "E2E_SSE_STALL_PRELUDE_DONE"
  89. }
  90. }
  91. },
  92. {
  93. "id": "sse-stall-thinking-stalled",
  94. "description": "发送 thinking_delta 后保持无 event 超过 E2E idle timeout。",
  95. "metadata": {
  96. "kind": "main",
  97. "timingPolicy": "fault-stream",
  98. "source": "synthetic",
  99. "syntheticReason": "在 reasoning-only visible boundary 制造真实 SSE stall。"
  100. },
  101. "maxMatches": 1,
  102. "match": {
  103. "method": "POST",
  104. "pathIncludes": "/messages",
  105. "lastUserMessageIncludes": ["E2E_SSE_STALL_THINKING"],
  106. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  107. },
  108. "response": {
  109. "statusCode": 200,
  110. "statusMessage": "OK",
  111. "headers": {
  112. "cache-control": "no-cache",
  113. "content-type": "text/event-stream; charset=utf-8"
  114. },
  115. "events": [
  116. {
  117. "sequence": 0,
  118. "offsetMs": 0,
  119. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_sse_stall_thinking_partial\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  120. },
  121. {
  122. "sequence": 1,
  123. "offsetMs": 40,
  124. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"thinking\",\"thinking\":\"\",\"signature\":\"\"}}\n\n"
  125. },
  126. {
  127. "sequence": 2,
  128. "offsetMs": 80,
  129. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"thinking_delta\",\"thinking\":\"E2E_SSE_STALL_THINKING_PARTIAL\"}}\n\n"
  130. },
  131. {
  132. "sequence": 3,
  133. "offsetMs": 5000,
  134. "text": "event: ping\ndata: {\"type\":\"ping\"}\n\n"
  135. }
  136. ]
  137. }
  138. },
  139. {
  140. "id": "sse-stall-thinking-recovered",
  141. "description": "thinking stall 的恢复请求立即成功。",
  142. "metadata": {
  143. "kind": "main",
  144. "timingPolicy": "fast-text",
  145. "source": "synthetic",
  146. "syntheticReason": "验证 S02-R1 的真实 Desktop recovery 请求。"
  147. },
  148. "maxMatches": 1,
  149. "match": {
  150. "method": "POST",
  151. "pathIncludes": "/messages",
  152. "lastUserMessageIncludes": ["E2E_SSE_STALL_THINKING"],
  153. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  154. },
  155. "response": {
  156. "statusCode": 200,
  157. "statusMessage": "OK",
  158. "text": {
  159. "id": "msg_e2e_sse_stall_thinking_recovered",
  160. "text": "E2E_SSE_STALL_THINKING_DONE"
  161. }
  162. }
  163. },
  164. {
  165. "id": "sse-stall-text-stalled",
  166. "description": "发送 text_delta 后保持无 event 超过 E2E idle timeout。",
  167. "metadata": {
  168. "kind": "main",
  169. "timingPolicy": "fault-stream",
  170. "source": "synthetic",
  171. "syntheticReason": "在用户可见正文边界制造真实 SSE stall,采样 S03 当前行为。"
  172. },
  173. "maxMatches": 1,
  174. "match": {
  175. "method": "POST",
  176. "pathIncludes": "/messages",
  177. "lastUserMessageIncludes": ["E2E_SSE_STALL_TEXT"],
  178. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  179. },
  180. "response": {
  181. "statusCode": 200,
  182. "statusMessage": "OK",
  183. "headers": {
  184. "cache-control": "no-cache",
  185. "content-type": "text/event-stream; charset=utf-8"
  186. },
  187. "events": [
  188. {
  189. "sequence": 0,
  190. "offsetMs": 0,
  191. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_sse_stall_text_partial\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  192. },
  193. {
  194. "sequence": 1,
  195. "offsetMs": 40,
  196. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  197. },
  198. {
  199. "sequence": 2,
  200. "offsetMs": 80,
  201. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_SSE_STALL_TEXT_PARTIAL\"}}\n\n"
  202. },
  203. {
  204. "sequence": 3,
  205. "offsetMs": 5000,
  206. "text": "event: ping\ndata: {\"type\":\"ping\"}\n\n"
  207. }
  208. ]
  209. }
  210. },
  211. {
  212. "id": "sse-stall-text-recovered",
  213. "description": "若 text stall 触发恢复,第二次请求立即成功;若当前实现终止则该 fixture 不消费。",
  214. "metadata": {
  215. "kind": "main",
  216. "timingPolicy": "fast-text",
  217. "source": "synthetic",
  218. "syntheticReason": "允许 diagnostic 区分当前实现是恢复还是直接进入 terminal。"
  219. },
  220. "maxMatches": 1,
  221. "match": {
  222. "method": "POST",
  223. "pathIncludes": "/messages",
  224. "lastUserMessageIncludes": ["E2E_SSE_STALL_TEXT"],
  225. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  226. },
  227. "response": {
  228. "statusCode": 200,
  229. "statusMessage": "OK",
  230. "text": {
  231. "id": "msg_e2e_sse_stall_text_recovered",
  232. "text": "E2E_SSE_STALL_TEXT_DONE"
  233. }
  234. }
  235. },
  236. {
  237. "id": "sse-stall-tool-input-stalled",
  238. "description": "tool input_json_delta 仍是未闭合 JSON 时保持无 event。",
  239. "metadata": {
  240. "kind": "main",
  241. "timingPolicy": "fault-stream",
  242. "source": "synthetic",
  243. "syntheticReason": "验证未 commit 的工具输入不会在 stall/recovery 中被执行。"
  244. },
  245. "maxMatches": 1,
  246. "match": {
  247. "method": "POST",
  248. "pathIncludes": "/messages",
  249. "lastUserMessageIncludes": ["E2E_SSE_STALL_TOOL_INPUT"],
  250. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  251. },
  252. "response": {
  253. "statusCode": 200,
  254. "statusMessage": "OK",
  255. "headers": {
  256. "cache-control": "no-cache",
  257. "content-type": "text/event-stream; charset=utf-8"
  258. },
  259. "events": [
  260. {
  261. "sequence": 0,
  262. "offsetMs": 0,
  263. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_sse_stall_tool_input_partial\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  264. },
  265. {
  266. "sequence": 1,
  267. "offsetMs": 40,
  268. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_e2e_sse_stall_partial_read\",\"name\":\"Read\",\"input\":{}}}\n\n"
  269. },
  270. {
  271. "sequence": 2,
  272. "offsetMs": 80,
  273. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"file_path\\\":\\\"E2E_SSE_STALL_TOOL_INPUT_PARTIAL\"}}\n\n"
  274. },
  275. {
  276. "sequence": 3,
  277. "offsetMs": 5000,
  278. "text": "event: ping\ndata: {\"type\":\"ping\"}\n\n"
  279. }
  280. ]
  281. }
  282. },
  283. {
  284. "id": "sse-stall-tool-input-recovered",
  285. "description": "未闭合 tool input stall 的恢复请求立即成功。",
  286. "metadata": {
  287. "kind": "main",
  288. "timingPolicy": "fast-text",
  289. "source": "synthetic",
  290. "syntheticReason": "证明未提交工具不会阻止安全恢复。"
  291. },
  292. "maxMatches": 1,
  293. "match": {
  294. "method": "POST",
  295. "pathIncludes": "/messages",
  296. "lastUserMessageIncludes": ["E2E_SSE_STALL_TOOL_INPUT"],
  297. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  298. },
  299. "response": {
  300. "statusCode": 200,
  301. "statusMessage": "OK",
  302. "text": {
  303. "id": "msg_e2e_sse_stall_tool_input_recovered",
  304. "text": "E2E_SSE_STALL_TOOL_INPUT_DONE"
  305. }
  306. }
  307. },
  308. {
  309. "id": "sse-stall-tool-committed-stalled",
  310. "description": "完整 Read tool block 后不发送 message_delta/message_stop,并保持无 event。",
  311. "metadata": {
  312. "kind": "main",
  313. "timingPolicy": "fault-stream",
  314. "source": "synthetic",
  315. "syntheticReason": "在 tool content block 完整但 message 未 terminal 的边界制造 stall,诊断是否执行、恢复和重复。"
  316. },
  317. "maxMatches": 1,
  318. "match": {
  319. "method": "POST",
  320. "pathIncludes": "/messages",
  321. "lastUserMessageIncludes": ["E2E_SSE_STALL_TOOL_COMMITTED"],
  322. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  323. },
  324. "response": {
  325. "statusCode": 200,
  326. "statusMessage": "OK",
  327. "headers": {
  328. "cache-control": "no-cache",
  329. "content-type": "text/event-stream; charset=utf-8"
  330. },
  331. "events": [
  332. {
  333. "sequence": 0,
  334. "offsetMs": 0,
  335. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_sse_stall_tool_committed\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  336. },
  337. {
  338. "sequence": 1,
  339. "offsetMs": 40,
  340. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_e2e_sse_stall_committed_read\",\"name\":\"Read\",\"input\":{}}}\n\n"
  341. },
  342. {
  343. "sequence": 2,
  344. "offsetMs": 80,
  345. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"file_path\\\":\\\"{{e2eRuntimeRoot}}/shared/readonly-tool.txt\\\"}\"}}\n\n"
  346. },
  347. {
  348. "sequence": 3,
  349. "offsetMs": 120,
  350. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  351. },
  352. {
  353. "sequence": 4,
  354. "offsetMs": 5000,
  355. "text": "event: ping\ndata: {\"type\":\"ping\"}\n\n"
  356. }
  357. ]
  358. }
  359. },
  360. {
  361. "id": "sse-stall-tool-committed-continuation",
  362. "description": "完整 tool block stall 后,带同一 tool_use 和成功 tool_result 的恢复请求立即收口。",
  363. "metadata": {
  364. "kind": "main",
  365. "timingPolicy": "fast-text",
  366. "source": "synthetic",
  367. "syntheticReason": "证明 content_block_stop 已提交并执行工具,成功 tool_result 成为恢复锚点。"
  368. },
  369. "maxMatches": 1,
  370. "match": {
  371. "method": "POST",
  372. "pathIncludes": "/messages",
  373. "bodyIncludes": [
  374. "E2E_SSE_STALL_TOOL_COMMITTED",
  375. "toolu_e2e_sse_stall_committed_read",
  376. "readonly-tool.txt"
  377. ],
  378. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  379. },
  380. "response": {
  381. "statusCode": 200,
  382. "statusMessage": "OK",
  383. "text": {
  384. "id": "msg_e2e_sse_stall_tool_committed_continued",
  385. "text": "E2E_SSE_STALL_TOOL_COMMITTED_DONE"
  386. }
  387. }
  388. },
  389. {
  390. "id": "sse-stall-post-tool-call",
  391. "description": "先完整结束第一条模型流并执行一次只读 Read。",
  392. "metadata": {
  393. "kind": "main",
  394. "timingPolicy": "fast-tool-use",
  395. "source": "synthetic",
  396. "syntheticReason": "构造工具已经成功执行、tool_result 已进入下一次模型请求的真实前置状态。"
  397. },
  398. "maxMatches": 1,
  399. "match": {
  400. "method": "POST",
  401. "pathIncludes": "/messages",
  402. "lastUserMessageIncludes": ["E2E_SSE_STALL_POST_TOOL"],
  403. "bodyExcludes": [
  404. "toolu_e2e_sse_stall_post_tool_read",
  405. "Generate a concise title",
  406. "CRITICAL: Respond with TEXT ONLY"
  407. ]
  408. },
  409. "response": {
  410. "statusCode": 200,
  411. "statusMessage": "OK",
  412. "toolUse": {
  413. "id": "toolu_e2e_sse_stall_post_tool_read",
  414. "name": "Read",
  415. "input": {
  416. "file_path": "{{e2eRuntimeRoot}}/shared/readonly-tool.txt"
  417. }
  418. }
  419. }
  420. },
  421. {
  422. "id": "sse-stall-post-tool-continuation-stalled",
  423. "description": "Read 成功后的下一次模型请求只发送 message_start,随后保持无 event。",
  424. "metadata": {
  425. "kind": "main",
  426. "timingPolicy": "fault-stream",
  427. "source": "synthetic",
  428. "syntheticReason": "把 stall 放在已成功执行工具之后,验证恢复不会重放工具。"
  429. },
  430. "maxMatches": 1,
  431. "match": {
  432. "method": "POST",
  433. "pathIncludes": "/messages",
  434. "bodyIncludes": [
  435. "E2E_SSE_STALL_POST_TOOL",
  436. "toolu_e2e_sse_stall_post_tool_read",
  437. "E2E_READONLY_TOOL_FILE_CONTENT"
  438. ],
  439. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  440. },
  441. "response": {
  442. "statusCode": 200,
  443. "statusMessage": "OK",
  444. "headers": {
  445. "cache-control": "no-cache",
  446. "content-type": "text/event-stream; charset=utf-8"
  447. },
  448. "events": [
  449. {
  450. "sequence": 0,
  451. "offsetMs": 0,
  452. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_sse_stall_post_tool_continuation\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  453. },
  454. {
  455. "sequence": 1,
  456. "offsetMs": 5000,
  457. "text": "event: ping\ndata: {\"type\":\"ping\"}\n\n"
  458. }
  459. ]
  460. }
  461. },
  462. {
  463. "id": "sse-stall-post-tool-continuation-recovered",
  464. "description": "已成功执行工具后的 stalled continuation 在重试时立即成功。",
  465. "metadata": {
  466. "kind": "main",
  467. "timingPolicy": "fast-text",
  468. "source": "synthetic",
  469. "syntheticReason": "证明 post-tool continuation 只重试模型请求,不重复执行工具。"
  470. },
  471. "maxMatches": 1,
  472. "match": {
  473. "method": "POST",
  474. "pathIncludes": "/messages",
  475. "bodyIncludes": [
  476. "E2E_SSE_STALL_POST_TOOL",
  477. "toolu_e2e_sse_stall_post_tool_read",
  478. "E2E_READONLY_TOOL_FILE_CONTENT"
  479. ],
  480. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  481. },
  482. "response": {
  483. "statusCode": 200,
  484. "statusMessage": "OK",
  485. "text": {
  486. "id": "msg_e2e_sse_stall_post_tool_recovered",
  487. "text": "E2E_SSE_STALL_POST_TOOL_DONE"
  488. }
  489. }
  490. }
  491. ]
  492. }