conversation-session-compact-interrupted.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-compact-interrupted",
  4. "spec": "./test/e2e/conversation-session/context/conversation-session-compact-interrupted.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "conversation-session-compact-interrupted-title-sidecar",
  8. "description": "本例标题旁路响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "source": "synthetic",
  12. "timingPolicy": "fast-text",
  13. "syntheticReason": "运行时证据显示标题旁路缺少响应;在本例显式登记固定标题,避免依赖 legacy fixture 或触发后台网络重试。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "statusMessage": "OK",
  23. "headers": {
  24. "content-type": "application/json; charset=utf-8"
  25. },
  26. "body": "{\"id\":\"upstream-e2e-title-fixture\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Upstream E2E Fixture\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":125,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}"
  27. }
  28. },
  29. {
  30. "id": "upstream-compact-interrupted-prep-one-final",
  31. "description": "F02 interrupted compact 第一轮普通前置消息固定回复。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "第一轮只需要形成 completed 历史,真实文案不影响 compact 语义。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "bodyIncludes": ["E2E_COMPACT_INTERRUPTED_PREP_ONE"],
  43. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  44. "lastUserMessageIncludes": ["E2E_COMPACT_INTERRUPTED_PREP_ONE"]
  45. },
  46. "response": {
  47. "statusCode": 200,
  48. "text": {
  49. "id": "upstream-e2e-compact-interrupted-prep-one-final",
  50. "inputTokens": 128,
  51. "outputTokens": 12,
  52. "text": "upstream-e2e-ok"
  53. }
  54. }
  55. },
  56. {
  57. "id": "upstream-compact-interrupted-readonly-tool-call",
  58. "description": "F02 interrupted compact 第二轮返回 Read tool_use,形成真实 tool_result 历史。",
  59. "metadata": {
  60. "kind": "common",
  61. "timingPolicy": "fast-text",
  62. "source": "synthetic",
  63. "syntheticReason": "只读 Read tool_use 覆盖 interrupted compact 前含工具历史的投影。"
  64. },
  65. "maxMatches": 1,
  66. "match": {
  67. "method": "POST",
  68. "pathIncludes": "/messages",
  69. "bodyIncludes": [
  70. "Read {{e2eRuntimeRoot}}/shared/readonly-tool.txt",
  71. "E2E_COMPACT_INTERRUPTED_PREP_TWO"
  72. ],
  73. "bodyExcludes": ["Generate a concise title"]
  74. },
  75. "response": {
  76. "statusCode": 200,
  77. "statusMessage": "OK",
  78. "headers": {
  79. "cache-control": "no-cache",
  80. "content-type": "text/event-stream; charset=utf-8"
  81. },
  82. "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"
  83. }
  84. },
  85. {
  86. "id": "upstream-compact-interrupted-readonly-final",
  87. "description": "F02 interrupted compact 第二轮 Read tool_result 后固定回复。",
  88. "metadata": {
  89. "kind": "main",
  90. "timingPolicy": "fast-text",
  91. "source": "synthetic",
  92. "syntheticReason": "第二轮只需要形成 completed tool history,真实文案不影响 compact 语义。"
  93. },
  94. "maxMatches": 1,
  95. "match": {
  96. "method": "POST",
  97. "pathIncludes": "/messages",
  98. "bodyIncludes": ["E2E_COMPACT_INTERRUPTED_PREP_TWO", "E2E_READONLY_TOOL_FILE_CONTENT"],
  99. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  100. },
  101. "response": {
  102. "statusCode": 200,
  103. "statusMessage": "OK",
  104. "headers": {
  105. "cache-control": "no-cache",
  106. "content-type": "text/event-stream; charset=utf-8"
  107. },
  108. "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"
  109. }
  110. },
  111. {
  112. "id": "upstream-compact-interrupted-running-slow",
  113. "description": "F02 stop 前的慢流响应,稳定制造 completed interrupted。",
  114. "metadata": {
  115. "kind": "main",
  116. "timingPolicy": "controlled-stream",
  117. "source": "synthetic",
  118. "syntheticReason": "需要 stop 当前 running 轮得到 interrupted 状态,真实模型可能过快完成。"
  119. },
  120. "maxMatches": 1,
  121. "match": {
  122. "method": "POST",
  123. "pathIncludes": "/messages",
  124. "bodyIncludes": ["E2E_SLOW_STREAM", "E2E_COMPACT_INTERRUPTED_RUNNING"],
  125. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  126. "lastUserMessageIncludes": ["E2E_COMPACT_INTERRUPTED_RUNNING"]
  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": ["Generate a concise title"]
  208. },
  209. "response": {
  210. "statusCode": 200,
  211. "statusMessage": "OK",
  212. "delayMs": 650,
  213. "text": {
  214. "id": "upstream-e2e-compact-success",
  215. "inputTokens": 256,
  216. "outputTokens": 64,
  217. "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>"
  218. }
  219. }
  220. },
  221. {
  222. "id": "upstream-compact-interrupted-slow-marker-contract",
  223. "description": "F02 通用 slow stream marker 合同占位,实际由 running fixture 覆盖。",
  224. "metadata": {
  225. "kind": "main",
  226. "timingPolicy": "controlled-stream",
  227. "source": "synthetic",
  228. "syntheticReason": "用于让 fixture check 明确覆盖 spec 中的通用 E2E_SLOW_STREAM marker。"
  229. },
  230. "maxMatches": 0,
  231. "match": {
  232. "method": "POST",
  233. "pathIncludes": "/messages",
  234. "bodyIncludes": ["E2E_SLOW_STREAM"],
  235. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  236. "lastUserMessageIncludes": ["E2E_SLOW_STREAM"]
  237. },
  238. "response": {
  239. "statusCode": 200,
  240. "text": {
  241. "id": "upstream-e2e-compact-interrupted-slow-marker-contract",
  242. "inputTokens": 128,
  243. "outputTokens": 12,
  244. "text": "upstream-e2e-ok"
  245. }
  246. }
  247. }
  248. ]
  249. }