conversation-session-compact-manual-queue.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-compact-manual-queue",
  4. "spec": "./test/e2e/conversation-session/context/conversation-session-compact-manual-queue.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "conversation-session-compact-manual-queue-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-manual-queue-prep-one",
  31. "description": "manual compact held queue 第一轮预置纯文本回复。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "第一轮只用于形成可 compact 的普通历史,真实 provider 文案不影响 held queue 语义。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "bodyIncludes": ["E2E_COMPACT_PREP_ONE"],
  43. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  44. "lastUserMessageIncludes": ["E2E_COMPACT_PREP_ONE"]
  45. },
  46. "response": {
  47. "statusCode": 200,
  48. "text": {
  49. "id": "upstream-e2e-compact-manual-queue-prep-one",
  50. "inputTokens": 128,
  51. "outputTokens": 12,
  52. "text": "upstream-e2e-ok"
  53. }
  54. }
  55. },
  56. {
  57. "id": "upstream-compact-manual-queue-readonly-final",
  58. "description": "manual compact held queue 第二轮 Read tool_result 后最终回复。",
  59. "metadata": {
  60. "kind": "main",
  61. "timingPolicy": "fast-text",
  62. "source": "synthetic",
  63. "syntheticReason": "第二轮只用于构造含 readonly tool_result 的 compact 历史,工具业务由本地文件 fixture 决定。"
  64. },
  65. "maxMatches": 1,
  66. "match": {
  67. "method": "POST",
  68. "pathIncludes": "/messages",
  69. "bodyIncludes": ["E2E_COMPACT_PREP_TWO", "E2E_READONLY_TOOL_FILE_CONTENT"],
  70. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  71. },
  72. "response": {
  73. "statusCode": 200,
  74. "text": {
  75. "id": "upstream-e2e-compact-manual-queue-readonly-final",
  76. "inputTokens": 190,
  77. "outputTokens": 12,
  78. "text": "upstream-e2e-ok"
  79. }
  80. }
  81. },
  82. {
  83. "id": "upstream-compact-manual-queue-summary-success",
  84. "description": "held queue 存在时手动 /compact 成功的 summary 响应。",
  85. "metadata": {
  86. "kind": "main",
  87. "timingPolicy": "controlled-stream",
  88. "source": "synthetic",
  89. "syntheticReason": "检查真实 compacting 时 held queue 身份后显式释放摘要响应,完成后继续验证未被消费。"
  90. },
  91. "maxMatches": 1,
  92. "match": {
  93. "method": "POST",
  94. "pathIncludes": "/messages",
  95. "bodyIncludes": [
  96. "E2E_COMPACT_PREP_ONE",
  97. "CRITICAL: Respond with TEXT ONLY",
  98. "Do NOT call any tools",
  99. "\"stream\":true"
  100. ],
  101. "bodyExcludes": ["E2E_AUTO_COMPACT", "E2E_AUTO_ACTIONS"]
  102. },
  103. "response": {
  104. "statusCode": 200,
  105. "headers": {
  106. "content-type": "text/event-stream; charset=utf-8"
  107. },
  108. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"e2e-compact-actions-summary\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"usage\":{\"input_tokens\":256,\"output_tokens\":0}}}\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\":\"<analysis>Manual compact e2e replay summarized a compacting actions fixture without tools.</analysis>\\n\\n<summary>Conversation so far included E2E_COMPACTING_ACTIONS setup messages and should remain available for queued follow-up behavior.</summary>\"}}\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\"},\"usage\":{\"output_tokens\":64}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n",
  109. "chunks": [
  110. {
  111. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"e2e-compact-actions-summary\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"usage\":{\"input_tokens\":256,\"output_tokens\":0}}}\n\n",
  112. "delayMs": 0
  113. },
  114. {
  115. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n",
  116. "delayMs": 0
  117. },
  118. {
  119. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"<analysis>Manual compact e2e replay summarized a compacting actions fixture without tools.</analysis>\\n\\n<summary>Conversation so far included E2E_COMPACTING_ACTIONS setup messages and should remain available for queued follow-up behavior.</summary>\"}}\n\n",
  120. "delayMs": 0
  121. },
  122. {
  123. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n",
  124. "delayMs": 0
  125. },
  126. {
  127. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\"},\"usage\":{\"output_tokens\":64}}\n\n",
  128. "delayMs": 0
  129. },
  130. {
  131. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n",
  132. "delayMs": 0
  133. }
  134. ],
  135. "releaseAfterChunks": 2
  136. }
  137. },
  138. {
  139. "id": "upstream-compact-manual-queue-held-contract",
  140. "description": "manual compact held queue marker 合同占位;不应被 provider 消费。",
  141. "metadata": {
  142. "kind": "main",
  143. "timingPolicy": "fast-text",
  144. "source": "synthetic",
  145. "syntheticReason": "held queue 在 manual compact 前后都必须保留;fixture 只覆盖 marker 合同。"
  146. },
  147. "maxMatches": 0,
  148. "match": {
  149. "method": "POST",
  150. "pathIncludes": "/messages",
  151. "bodyIncludes": ["E2E_COMPACT_QUEUE_HELD"],
  152. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  153. "lastUserMessageIncludes": ["E2E_COMPACT_QUEUE_HELD"]
  154. },
  155. "response": {
  156. "statusCode": 200,
  157. "text": {
  158. "id": "upstream-e2e-compact-manual-queue-held-should-not-send",
  159. "inputTokens": 128,
  160. "outputTokens": 12,
  161. "text": "upstream-e2e-ok"
  162. }
  163. }
  164. },
  165. {
  166. "id": "upstream-compact-manual-queue-append-contract",
  167. "description": "manual compact 完成后追加 held queue marker 合同占位;不应立即发送。",
  168. "metadata": {
  169. "kind": "main",
  170. "timingPolicy": "fast-text",
  171. "source": "synthetic",
  172. "syntheticReason": "manual compact 完成后 queue 仍 held,追加文本应入队而不是触发 provider。"
  173. },
  174. "maxMatches": 0,
  175. "match": {
  176. "method": "POST",
  177. "pathIncludes": "/messages",
  178. "bodyIncludes": ["E2E_COMPACT_QUEUE_APPEND_AFTER_SUCCESS"],
  179. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  180. "lastUserMessageIncludes": ["E2E_COMPACT_QUEUE_APPEND_AFTER_SUCCESS"]
  181. },
  182. "response": {
  183. "statusCode": 200,
  184. "text": {
  185. "id": "upstream-e2e-compact-manual-queue-append-should-not-send",
  186. "inputTokens": 128,
  187. "outputTokens": 12,
  188. "text": "upstream-e2e-ok"
  189. }
  190. }
  191. },
  192. {
  193. "id": "upstream-compact-manual-queue-running",
  194. "description": "真实入队后 Stop,建立 held queue。",
  195. "match": {
  196. "method": "POST",
  197. "pathIncludes": "/messages",
  198. "lastUserMessageIncludes": ["E2E_COMPACT_QUEUE_RUNNING"],
  199. "bodyIncludes": ["E2E_COMPACT_QUEUE_RUNNING"],
  200. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  201. },
  202. "response": {
  203. "statusCode": 200,
  204. "headers": {
  205. "cache-control": "no-cache",
  206. "content-type": "text/event-stream; charset=utf-8"
  207. },
  208. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-slow-stream\",\"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\":\"E2E_COMPACT_QUEUE_PARTIAL\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"_TAIL\"}}\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",
  209. "chunks": [
  210. {
  211. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-slow-stream\",\"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",
  212. "delayMs": 0
  213. },
  214. {
  215. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n",
  216. "delayMs": 0
  217. },
  218. {
  219. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_COMPACT_QUEUE_PARTIAL\"}}\n\n",
  220. "delayMs": 0
  221. },
  222. {
  223. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"_TAIL\"}}\n\n",
  224. "delayMs": 0
  225. },
  226. {
  227. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"-e2e-ok\"}}\n\n",
  228. "delayMs": 0
  229. },
  230. {
  231. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n",
  232. "delayMs": 0
  233. },
  234. {
  235. "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",
  236. "delayMs": 0
  237. },
  238. {
  239. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n",
  240. "delayMs": 0
  241. }
  242. ],
  243. "releaseAfterChunks": 3
  244. },
  245. "metadata": {
  246. "kind": "main",
  247. "source": "synthetic",
  248. "timingPolicy": "controlled-stream",
  249. "syntheticReason": "真实 partial 输出后保持流,直到测试点击 Stop;不存在错过停止窗口而跳过断言的路径。"
  250. },
  251. "maxMatches": 1
  252. }
  253. ]
  254. }