conversation-session-memory.json 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-memory",
  4. "spec": "./test/e2e/conversation-session/context/conversation-session-memory.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "memory-window-title",
  8. "description": "Memory WDIO 五个 session 的稳定标题响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题不属于 Memory 验收,只用于避免标题 sidecar 干扰 case-local replay。"
  14. },
  15. "maxMatches": 5,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["Generate a concise title", "E2E_MEMORY_WDIO_"]
  20. },
  21. "response": {
  22. "statusCode": 200,
  23. "headers": { "content-type": "application/json; charset=utf-8" },
  24. "body": "{\"id\":\"msg_memory_window_title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Memory WDIO E2E\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"output_tokens\":8}}"
  25. }
  26. },
  27. {
  28. "id": "memory-window-default-branch-boundary",
  29. "description": "默认 Memory 分支的 Main 首请求返回只读 Bash,形成 continuation。",
  30. "metadata": {
  31. "kind": "main",
  32. "timingPolicy": "controlled-tool-use",
  33. "source": "synthetic",
  34. "syntheticReason": "固定真实工具边界,验证默认分支在 continuation 中仍保留 Main Memory 且不启动 Selector。"
  35. },
  36. "maxMatches": 1,
  37. "match": {
  38. "method": "POST",
  39. "pathIncludes": "/messages",
  40. "lastUserMessageIncludes": ["E2E_MEMORY_WDIO_DEFAULT_BRANCH"],
  41. "bodyIncludes": [
  42. "# Memory\n",
  43. "After writing the file, add a one-line pointer in `MEMORY.md` (`- [Title](file.md) — hook`).",
  44. "MEMORY.md (user's auto-memory, persists across conversations):",
  45. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases",
  46. "E2E_MEMORY_WDIO_DEFAULT_BRANCH"
  47. ],
  48. "bodyExcludes": [
  49. "You are selecting memories that will be useful",
  50. "Retrieved for possible relevance",
  51. "Generate a concise title"
  52. ]
  53. },
  54. "response": {
  55. "statusCode": 200,
  56. "delayMs": 100,
  57. "toolUse": {
  58. "id": "memory_default_branch_boundary",
  59. "name": "Bash",
  60. "input": { "command": "pwd", "description": "Confirm workspace" }
  61. }
  62. }
  63. },
  64. {
  65. "id": "memory-window-default-branch-final",
  66. "description": "默认 Memory 分支 tool continuation 的前台可见回复。",
  67. "metadata": {
  68. "kind": "main",
  69. "timingPolicy": "fast-text",
  70. "source": "synthetic",
  71. "syntheticReason": "稳定结束默认分支工具轮并提供 UI 终态 marker。"
  72. },
  73. "maxMatches": 1,
  74. "match": {
  75. "method": "POST",
  76. "pathIncludes": "/messages",
  77. "bodyIncludes": [
  78. "# Memory\n",
  79. "MEMORY.md (user's auto-memory, persists across conversations):",
  80. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases",
  81. "E2E_MEMORY_WDIO_DEFAULT_BRANCH",
  82. "memory_default_branch_boundary"
  83. ],
  84. "bodyExcludes": ["Generate a concise title"]
  85. },
  86. "response": {
  87. "statusCode": 200,
  88. "text": {
  89. "id": "msg_memory_window_default_branch_done",
  90. "text": "E2E_MEMORY_WDIO_DEFAULT_BRANCH_DONE"
  91. }
  92. }
  93. },
  94. {
  95. "id": "memory-window-extraction-main",
  96. "description": "第二个 Main turn 正常结束,随后触发后台 Extraction。",
  97. "metadata": {
  98. "kind": "main",
  99. "timingPolicy": "fast-text",
  100. "source": "synthetic",
  101. "syntheticReason": "该 turn 不直接写 Memory,用于稳定触发既有 Extraction scheduler。"
  102. },
  103. "maxMatches": 1,
  104. "match": {
  105. "method": "POST",
  106. "pathIncludes": "/messages",
  107. "lastUserMessageIncludes": ["E2E_MEMORY_WDIO_EXTRACTION"],
  108. "bodyIncludes": [
  109. "E2E_MEMORY_WDIO_EXTRACTION",
  110. "# Memory\n",
  111. "MEMORY.md (user's auto-memory, persists across conversations):",
  112. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases"
  113. ],
  114. "bodyExcludes": [
  115. "You are now acting as the memory extraction subagent",
  116. "Generate a concise title"
  117. ]
  118. },
  119. "response": {
  120. "statusCode": 200,
  121. "text": {
  122. "id": "msg_memory_window_extraction_main",
  123. "text": "E2E_MEMORY_WDIO_EXTRACTION_DONE"
  124. }
  125. }
  126. },
  127. {
  128. "id": "memory-window-extraction-write",
  129. "description": "后台 Memory Agent 写入 deployment policy,并读取现有 MEMORY.md。",
  130. "metadata": {
  131. "kind": "main",
  132. "timingPolicy": "fast-tool-use",
  133. "source": "synthetic",
  134. "syntheticReason": "generateText 非流式响应固定返回事实 Write 与索引 Read,验证 scheduler、受限执行面和落盘。"
  135. },
  136. "maxMatches": 1,
  137. "match": {
  138. "method": "POST",
  139. "pathIncludes": "/messages",
  140. "bodyIncludes": [
  141. "You are now acting as the memory extraction subagent",
  142. "E2E_MEMORY_WDIO_EXTRACTION"
  143. ],
  144. "bodyExcludes": ["E2E_MEMORY_WDIO_EXTRACTION_FILE"]
  145. },
  146. "response": {
  147. "statusCode": 200,
  148. "headers": { "content-type": "application/json; charset=utf-8" },
  149. "body": "{\"id\":\"msg_memory_window_extraction_write\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"tool_use\",\"id\":\"toolu_e2e_memory_extraction_write\",\"name\":\"Write\",\"input\":{\"file_path\":\"{{memoryRoot}}/deployment-approval-policy.md\",\"content\":\"---\\nname: deployment-approval-policy\\ndescription: Deployment requires staging approval for an audit trail.\\nmetadata:\\n type: project\\n---\\n\\nDeployment requires staging approval. E2E_MEMORY_WDIO_EXTRACTION_FILE\\n\\n**Why:** Release managers need an audit trail.\\n\\n**How to apply:** Require staging approval before deployment.\\n\"}},{\"type\":\"tool_use\",\"id\":\"toolu_e2e_memory_extraction_index_read\",\"name\":\"Read\",\"input\":{\"file_path\":\"{{memoryRoot}}/MEMORY.md\"}}],\"stop_reason\":\"tool_use\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":96,\"output_tokens\":32}}"
  150. }
  151. },
  152. {
  153. "id": "memory-window-extraction-index-edit",
  154. "description": "后台 Memory Agent 将新事实 pointer 追加到已读取的 MEMORY.md。",
  155. "metadata": {
  156. "kind": "main",
  157. "timingPolicy": "fast-tool-use",
  158. "source": "synthetic",
  159. "syntheticReason": "固定 Edit 已读取的 MEMORY.md,验证 Extraction 维护默认分支消费所需 pointer。"
  160. },
  161. "maxMatches": 1,
  162. "match": {
  163. "method": "POST",
  164. "pathIncludes": "/messages",
  165. "bodyIncludes": [
  166. "You are now acting as the memory extraction subagent",
  167. "toolu_e2e_memory_extraction_write",
  168. "toolu_e2e_memory_extraction_index_read",
  169. "E2E_MEMORY_WDIO_EXTRACTION_FILE",
  170. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases"
  171. ],
  172. "bodyExcludes": [
  173. "- [Deployment approval policy](deployment-approval-policy.md) — staging approval required"
  174. ]
  175. },
  176. "response": {
  177. "statusCode": 200,
  178. "headers": { "content-type": "application/json; charset=utf-8" },
  179. "body": "{\"id\":\"msg_memory_window_extraction_index_edit\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"tool_use\",\"id\":\"toolu_e2e_memory_extraction_index_edit\",\"name\":\"Edit\",\"input\":{\"file_path\":\"{{memoryRoot}}/MEMORY.md\",\"old_string\":\"- [Database test policy](database-test-policy.md) — integration tests use isolated databases\\n\",\"new_string\":\"- [Database test policy](database-test-policy.md) — integration tests use isolated databases\\n- [Deployment approval policy](deployment-approval-policy.md) — staging approval required\\n\"}}],\"stop_reason\":\"tool_use\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":96,\"output_tokens\":24}}"
  180. }
  181. },
  182. {
  183. "id": "memory-window-extraction-final",
  184. "description": "Extraction 事实与索引更新完成后结束 Memory Agent loop。",
  185. "metadata": {
  186. "kind": "main",
  187. "timingPolicy": "fast-text",
  188. "source": "synthetic",
  189. "syntheticReason": "稳定结束后台 loop,不扩展额外 Memory 行为。"
  190. },
  191. "maxMatches": 1,
  192. "match": {
  193. "method": "POST",
  194. "pathIncludes": "/messages",
  195. "bodyIncludes": [
  196. "You are now acting as the memory extraction subagent",
  197. "toolu_e2e_memory_extraction_index_edit",
  198. "E2E_MEMORY_WDIO_EXTRACTION_FILE",
  199. "- [Deployment approval policy](deployment-approval-policy.md) — staging approval required"
  200. ]
  201. },
  202. "response": {
  203. "statusCode": 200,
  204. "headers": { "content-type": "application/json; charset=utf-8" },
  205. "body": "{\"id\":\"msg_memory_window_extraction_final\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"Nothing to save.\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":64,\"output_tokens\":4}}"
  206. }
  207. },
  208. {
  209. "id": "memory-window-extracted-default-main",
  210. "description": "新 session 从默认 MEMORY.md source 消费 Extraction 新 pointer,不启动 Selector。",
  211. "metadata": {
  212. "kind": "main",
  213. "timingPolicy": "fast-text",
  214. "source": "synthetic",
  215. "syntheticReason": "稳定证明新 session 从默认 MEMORY.md source 消费 Extraction 新 pointer,并由全局默认分支阻止 Selector。"
  216. },
  217. "maxMatches": 1,
  218. "match": {
  219. "method": "POST",
  220. "pathIncludes": "/messages",
  221. "lastUserMessageIncludes": ["E2E_MEMORY_WDIO_EXTRACTED_DEFAULT"],
  222. "bodyIncludes": [
  223. "# Memory\n",
  224. "E2E_MEMORY_WDIO_EXTRACTED_DEFAULT",
  225. "MEMORY.md (user's auto-memory, persists across conversations):",
  226. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases",
  227. "- [Deployment approval policy](deployment-approval-policy.md) — staging approval required"
  228. ],
  229. "bodyExcludes": [
  230. "You are selecting memories that will be useful",
  231. "Retrieved for possible relevance",
  232. "Generate a concise title"
  233. ]
  234. },
  235. "response": {
  236. "statusCode": 200,
  237. "text": {
  238. "id": "msg_memory_window_extracted_default_done",
  239. "text": "E2E_MEMORY_WDIO_EXTRACTED_DEFAULT_DONE"
  240. }
  241. }
  242. },
  243. {
  244. "id": "memory-window-custom-parent-agent",
  245. "description": "父 Main 调用声明 project Memory 的 custom agent。",
  246. "metadata": {
  247. "kind": "main",
  248. "timingPolicy": "fast-tool-use",
  249. "source": "synthetic",
  250. "syntheticReason": "稳定选择已 seed 的 custom profile。"
  251. },
  252. "maxMatches": 1,
  253. "match": {
  254. "method": "POST",
  255. "pathIncludes": "/messages",
  256. "lastUserMessageIncludes": ["E2E_MEMORY_WDIO_CUSTOM"],
  257. "bodyIncludes": [
  258. "E2E_MEMORY_WDIO_CUSTOM",
  259. "# Memory\n",
  260. "MEMORY.md (user's auto-memory, persists across conversations):",
  261. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases"
  262. ],
  263. "bodyExcludes": [
  264. "# Persistent Agent Memory",
  265. "You are now acting as the memory extraction subagent",
  266. "Generate a concise title"
  267. ]
  268. },
  269. "response": {
  270. "statusCode": 200,
  271. "toolUse": {
  272. "id": "toolu_e2e_memory_custom_agent",
  273. "name": "Agent",
  274. "input": {
  275. "description": "Persist review convention",
  276. "prompt": "E2E_MEMORY_WDIO_CUSTOM_CHILD store the review convention in persistent project memory.",
  277. "subagent_type": "memory-window-curator"
  278. }
  279. }
  280. }
  281. },
  282. {
  283. "id": "memory-window-custom-child-write",
  284. "description": "custom child 收到 Persistent Agent Memory prompt 并写入自己的 project scope。",
  285. "metadata": {
  286. "kind": "main",
  287. "timingPolicy": "fast-tool-use",
  288. "source": "synthetic",
  289. "syntheticReason": "固定 Write 以验证 prompt、tool projection、scope root 和 originSessionId。"
  290. },
  291. "maxMatches": 1,
  292. "match": {
  293. "method": "POST",
  294. "pathIncludes": "/messages",
  295. "bodyIncludes": [
  296. "E2E_MEMORY_WDIO_CUSTOM_CHILD",
  297. "# Persistent Agent Memory",
  298. "Keep review findings evidence-first"
  299. ],
  300. "bodyExcludes": ["E2E_MEMORY_WDIO_CUSTOM_FILE"]
  301. },
  302. "response": {
  303. "statusCode": 200,
  304. "toolUse": {
  305. "id": "toolu_e2e_memory_custom_write",
  306. "name": "Write",
  307. "input": {
  308. "file_path": ".zcode/agent-memory/memory-window-curator/review-convention.md",
  309. "content": "---\nname: review-convention\ndescription: Review findings should be grounded in first-hand evidence.\nmetadata:\n type: feedback\n---\n\nGround review findings in first-hand evidence. E2E_MEMORY_WDIO_CUSTOM_FILE\n\n**Why:** It prevents speculative defects.\n\n**How to apply:** Reproduce or inspect the active path before reporting a finding.\n"
  310. }
  311. }
  312. }
  313. },
  314. {
  315. "id": "memory-window-custom-child-final",
  316. "description": "custom child 写入后完成。",
  317. "metadata": {
  318. "kind": "main",
  319. "timingPolicy": "fast-text",
  320. "source": "synthetic",
  321. "syntheticReason": "稳定结束 child tool loop。"
  322. },
  323. "maxMatches": 1,
  324. "match": {
  325. "method": "POST",
  326. "pathIncludes": "/messages",
  327. "bodyIncludes": [
  328. "# Persistent Agent Memory",
  329. "toolu_e2e_memory_custom_write",
  330. "E2E_MEMORY_WDIO_CUSTOM_FILE"
  331. ]
  332. },
  333. "response": {
  334. "statusCode": 200,
  335. "text": {
  336. "id": "msg_memory_window_custom_child_final",
  337. "text": "E2E_MEMORY_WDIO_CUSTOM_CHILD_DONE"
  338. }
  339. }
  340. },
  341. {
  342. "id": "memory-window-custom-parent-final",
  343. "description": "父 Main 消费 child 结果并在窗口显示完成 marker。",
  344. "metadata": {
  345. "kind": "main",
  346. "timingPolicy": "fast-text",
  347. "source": "synthetic",
  348. "syntheticReason": "稳定结束父 Agent tool turn并提供 UI 终态。"
  349. },
  350. "maxMatches": 1,
  351. "match": {
  352. "method": "POST",
  353. "pathIncludes": "/messages",
  354. "bodyIncludes": [
  355. "# Memory\n",
  356. "MEMORY.md (user's auto-memory, persists across conversations):",
  357. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases",
  358. "E2E_MEMORY_WDIO_CUSTOM",
  359. "toolu_e2e_memory_custom_agent",
  360. "E2E_MEMORY_WDIO_CUSTOM_CHILD_DONE"
  361. ],
  362. "bodyExcludes": ["You are now acting as the memory extraction subagent"]
  363. },
  364. "response": {
  365. "statusCode": 200,
  366. "text": { "id": "msg_memory_window_custom_done", "text": "E2E_MEMORY_WDIO_CUSTOM_DONE" }
  367. }
  368. },
  369. {
  370. "id": "memory-window-custom-extraction-noop",
  371. "description": "custom parent 成功 turn 后的 project Extraction 明确 no-op。",
  372. "metadata": {
  373. "kind": "main",
  374. "timingPolicy": "fast-text",
  375. "source": "synthetic",
  376. "syntheticReason": "保持既有成功 Main turn 的 Extraction 调度,但不为此 case 新增 project fact。"
  377. },
  378. "maxMatches": 1,
  379. "match": {
  380. "method": "POST",
  381. "pathIncludes": "/messages",
  382. "bodyIncludes": [
  383. "You are now acting as the memory extraction subagent",
  384. "E2E_MEMORY_WDIO_CUSTOM"
  385. ]
  386. },
  387. "response": {
  388. "statusCode": 200,
  389. "headers": { "content-type": "application/json; charset=utf-8" },
  390. "body": "{\"id\":\"msg_memory_window_custom_extraction_noop\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"Nothing to save.\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":64,\"output_tokens\":4}}"
  391. }
  392. },
  393. {
  394. "id": "memory-window-active-after-disable",
  395. "description": "Settings 关闭后当前 Session 仍保留创建时的 Memory 配置。",
  396. "metadata": {
  397. "kind": "main",
  398. "timingPolicy": "fast-text",
  399. "source": "synthetic",
  400. "syntheticReason": "设置关闭后继续当前 Session,确认已冻结 Runtime 不热更新。"
  401. },
  402. "maxMatches": 1,
  403. "match": {
  404. "method": "POST",
  405. "pathIncludes": "/messages",
  406. "lastUserMessageIncludes": ["E2E_MEMORY_WDIO_ACTIVE_AFTER_DISABLE"],
  407. "bodyIncludes": [
  408. "E2E_MEMORY_WDIO_ACTIVE_AFTER_DISABLE",
  409. "# Memory\n",
  410. "MEMORY.md (user's auto-memory, persists across conversations):",
  411. "- [Database test policy](database-test-policy.md) — integration tests use isolated databases"
  412. ],
  413. "bodyExcludes": [
  414. "You are selecting memories that will be useful",
  415. "You are now acting as the memory extraction subagent",
  416. "Generate a concise title"
  417. ]
  418. },
  419. "response": {
  420. "statusCode": 200,
  421. "text": {
  422. "id": "msg_memory_window_active_after_disable",
  423. "text": "E2E_MEMORY_WDIO_ACTIVE_AFTER_DISABLE_DONE"
  424. }
  425. }
  426. },
  427. {
  428. "id": "memory-window-disabled-main",
  429. "description": "新 Session 在 Settings 关闭 Memory 时保持普通 Main 请求。",
  430. "metadata": {
  431. "kind": "main",
  432. "timingPolicy": "fast-text",
  433. "source": "synthetic",
  434. "syntheticReason": "稳定提供 Settings disabled gate 的 UI 终态;matcher 同时拒绝任何 Memory prompt。"
  435. },
  436. "maxMatches": 2,
  437. "match": {
  438. "method": "POST",
  439. "pathIncludes": "/messages",
  440. "lastUserMessageIncludes": ["E2E_MEMORY_WDIO_DISABLED"],
  441. "bodyIncludes": ["E2E_MEMORY_WDIO_DISABLED"],
  442. "bodyExcludes": [
  443. "# Memory\n",
  444. "# Persistent Agent Memory",
  445. "user's auto-memory, persists across conversations",
  446. "You are selecting memories that will be useful",
  447. "You are now acting as the memory extraction subagent",
  448. "Generate a concise title"
  449. ]
  450. },
  451. "response": {
  452. "statusCode": 200,
  453. "text": { "id": "msg_memory_window_disabled", "text": "E2E_MEMORY_WDIO_DISABLED_DONE" }
  454. }
  455. }
  456. ]
  457. }