conversation-session-compact-interrupted.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-compact-interrupted",
  4. "spec": "./test/e2e/conversation-session/conversation-session-compact-interrupted.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-compact-interrupted-prep-one-final",
  8. "description": "F02 interrupted compact 第一轮普通前置消息固定回复。",
  9. "metadata": {
  10. "kind": "main",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "第一轮只需要形成 completed 历史,真实文案不影响 compact 语义。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": [
  20. "E2E_COMPACT_INTERRUPTED_PREP_ONE"
  21. ],
  22. "bodyExcludes": [
  23. "Generate a concise title",
  24. "CRITICAL: Respond with TEXT ONLY"
  25. ],
  26. "lastUserMessageIncludes": [
  27. "E2E_COMPACT_INTERRUPTED_PREP_ONE"
  28. ]
  29. },
  30. "response": {
  31. "statusCode": 200,
  32. "text": {
  33. "id": "upstream-e2e-compact-interrupted-prep-one-final",
  34. "inputTokens": 128,
  35. "outputTokens": 12,
  36. "text": "upstream-e2e-ok"
  37. }
  38. }
  39. },
  40. {
  41. "id": "upstream-compact-interrupted-readonly-tool-call",
  42. "description": "F02 interrupted compact 第二轮返回 Read tool_use,形成真实 tool_result 历史。",
  43. "metadata": {
  44. "kind": "common",
  45. "timingPolicy": "fast-text",
  46. "source": "synthetic",
  47. "syntheticReason": "只读 Read tool_use 覆盖 interrupted compact 前含工具历史的投影。"
  48. },
  49. "maxMatches": 1,
  50. "match": {
  51. "method": "POST",
  52. "pathIncludes": "/messages",
  53. "bodyIncludes": [
  54. "Read {{e2eRuntimeRoot}}/shared/readonly-tool.txt",
  55. "E2E_COMPACT_INTERRUPTED_PREP_TWO"
  56. ],
  57. "bodyExcludes": [
  58. "Generate a concise title"
  59. ]
  60. },
  61. "response": {
  62. "statusCode": 200,
  63. "statusMessage": "OK",
  64. "headers": {
  65. "cache-control": "no-cache",
  66. "content-type": "text/event-stream; charset=utf-8"
  67. },
  68. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-conversation-readonly-tool-call\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":96,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_e2e_conversation_readonly_read\",\"name\":\"Read\",\"input\":{}}}\n\nevent: 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\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":96,\"output_tokens\":16,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  69. }
  70. },
  71. {
  72. "id": "upstream-compact-interrupted-readonly-final",
  73. "description": "F02 interrupted compact 第二轮 Read tool_result 后固定回复。",
  74. "metadata": {
  75. "kind": "main",
  76. "timingPolicy": "fast-text",
  77. "source": "synthetic",
  78. "syntheticReason": "第二轮只需要形成 completed tool history,真实文案不影响 compact 语义。"
  79. },
  80. "maxMatches": 1,
  81. "match": {
  82. "method": "POST",
  83. "pathIncludes": "/messages",
  84. "bodyIncludes": [
  85. "E2E_COMPACT_INTERRUPTED_PREP_TWO",
  86. "E2E_READONLY_TOOL_FILE_CONTENT"
  87. ],
  88. "bodyExcludes": [
  89. "Generate a concise title",
  90. "CRITICAL: Respond with TEXT ONLY"
  91. ]
  92. },
  93. "response": {
  94. "statusCode": 200,
  95. "statusMessage": "OK",
  96. "headers": {
  97. "cache-control": "no-cache",
  98. "content-type": "text/event-stream; charset=utf-8"
  99. },
  100. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-conversation-readonly-compact-interrupted-final\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":190,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"upstream-e2e-ok\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":190,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  101. }
  102. },
  103. {
  104. "id": "upstream-compact-interrupted-running-slow",
  105. "description": "F02 stop 前的慢流响应,稳定制造 completed interrupted。",
  106. "metadata": {
  107. "kind": "main",
  108. "timingPolicy": "controlled-stream",
  109. "source": "synthetic",
  110. "syntheticReason": "需要 stop 当前 running 轮得到 interrupted 状态,真实模型可能过快完成。"
  111. },
  112. "maxMatches": 1,
  113. "match": {
  114. "method": "POST",
  115. "pathIncludes": "/messages",
  116. "bodyIncludes": [
  117. "E2E_SLOW_STREAM",
  118. "E2E_COMPACT_INTERRUPTED_RUNNING"
  119. ],
  120. "bodyExcludes": [
  121. "Generate a concise title",
  122. "CRITICAL: Respond with TEXT ONLY"
  123. ],
  124. "lastUserMessageIncludes": [
  125. "E2E_COMPACT_INTERRUPTED_RUNNING"
  126. ]
  127. },
  128. "response": {
  129. "statusCode": 200,
  130. "statusMessage": "OK",
  131. "headers": {
  132. "cache-control": "no-cache",
  133. "content-type": "text/event-stream; charset=utf-8"
  134. },
  135. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-compact-interrupted-running-slow\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":120,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"deep\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"seek\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"-e2e-ok\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":120,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n",
  136. "events": [
  137. {
  138. "sequence": 0,
  139. "offsetMs": 0,
  140. "byteLength": 333,
  141. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-compact-interrupted-running-slow\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":120,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n"
  142. },
  143. {
  144. "sequence": 1,
  145. "offsetMs": 250,
  146. "byteLength": 120,
  147. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  148. },
  149. {
  150. "sequence": 2,
  151. "offsetMs": 8000,
  152. "byteLength": 118,
  153. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"deep\"}}\n\n"
  154. },
  155. {
  156. "sequence": 3,
  157. "offsetMs": 16000,
  158. "byteLength": 118,
  159. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"seek\"}}\n\n"
  160. },
  161. {
  162. "sequence": 4,
  163. "offsetMs": 24000,
  164. "byteLength": 122,
  165. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"-e2e-ok\"}}\n\n"
  166. },
  167. {
  168. "sequence": 5,
  169. "offsetMs": 90000,
  170. "byteLength": 49,
  171. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  172. },
  173. {
  174. "sequence": 6,
  175. "offsetMs": 90100,
  176. "byteLength": 179,
  177. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":120,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\n"
  178. },
  179. {
  180. "sequence": 7,
  181. "offsetMs": 90200,
  182. "byteLength": 42,
  183. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  184. }
  185. ]
  186. }
  187. },
  188. {
  189. "id": "upstream-compact-interrupted-manual-compact-success",
  190. "description": "F02 interrupted 后手动 /compact 的 summary 成功响应。",
  191. "metadata": {
  192. "kind": "main",
  193. "timingPolicy": "fast-text",
  194. "source": "synthetic",
  195. "syntheticReason": "手动 compact 的核心断言是允许在 interrupted 且 queue=0 时执行并完成 marker。"
  196. },
  197. "maxMatches": 1,
  198. "match": {
  199. "method": "POST",
  200. "pathIncludes": "/messages",
  201. "bodyIncludes": [
  202. "CRITICAL: Respond with TEXT ONLY",
  203. "E2E_COMPACT_INTERRUPTED_PREP_ONE",
  204. "E2E_COMPACT_INTERRUPTED_PREP_TWO",
  205. "\"stream\":true"
  206. ],
  207. "bodyExcludes": [
  208. "Generate a concise title"
  209. ]
  210. },
  211. "response": {
  212. "statusCode": 200,
  213. "statusMessage": "OK",
  214. "delayMs": 650,
  215. "text": {
  216. "id": "upstream-e2e-compact-success",
  217. "inputTokens": 256,
  218. "outputTokens": 64,
  219. "text": "<analysis>Manual compact e2e replay summarized the existing main session without tools.</analysis>\n\n<summary>Conversation so far: the user asked the assistant to reply with exactly upstream-e2e-ok for the initial verification turn. The assistant replied with upstream-e2e-ok. No files or tools were required.</summary>"
  220. }
  221. }
  222. },
  223. {
  224. "id": "upstream-compact-interrupted-slow-marker-contract",
  225. "description": "F02 通用 slow stream marker 合同占位,实际由 running fixture 覆盖。",
  226. "metadata": {
  227. "kind": "main",
  228. "timingPolicy": "controlled-stream",
  229. "source": "synthetic",
  230. "syntheticReason": "用于让 fixture check 明确覆盖 spec 中的通用 E2E_SLOW_STREAM marker。"
  231. },
  232. "maxMatches": 0,
  233. "match": {
  234. "method": "POST",
  235. "pathIncludes": "/messages",
  236. "bodyIncludes": [
  237. "E2E_SLOW_STREAM"
  238. ],
  239. "bodyExcludes": [
  240. "Generate a concise title",
  241. "CRITICAL: Respond with TEXT ONLY"
  242. ],
  243. "lastUserMessageIncludes": [
  244. "E2E_SLOW_STREAM"
  245. ]
  246. },
  247. "response": {
  248. "statusCode": 200,
  249. "text": {
  250. "id": "upstream-e2e-compact-interrupted-slow-marker-contract",
  251. "inputTokens": 128,
  252. "outputTokens": 12,
  253. "text": "upstream-e2e-ok"
  254. }
  255. }
  256. }
  257. ]
  258. }