conversation-session-fork.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-fork",
  4. "spec": "./test/e2e/conversation-session/branching/conversation-session-fork.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "conversation-session-fork-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-conversation-fork-basic-source-final",
  31. "description": "E01 基础 completed assistant fork 的 source turn 固定回复。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "基础 fork case 只需要稳定形成 completed assistant 消息;真实 provider 文案不影响 fork 边界语义。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "bodyIncludes": ["E2E_FORK_SOURCE"],
  43. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  44. "lastUserMessageIncludes": ["E2E_FORK_SOURCE"]
  45. },
  46. "response": {
  47. "statusCode": 200,
  48. "text": {
  49. "id": "upstream-e2e-conversation-fork-basic-source-final",
  50. "inputTokens": 128,
  51. "outputTokens": 12,
  52. "text": "upstream-e2e-ok"
  53. }
  54. }
  55. },
  56. {
  57. "id": "upstream-conversation-fork-goal-seed-final",
  58. "description": "E07 goal target 注入前 seed turn 固定回复。",
  59. "metadata": {
  60. "kind": "main",
  61. "timingPolicy": "fast-text",
  62. "source": "synthetic",
  63. "syntheticReason": "seed turn 只用于形成可 fork 的稳定 assistant 历史,后续 goal target 通过 sqlite 注入。"
  64. },
  65. "maxMatches": 1,
  66. "match": {
  67. "method": "POST",
  68. "pathIncludes": "/messages",
  69. "bodyIncludes": ["E2E_FORK_GOAL_SEED"],
  70. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  71. "lastUserMessageIncludes": ["E2E_FORK_GOAL_SEED"]
  72. },
  73. "response": {
  74. "statusCode": 200,
  75. "text": {
  76. "id": "upstream-e2e-conversation-fork-goal-seed-final",
  77. "inputTokens": 128,
  78. "outputTokens": 12,
  79. "text": "upstream-e2e-ok"
  80. }
  81. }
  82. },
  83. {
  84. "id": "upstream-conversation-fork-goal-source-final",
  85. "description": "E07 父 session 有 goal target 时的 source turn,用于让 renderer 同步已注入的 target。",
  86. "metadata": {
  87. "kind": "main",
  88. "timingPolicy": "fast-text",
  89. "source": "synthetic",
  90. "syntheticReason": "该 case 的核心语义是 fork child 继承父 target 且不复制父 queue;source turn 只负责完成一次 snapshot 同步,真实 provider 文案不影响断言。"
  91. },
  92. "maxMatches": 1,
  93. "match": {
  94. "method": "POST",
  95. "pathIncludes": "/messages",
  96. "bodyIncludes": ["E2E_FORK_GOAL_SOURCE"],
  97. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  98. "lastUserMessageIncludes": ["E2E_FORK_GOAL_SOURCE"]
  99. },
  100. "response": {
  101. "statusCode": 200,
  102. "text": {
  103. "id": "upstream-e2e-conversation-fork-goal-source-final",
  104. "inputTokens": 128,
  105. "outputTokens": 12,
  106. "text": "upstream-e2e-ok"
  107. }
  108. }
  109. },
  110. {
  111. "id": "upstream-conversation-fork-goal-held-queue-contract",
  112. "description": "E07 held queue marker 合同占位;fork 前父 session queue 不应立即发 provider。",
  113. "metadata": {
  114. "kind": "main",
  115. "timingPolicy": "fast-text",
  116. "source": "synthetic",
  117. "syntheticReason": "该 queued prompt 的产品语义是停留在父 session held queue,fork child 不复制它;运行时若命中该 fixture 反而说明 queue guard 失效。"
  118. },
  119. "maxMatches": 0,
  120. "match": {
  121. "method": "POST",
  122. "pathIncludes": "/messages",
  123. "bodyIncludes": ["E2E_FORK_GOAL_HELD_QUEUE"],
  124. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  125. "lastUserMessageIncludes": ["E2E_FORK_GOAL_HELD_QUEUE"]
  126. },
  127. "response": {
  128. "statusCode": 200,
  129. "text": {
  130. "id": "upstream-e2e-conversation-fork-goal-held-queue-should-not-send",
  131. "inputTokens": 128,
  132. "outputTokens": 12,
  133. "text": "upstream-e2e-ok"
  134. }
  135. }
  136. },
  137. {
  138. "id": "upstream-conversation-fork-edit-old-final",
  139. "description": "E09 edit fork 原始分支 source turn 固定回复。",
  140. "metadata": {
  141. "kind": "main",
  142. "timingPolicy": "fast-text",
  143. "source": "synthetic",
  144. "syntheticReason": "原始分支只用于随后 edit/rewind;真实 provider 文案不影响 active branch fork 断言。"
  145. },
  146. "maxMatches": 1,
  147. "match": {
  148. "method": "POST",
  149. "pathIncludes": "/messages",
  150. "bodyIncludes": ["E2E_FORK_EDIT_OLD"],
  151. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  152. "lastUserMessageIncludes": ["E2E_FORK_EDIT_OLD"]
  153. },
  154. "response": {
  155. "statusCode": 200,
  156. "text": {
  157. "id": "upstream-e2e-conversation-fork-edit-old-final",
  158. "inputTokens": 128,
  159. "outputTokens": 12,
  160. "text": "upstream-e2e-ok"
  161. }
  162. }
  163. },
  164. {
  165. "id": "upstream-conversation-fork-edit-active-final",
  166. "description": "E09 edit rerun 后 active branch 固定回复。",
  167. "metadata": {
  168. "kind": "main",
  169. "timingPolicy": "fast-text",
  170. "source": "synthetic",
  171. "syntheticReason": "该响应只需要稳定形成编辑后的 active assistant turn,用于证明 fork child 不复制旧分支。"
  172. },
  173. "maxMatches": 1,
  174. "match": {
  175. "method": "POST",
  176. "pathIncludes": "/messages",
  177. "bodyIncludes": ["E2E_FORK_EDIT_ACTIVE"],
  178. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  179. "lastUserMessageIncludes": ["E2E_FORK_EDIT_ACTIVE"]
  180. },
  181. "response": {
  182. "statusCode": 200,
  183. "text": {
  184. "id": "upstream-e2e-conversation-fork-edit-active-final",
  185. "inputTokens": 128,
  186. "outputTokens": 12,
  187. "text": "upstream-e2e-ok"
  188. }
  189. }
  190. },
  191. {
  192. "id": "upstream-conversation-fork-goal-running",
  193. "description": "E07 真实运行中发送队列,停止后保留父 held queue。",
  194. "metadata": {
  195. "kind": "main",
  196. "timingPolicy": "controlled-stream",
  197. "source": "synthetic",
  198. "syntheticReason": "固定运行窗口供用户入队和停止,不能用 renderer 伪队列替代 CLI 队列。"
  199. },
  200. "maxMatches": 1,
  201. "match": {
  202. "method": "POST",
  203. "pathIncludes": "/messages",
  204. "lastUserMessageIncludes": ["E2E_FORK_GOAL_RUNNING"],
  205. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  206. },
  207. "response": {
  208. "statusCode": 200,
  209. "statusMessage": "OK",
  210. "headers": {
  211. "cache-control": "no-cache",
  212. "content-type": "text/event-stream; charset=utf-8"
  213. },
  214. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-goal-running-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\":\"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",
  215. "events": [
  216. {
  217. "sequence": 0,
  218. "offsetMs": 0,
  219. "byteLength": 333,
  220. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-goal-running-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"
  221. },
  222. {
  223. "sequence": 1,
  224. "offsetMs": 250,
  225. "byteLength": 120,
  226. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  227. },
  228. {
  229. "sequence": 2,
  230. "offsetMs": 8000,
  231. "byteLength": 118,
  232. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"deep\"}}\n\n"
  233. },
  234. {
  235. "sequence": 3,
  236. "offsetMs": 16000,
  237. "byteLength": 118,
  238. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"seek\"}}\n\n"
  239. },
  240. {
  241. "sequence": 4,
  242. "offsetMs": 24000,
  243. "byteLength": 122,
  244. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"-e2e-ok\"}}\n\n"
  245. },
  246. {
  247. "sequence": 5,
  248. "offsetMs": 90000,
  249. "byteLength": 49,
  250. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  251. },
  252. {
  253. "sequence": 6,
  254. "offsetMs": 90100,
  255. "byteLength": 179,
  256. "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"
  257. },
  258. {
  259. "sequence": 7,
  260. "offsetMs": 90200,
  261. "byteLength": 42,
  262. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  263. }
  264. ]
  265. }
  266. }
  267. ]
  268. }