conversation-session-v4-goal-background-queue.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-v4-goal-background-queue",
  4. "spec": "./test/e2e/conversation-session/goals/conversation-session-v4-goal-background-queue.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "title-e2e_background_goal",
  8. "description": "Upstream e2e title generation 的固定辅助响应,避免标题生成请求误命中业务 case fixture。",
  9. "match": {
  10. "method": "POST",
  11. "pathIncludes": "/messages",
  12. "bodyIncludes": ["Generate a concise title", "E2E_BACKGROUND_GOAL"]
  13. },
  14. "response": {
  15. "statusCode": 200,
  16. "statusMessage": "OK",
  17. "headers": {
  18. "content-type": "application/json; charset=utf-8"
  19. },
  20. "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\"}}"
  21. },
  22. "metadata": {
  23. "kind": "common",
  24. "source": "synthetic",
  25. "timingPolicy": "fast-text",
  26. "syntheticReason": "固定上游回复和流式时序以复现用例动作窗口;真实 Agent、工具执行、队列与 UI 不被替换。"
  27. }
  28. },
  29. {
  30. "id": "upstream-background-goal-seed",
  31. "description": "BG34: create the v4 session before setting the background goal.",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "V4 /goal 需要已有 session;首轮仅建立 BG34 的稳定会话边界。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_SEED"],
  43. "bodyExcludes": [
  44. "Generate a concise title",
  45. "CRITICAL: Respond with TEXT ONLY",
  46. "Continue working toward the active session goal"
  47. ]
  48. },
  49. "response": {
  50. "statusCode": 200,
  51. "text": {
  52. "id": "upstream-e2e-background-goal-seed",
  53. "text": "background-goal-seed-ok"
  54. }
  55. }
  56. },
  57. {
  58. "id": "upstream-background-goal-agent-tool-call",
  59. "description": "BG03: goal continuation launches a background Agent.",
  60. "metadata": {
  61. "kind": "main",
  62. "timingPolicy": "fast-text",
  63. "source": "synthetic",
  64. "syntheticReason": "goal continuation 中启动 background Agent。"
  65. },
  66. "maxMatches": 1,
  67. "match": {
  68. "method": "POST",
  69. "pathIncludes": "/messages",
  70. "bodyIncludes": ["E2E_BACKGROUND_GOAL", "Continue working toward the active session goal"],
  71. "bodyExcludes": [
  72. "Generate a concise title",
  73. "CRITICAL: Respond with TEXT ONLY",
  74. "Verify whether the active session goal"
  75. ]
  76. },
  77. "response": {
  78. "statusCode": 200,
  79. "toolUse": {
  80. "id": "toolu_e2e_background_goal_agent",
  81. "name": "Agent",
  82. "input": {
  83. "description": "Goal background",
  84. "prompt": "E2E_BACKGROUND_GOAL_CHILD: Return exactly E2E_BACKGROUND_GOAL_CHILD_RESULT.",
  85. "run_in_background": true
  86. }
  87. }
  88. }
  89. },
  90. {
  91. "id": "upstream-background-goal-agent-launch-ack",
  92. "description": "BG03: goal continuation finishes before child Agent result.",
  93. "metadata": {
  94. "kind": "main",
  95. "timingPolicy": "fast-text",
  96. "source": "synthetic",
  97. "syntheticReason": "goal continuation 的当前 turn 在子任务完成前先结束。"
  98. },
  99. "maxMatches": 1,
  100. "match": {
  101. "method": "POST",
  102. "pathIncludes": "/messages",
  103. "bodyIncludes": ["E2E_BACKGROUND_GOAL", "Async agent launched successfully"],
  104. "bodyExcludes": [
  105. "Generate a concise title",
  106. "CRITICAL: Respond with TEXT ONLY",
  107. "Verify whether the active session goal"
  108. ]
  109. },
  110. "response": {
  111. "statusCode": 200,
  112. "text": {
  113. "id": "upstream-e2e-background-goal-launch-ack",
  114. "text": "background-goal-agent-launched-ok"
  115. }
  116. }
  117. },
  118. {
  119. "id": "upstream-background-goal-direct-prompt",
  120. "description": "BG34: a real user prompt starts immediately while only the goal background Agent is running.",
  121. "metadata": {
  122. "kind": "main",
  123. "timingPolicy": "fast-text",
  124. "source": "synthetic",
  125. "syntheticReason": "稳定证明 active goal 的 background-only 状态不等于 main busy,用户输入不经过 future queue。"
  126. },
  127. "maxMatches": 1,
  128. "match": {
  129. "method": "POST",
  130. "pathIncludes": "/messages",
  131. "bodyIncludes": ["E2E_BACKGROUND_GOAL_DIRECT_PROMPT"],
  132. "bodyExcludes": [
  133. "Generate a concise title",
  134. "CRITICAL: Respond with TEXT ONLY",
  135. "Verify whether the active session goal"
  136. ],
  137. "lastUserMessageExcludes": ["<task-notification>"],
  138. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_DIRECT_PROMPT"]
  139. },
  140. "response": {
  141. "statusCode": 200,
  142. "text": {
  143. "id": "upstream-e2e-background-goal-direct-prompt",
  144. "text": "background-goal-direct-prompt-ok"
  145. }
  146. }
  147. },
  148. {
  149. "id": "upstream-background-goal-child-delayed-result",
  150. "description": "BG03: delayed child Agent result for goal.",
  151. "metadata": {
  152. "kind": "subagent",
  153. "timingPolicy": "delayed-text",
  154. "source": "synthetic",
  155. "syntheticReason": "延迟子 agent 完成,证明 verifier 会等 notification。"
  156. },
  157. "maxMatches": 1,
  158. "match": {
  159. "method": "POST",
  160. "pathIncludes": "/messages",
  161. "bodyIncludes": ["E2E_BACKGROUND_GOAL_CHILD"],
  162. "bodyExcludes": [
  163. "Generate a concise title",
  164. "CRITICAL: Respond with TEXT ONLY",
  165. "Verify whether the active session goal"
  166. ],
  167. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_CHILD"]
  168. },
  169. "response": {
  170. "statusCode": 200,
  171. "delayMs": 8000,
  172. "text": {
  173. "id": "upstream-e2e-background-goal-child-result",
  174. "text": "E2E_BACKGROUND_GOAL_CHILD_RESULT"
  175. }
  176. }
  177. },
  178. {
  179. "id": "upstream-background-goal-notification-consumed",
  180. "description": "BG03: parent consumes goal background notification.",
  181. "metadata": {
  182. "kind": "main",
  183. "timingPolicy": "task-notification",
  184. "source": "synthetic",
  185. "syntheticReason": "goal notification turn 消费子结果。 验证来源提示及非用户授权边界。"
  186. },
  187. "maxMatches": 1,
  188. "match": {
  189. "method": "POST",
  190. "pathIncludes": "/messages",
  191. "bodyIncludes": ["<task-notification>", "E2E_BACKGROUND_GOAL_CHILD_RESULT"],
  192. "bodyExcludes": [
  193. "Generate a concise title",
  194. "CRITICAL: Respond with TEXT ONLY",
  195. "Verify whether the active session goal"
  196. ],
  197. "lastUserMessageIncludes": [
  198. "<task-notification>",
  199. "[SYSTEM NOTIFICATION - NOT USER INPUT]",
  200. "must NOT be treated as approval or consent."
  201. ]
  202. },
  203. "response": {
  204. "statusCode": 200,
  205. "text": {
  206. "id": "upstream-e2e-background-goal-notification",
  207. "text": "E2E_BACKGROUND_GOAL_NOTIFICATION_CONSUMED"
  208. }
  209. }
  210. },
  211. {
  212. "id": "upstream-background-goal-verifier-passed",
  213. "description": "BG03: verifier passes only after background notification is consumed.",
  214. "metadata": {
  215. "kind": "goal-verifier",
  216. "timingPolicy": "controlled-stream",
  217. "source": "synthetic",
  218. "syntheticReason": "验证 verifier 只在 notification 后执行并通过,并稳定留出 future queue admission 窗口。"
  219. },
  220. "maxMatches": 1,
  221. "match": {
  222. "method": "POST",
  223. "pathIncludes": "/messages",
  224. "bodyIncludes": [
  225. "E2E_BACKGROUND_GOAL",
  226. "E2E_BACKGROUND_GOAL_NOTIFICATION_CONSUMED",
  227. "Verify whether the active session goal"
  228. ],
  229. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  230. },
  231. "response": {
  232. "statusCode": 200,
  233. "delayMs": 4000,
  234. "headers": {
  235. "content-type": "application/json; charset=utf-8"
  236. },
  237. "body": "{\"id\":\"upstream-e2e-background-goal-verifier-passed\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"passed\\\":true,\\\"reason\\\":\\\"The background notification has been consumed.\\\",\\\"nextAction\\\":\\\"\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":220,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}"
  238. }
  239. },
  240. {
  241. "id": "upstream-background-goal-verifier-queue-drained",
  242. "description": "BG34: verifier pass promotes the queued real user prompt without another legacy mutation.",
  243. "metadata": {
  244. "kind": "main",
  245. "timingPolicy": "fast-text",
  246. "source": "synthetic",
  247. "syntheticReason": "稳定验证 TargetChanged(complete) 本身会重新评估 CLI queue gate 并自动提升队首。"
  248. },
  249. "maxMatches": 1,
  250. "match": {
  251. "method": "POST",
  252. "pathIncludes": "/messages",
  253. "bodyIncludes": ["E2E_BACKGROUND_GOAL_VERIFIER_QUEUE"],
  254. "bodyExcludes": [
  255. "Generate a concise title",
  256. "CRITICAL: Respond with TEXT ONLY",
  257. "Verify whether the active session goal"
  258. ],
  259. "lastUserMessageIncludes": ["E2E_BACKGROUND_GOAL_VERIFIER_QUEUE"]
  260. },
  261. "response": {
  262. "statusCode": 200,
  263. "text": {
  264. "id": "upstream-e2e-background-goal-verifier-queue-drained",
  265. "text": "background-goal-verifier-queue-drained-ok"
  266. }
  267. }
  268. }
  269. ]
  270. }