conversation-session-plan-file-compact-continuity.json 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-plan-file-compact-continuity",
  4. "spec": "./test/e2e/conversation-session/planning/conversation-session-plan-file-compact-continuity.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "conversation-session-plan-file-compact-continuity-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-plan-file-compact-enter-plan-call",
  31. "description": "首轮请求稳定返回 EnterPlanMode 工具调用,制造 plan mode 审批前置状态。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "需要稳定制造 plan mode 状态,避免依赖真实模型是否选择 EnterPlanMode。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_PLAN_FILE_COMPACT_CONTINUITY"],
  43. "bodyIncludes": [
  44. "E2E_PLAN_FILE_COMPACT_CONTINUITY",
  45. "E2E_PLAN_FILE_COMPACT_ENTER_PLAN",
  46. "E2E_PLAN_FILE_COMPACT_EXIT_PLAN"
  47. ],
  48. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  49. },
  50. "response": {
  51. "statusCode": 200,
  52. "toolUse": {
  53. "id": "toolu_e2e_plan_file_compact_enter_plan_mode",
  54. "name": "EnterPlanMode",
  55. "input": {}
  56. }
  57. }
  58. },
  59. {
  60. "id": "upstream-plan-file-compact-exit-plan-call",
  61. "description": "进入 plan mode 后返回 ExitPlanMode 工具调用,触发审批弹窗并携带唯一 plan marker。",
  62. "metadata": {
  63. "kind": "main",
  64. "timingPolicy": "fast-text",
  65. "source": "synthetic",
  66. "syntheticReason": "需要稳定触发 ExitPlanMode 审批弹窗,并让已批准 plan 内容可在文件和 compact 后请求中被追踪。"
  67. },
  68. "maxMatches": 1,
  69. "match": {
  70. "method": "POST",
  71. "pathIncludes": "/messages",
  72. "bodyIncludes": [
  73. "E2E_PLAN_FILE_COMPACT_EXIT_PLAN",
  74. "toolu_e2e_plan_file_compact_enter_plan_mode"
  75. ],
  76. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  77. },
  78. "response": {
  79. "statusCode": 200,
  80. "toolUse": {
  81. "id": "toolu_e2e_plan_file_compact_exit_plan_mode",
  82. "name": "ExitPlanMode",
  83. "input": {
  84. "plan": "E2E_PLAN_FILE_COMPACT_PLAN_BODY: 1. Persist the approved plan under .zcode/plans. 2. Preserve the plan through manual compact via plan_file_reference."
  85. }
  86. }
  87. }
  88. },
  89. {
  90. "id": "upstream-plan-file-compact-approval-final",
  91. "description": "用户批准 plan 后返回固定文本,让审批轮进入 completed。",
  92. "metadata": {
  93. "kind": "main",
  94. "timingPolicy": "fast-text",
  95. "source": "synthetic",
  96. "syntheticReason": "审批通过后的回复内容不是本 case 核心,只需要稳定结束当前轮并保留 provider-visible approved plan。"
  97. },
  98. "maxMatches": 1,
  99. "match": {
  100. "method": "POST",
  101. "pathIncludes": "/messages",
  102. "bodyIncludes": [
  103. "toolu_e2e_plan_file_compact_exit_plan_mode",
  104. "User has approved your plan",
  105. "E2E_PLAN_FILE_COMPACT_PLAN_BODY"
  106. ],
  107. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  108. },
  109. "response": {
  110. "statusCode": 200,
  111. "text": {
  112. "id": "upstream-e2e-plan-file-compact-approval-final",
  113. "inputTokens": 192,
  114. "outputTokens": 12,
  115. "text": "upstream-e2e-ok"
  116. }
  117. }
  118. },
  119. {
  120. "id": "upstream-plan-file-compact-checkpoint-final",
  121. "description": "审批后追加一轮普通消息,使手动 compact 具备两轮以上可压缩历史。",
  122. "metadata": {
  123. "kind": "main",
  124. "timingPolicy": "fast-text",
  125. "source": "synthetic",
  126. "syntheticReason": "当前 compact 策略会跳过过短历史,checkpoint 只用于稳定满足 compact 入口条件。"
  127. },
  128. "maxMatches": 1,
  129. "match": {
  130. "method": "POST",
  131. "pathIncludes": "/messages",
  132. "lastUserMessageIncludes": ["E2E_PLAN_FILE_COMPACT_CHECKPOINT"],
  133. "bodyIncludes": ["E2E_PLAN_FILE_COMPACT_CHECKPOINT", "E2E_PLAN_FILE_COMPACT_PLAN_BODY"],
  134. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  135. },
  136. "response": {
  137. "statusCode": 200,
  138. "text": {
  139. "id": "upstream-e2e-plan-file-compact-checkpoint-final",
  140. "inputTokens": 224,
  141. "outputTokens": 12,
  142. "text": "upstream-e2e-ok"
  143. }
  144. }
  145. },
  146. {
  147. "id": "upstream-plan-file-compact-summary-success",
  148. "description": "手动 /compact 成功的 streaming Anthropic-compatible 响应。",
  149. "metadata": {
  150. "kind": "main",
  151. "timingPolicy": "fast-text",
  152. "source": "synthetic",
  153. "syntheticReason": "本 case 关注 compact 后 plan_file_reference 重新注入;summary 文案只需稳定完成 compact。"
  154. },
  155. "maxMatches": 1,
  156. "match": {
  157. "method": "POST",
  158. "pathIncludes": "/messages",
  159. "bodyIncludes": [
  160. "CRITICAL: Respond with TEXT ONLY",
  161. "E2E_PLAN_FILE_COMPACT_PLAN_BODY",
  162. "E2E_PLAN_FILE_COMPACT_CHECKPOINT",
  163. "\"stream\":true"
  164. ],
  165. "bodyExcludes": ["Generate a concise title"]
  166. },
  167. "response": {
  168. "statusCode": 200,
  169. "statusMessage": "OK",
  170. "delayMs": 200,
  171. "text": {
  172. "id": "upstream-e2e-plan-file-compact-summary-success",
  173. "inputTokens": 256,
  174. "outputTokens": 64,
  175. "text": "<analysis>Manual compact summarized the approved plan and checkpoint turn.</analysis>\n\n<summary>The user approved E2E_PLAN_FILE_COMPACT_PLAN_BODY and then sent E2E_PLAN_FILE_COMPACT_CHECKPOINT before manual compact.</summary>"
  176. }
  177. }
  178. },
  179. {
  180. "id": "upstream-plan-file-compact-post-compact-final",
  181. "description": "compact 完成后的普通请求必须重新包含 plan_file_reference 与完整 plan marker。",
  182. "metadata": {
  183. "kind": "main",
  184. "timingPolicy": "fast-text",
  185. "source": "synthetic",
  186. "syntheticReason": "核心合同是 provider-visible 请求内容,回复文本只需稳定结束后续轮。"
  187. },
  188. "maxMatches": 1,
  189. "match": {
  190. "method": "POST",
  191. "pathIncludes": "/messages",
  192. "lastUserMessageIncludes": ["E2E_PLAN_FILE_COMPACT_AFTER"],
  193. "bodyIncludes": [
  194. "E2E_PLAN_FILE_COMPACT_AFTER",
  195. "A plan file exists from plan mode at:",
  196. "Plan contents:",
  197. ".zcode",
  198. "plans",
  199. "E2E_PLAN_FILE_COMPACT_PLAN_BODY",
  200. "If this plan is relevant to the current work and not already complete, continue working on it."
  201. ],
  202. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  203. },
  204. "response": {
  205. "statusCode": 200,
  206. "text": {
  207. "id": "upstream-e2e-plan-file-compact-post-compact-final",
  208. "inputTokens": 256,
  209. "outputTokens": 12,
  210. "text": "upstream-e2e-ok"
  211. }
  212. }
  213. }
  214. ]
  215. }