conversation-session-empty-completion-retry.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-empty-completion-retry",
  4. "spec": "./test/e2e/conversation-session/execution/conversation-session-empty-completion-retry.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "empty-completion-retry-title",
  8. "description": "空 completion retry case 的标题 sidecar 固定响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题不是空 completion retry 的产品语义;固定响应避免 title sidecar 依赖共享 legacy fixture。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_EMPTY_COMPLETION_RETRY_STREAM"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "text": {
  23. "id": "empty-completion-retry-title",
  24. "inputTokens": 64,
  25. "outputTokens": 8,
  26. "text": "{\"title\":\"Empty Completion Retry E2E\"}"
  27. }
  28. }
  29. },
  30. {
  31. "id": "empty-completion-retry-stream-first-empty",
  32. "description": "首个主请求正常 EOF 收口,但 finish=other 且 text/reasoning/tool/usage 全为空。",
  33. "metadata": {
  34. "kind": "main",
  35. "timingPolicy": "fast-text",
  36. "source": "synthetic",
  37. "syntheticReason": "稳定制造 provider 正常 EOF + finish=other 的零输出 completion,验证 adapter 隐藏首个 attempt 并只重试一次。"
  38. },
  39. "maxMatches": 1,
  40. "match": {
  41. "method": "POST",
  42. "pathIncludes": "/messages",
  43. "lastUserMessageIncludes": ["E2E_EMPTY_COMPLETION_RETRY_STREAM"],
  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. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"empty-completion-retry-first-empty\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":0,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0}}}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"other\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":0,\"output_tokens\":0}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  54. }
  55. },
  56. {
  57. "id": "empty-completion-retry-stream-second-success",
  58. "description": "第二个主请求返回正常文本,作为唯一一次 retry 的成功结果。",
  59. "metadata": {
  60. "kind": "main",
  61. "timingPolicy": "fast-text",
  62. "source": "synthetic",
  63. "syntheticReason": "固定 retry 后的成功文本,证明首个空 attempt 没有泄漏到 UI 且逻辑 turn 正常收口。"
  64. },
  65. "maxMatches": 1,
  66. "match": {
  67. "method": "POST",
  68. "pathIncludes": "/messages",
  69. "lastUserMessageIncludes": ["E2E_EMPTY_COMPLETION_RETRY_STREAM"],
  70. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  71. },
  72. "response": {
  73. "statusCode": 200,
  74. "statusMessage": "OK",
  75. "headers": {
  76. "cache-control": "no-cache",
  77. "content-type": "text/event-stream; charset=utf-8"
  78. },
  79. "text": {
  80. "id": "empty-completion-retry-stream-second-success",
  81. "inputTokens": 96,
  82. "outputTokens": 8,
  83. "text": "EMPTY_COMPLETION_RETRY_OK"
  84. }
  85. }
  86. },
  87. {
  88. "id": "empty-context-finish-title",
  89. "description": "空 completion retry case 的标题 sidecar 固定响应。",
  90. "metadata": {
  91. "kind": "common",
  92. "timingPolicy": "fast-text",
  93. "source": "synthetic",
  94. "syntheticReason": "标题不是空 completion retry 的产品语义;固定响应避免 title sidecar 依赖共享 legacy fixture。"
  95. },
  96. "match": {
  97. "method": "POST",
  98. "pathIncludes": "/messages",
  99. "bodyIncludes": ["Generate a concise title", "E2E_EMPTY_COMPLETION_CONTEXT_SEED"]
  100. },
  101. "response": {
  102. "statusCode": 200,
  103. "text": {
  104. "id": "empty-context-finish-title",
  105. "inputTokens": 64,
  106. "outputTokens": 8,
  107. "text": "{\"title\":\"Empty Completion Retry E2E\"}"
  108. }
  109. }
  110. },
  111. {
  112. "id": "empty-context-finish-seed",
  113. "description": "两轮已完成会话建立可压缩历史。",
  114. "metadata": {
  115. "kind": "main",
  116. "timingPolicy": "fast-text",
  117. "source": "synthetic",
  118. "syntheticReason": "Reactive Compact 需要完整历史;用真实主请求准备两轮,避免直接注入运行时状态。"
  119. },
  120. "maxMatches": 2,
  121. "match": {
  122. "method": "POST",
  123. "pathIncludes": "/messages",
  124. "lastUserMessageIncludes": ["E2E_EMPTY_COMPLETION_CONTEXT_SEED"],
  125. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  126. },
  127. "response": {
  128. "statusCode": 200,
  129. "text": {
  130. "id": "empty-context-finish-seed",
  131. "inputTokens": 96,
  132. "outputTokens": 16,
  133. "text": "EMPTY_CONTEXT_SEED_OK"
  134. }
  135. }
  136. },
  137. {
  138. "id": "empty-context-finish-first-empty",
  139. "description": "首请求零输出且 raw finish 为明确上下文限制,交给 Reactive Compact。",
  140. "metadata": {
  141. "kind": "main",
  142. "timingPolicy": "fast-text",
  143. "source": "synthetic",
  144. "syntheticReason": "构造零 text/reasoning/tool、非零 usage(80 input / 5 output)的明确上下文限制,验证不叠加空响应重试且恢复前保留已发生用量。"
  145. },
  146. "maxMatches": 1,
  147. "match": {
  148. "method": "POST",
  149. "pathIncludes": "/messages",
  150. "lastUserMessageIncludes": ["E2E_EMPTY_COMPLETION_CONTEXT_FINISH"],
  151. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  152. },
  153. "response": {
  154. "statusCode": 200,
  155. "statusMessage": "OK",
  156. "headers": {
  157. "cache-control": "no-cache",
  158. "content-type": "text/event-stream; charset=utf-8"
  159. },
  160. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"empty-context-finish-first-empty\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":80,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0}}}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"model_context_window_exceeded\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":80,\"output_tokens\":5}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  161. }
  162. },
  163. {
  164. "id": "empty-context-finish-compact",
  165. "description": "明确上下文限制后生成 Reactive Compact summary。",
  166. "metadata": {
  167. "kind": "main",
  168. "timingPolicy": "fast-text",
  169. "source": "synthetic",
  170. "syntheticReason": "验证首个空响应之后立即压缩,无额外空响应重试或 Continue。"
  171. },
  172. "maxMatches": 1,
  173. "match": {
  174. "method": "POST",
  175. "pathIncludes": "/messages",
  176. "bodyIncludes": ["CRITICAL: Respond with TEXT ONLY", "E2E_EMPTY_COMPLETION_CONTEXT_SEED"],
  177. "bodyExcludes": ["Generate a concise title", "Output token limit hit. Resume directly"]
  178. },
  179. "response": {
  180. "statusCode": 200,
  181. "text": {
  182. "id": "empty-context-finish-compact",
  183. "inputTokens": 96,
  184. "outputTokens": 16,
  185. "text": "<summary>EMPTY_CONTEXT_COMPACT_SUMMARY. Earlier setup turns completed with EMPTY_CONTEXT_SEED_OK.</summary>"
  186. }
  187. }
  188. },
  189. {
  190. "id": "empty-context-finish-retry-success",
  191. "description": "只接受携带压缩摘要且不含 Continue 的原请求重试。",
  192. "metadata": {
  193. "kind": "main",
  194. "timingPolicy": "fast-text",
  195. "source": "synthetic",
  196. "syntheticReason": "严格匹配压缩后的请求,区分 Reactive Compact 恢复与未压缩重发或 Continue。"
  197. },
  198. "maxMatches": 1,
  199. "match": {
  200. "method": "POST",
  201. "pathIncludes": "/messages",
  202. "bodyIncludes": ["EMPTY_CONTEXT_COMPACT_SUMMARY", "E2E_EMPTY_COMPLETION_CONTEXT_FINISH"],
  203. "bodyExcludes": [
  204. "Generate a concise title",
  205. "CRITICAL: Respond with TEXT ONLY",
  206. "Output token limit hit. Resume directly"
  207. ]
  208. },
  209. "response": {
  210. "statusCode": 200,
  211. "statusMessage": "OK",
  212. "headers": {
  213. "cache-control": "no-cache",
  214. "content-type": "text/event-stream; charset=utf-8"
  215. },
  216. "text": {
  217. "id": "empty-context-finish-retry-success",
  218. "inputTokens": 96,
  219. "outputTokens": 8,
  220. "text": "EMPTY_CONTEXT_FINISH_OK"
  221. }
  222. }
  223. },
  224. {
  225. "id": "empty-context-finish-unexpected-retry",
  226. "description": "未压缩重发或错误 Continue 的诊断响应,立即使恢复断言失败。",
  227. "metadata": {
  228. "kind": "main",
  229. "timingPolicy": "fast-text",
  230. "source": "synthetic",
  231. "syntheticReason": "将未压缩的重复主请求变为确定性断言失败,避免 fixture miss 触发无关网络重试。"
  232. },
  233. "maxMatches": 1,
  234. "match": {
  235. "method": "POST",
  236. "pathIncludes": "/messages",
  237. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  238. "bodyIncludes": ["E2E_EMPTY_COMPLETION_CONTEXT_FINISH"]
  239. },
  240. "response": {
  241. "statusCode": 200,
  242. "statusMessage": "OK",
  243. "headers": {
  244. "cache-control": "no-cache",
  245. "content-type": "text/event-stream; charset=utf-8"
  246. },
  247. "text": {
  248. "id": "empty-context-finish-unexpected-retry",
  249. "inputTokens": 96,
  250. "outputTokens": 8,
  251. "text": "UNEXPECTED_EMPTY_CONTEXT_RETRY"
  252. }
  253. }
  254. }
  255. ]
  256. }