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

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