conversation-session-v4-background-work.json 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-v4-background-work",
  4. "spec": "./test/e2e/conversation-session/background/conversation-session-v4-background-work.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "v4-background-work-title",
  8. "description": "E2E_V4_BGWORK 首发的 case-local 标题生成响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "E2E_V4_BGWORK 首发会触发默认 title sidecar;固定 case-local 标题响应,避免 default replay 回退 legacy provider-basic,并用该首发 marker 隔离跨 case 匹配。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_V4_BGWORK"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "text": {
  23. "id": "v4-background-work-title",
  24. "inputTokens": 64,
  25. "outputTokens": 8,
  26. "text": "{\"title\":\"V4 Background Work E2E\"}"
  27. }
  28. }
  29. },
  30. {
  31. "id": "v4-bgwork-toolcall",
  32. "description": "M4 cancelBackgroundWork 门禁:首轮返回 run_in_background 的 Bash tool_use(长 sleep),形成可取消的后台工作。",
  33. "metadata": {
  34. "kind": "main",
  35. "timingPolicy": "fast-text",
  36. "source": "synthetic",
  37. "syntheticReason": "需要稳定产出一个 run_in_background 的后台 bash 任务以断言后台工作面板 + 取消。"
  38. },
  39. "maxMatches": 1,
  40. "match": {
  41. "method": "POST",
  42. "pathIncludes": "/messages",
  43. "lastUserMessageIncludes": ["E2E_V4_BGWORK"],
  44. "bodyExcludes": [
  45. "Generate a concise title",
  46. "CRITICAL: Respond with TEXT ONLY",
  47. "Command running in background"
  48. ]
  49. },
  50. "response": {
  51. "statusCode": 200,
  52. "statusMessage": "OK",
  53. "headers": {
  54. "cache-control": "no-cache",
  55. "content-type": "text/event-stream; charset=utf-8"
  56. },
  57. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"v4-bgwork-toolcall\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":96,\"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\":\"tool_use\",\"id\":\"toolu_v4_bgwork\",\"name\":\"Bash\",\"input\":{}}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"command\\\":\\\"sleep 300\\\",\\\"run_in_background\\\":true,\\\"description\\\":\\\"E2E_V4_BGWORK sleep\\\"}\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":96,\"output_tokens\":24,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  58. }
  59. },
  60. {
  61. "id": "v4-bgwork-final",
  62. "description": "M4 后台任务 backgrounded 后的 tool_result 跟进回复(固定文本)。",
  63. "metadata": {
  64. "kind": "main",
  65. "timingPolicy": "fast-text",
  66. "source": "synthetic",
  67. "syntheticReason": "后台任务已分离,主轮只需固定收尾文本;核心断言在后台工作面板 + 取消。"
  68. },
  69. "maxMatches": 1,
  70. "match": {
  71. "method": "POST",
  72. "pathIncludes": "/messages",
  73. "bodyIncludes": ["E2E_V4_BGWORK", "Command running in background"],
  74. "bodyExcludes": [
  75. "Generate a concise title",
  76. "CRITICAL: Respond with TEXT ONLY",
  77. "SYSTEM NOTIFICATION"
  78. ]
  79. },
  80. "response": {
  81. "statusCode": 200,
  82. "text": {
  83. "id": "v4-bgwork-final",
  84. "inputTokens": 120,
  85. "outputTokens": 6,
  86. "text": "V4_BGWORK_STARTED_OK"
  87. }
  88. }
  89. },
  90. {
  91. "id": "v4-bgwork-cancel-notification",
  92. "description": "取消后台 Bash 后 CLI 自动投递的 background-task 完成通知请求;固定响应,避免 strict 回放把正常通知记为 gap。",
  93. "metadata": {
  94. "kind": "main",
  95. "timingPolicy": "fast-text",
  96. "source": "synthetic",
  97. "syntheticReason": "取消是 case 的最后一个动作;通知请求不属于产品断言,只需稳定收口,不能回真实 provider。"
  98. },
  99. "maxMatches": 1,
  100. "match": {
  101. "method": "POST",
  102. "pathIncludes": "/messages",
  103. "bodyIncludes": [
  104. "E2E_V4_BGWORK",
  105. "<task-notification>",
  106. "<tool-use-id>toolu_v4_bgwork</tool-use-id>",
  107. "<status>killed</status>"
  108. ],
  109. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  110. },
  111. "response": {
  112. "statusCode": 200,
  113. "text": {
  114. "id": "v4-bgwork-cancel-notification",
  115. "inputTokens": 120,
  116. "outputTokens": 6,
  117. "text": "V4_BGWORK_CANCEL_NOTED"
  118. }
  119. }
  120. }
  121. ]
  122. }