conversation-session-background-subagent-rate-limit.json 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-background-subagent-rate-limit",
  4. "spec": "./test/e2e/conversation-session/conversation-session-background-subagent-rate-limit.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "background-subagent-rate-limit-title",
  8. "description": "background subagent rate limit case 的固定标题响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题生成不属于本 case,只需稳定返回以免误匹配业务 fixture。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_PARENT"]
  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-background-subagent-rate-limit-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Background Agent 429\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":125,\"cache_creation_input_tokens\":0,\"cache_read_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}"
  27. }
  28. },
  29. {
  30. "id": "background-subagent-rate-limit-parent-launch",
  31. "description": "父模型启动一个 background Agent。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-tool-use",
  35. "source": "synthetic",
  36. "syntheticReason": "稳定创建真实 Agent(run_in_background=true) 以覆盖 terminal notification 投影。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_PARENT"],
  43. "bodyIncludes": [
  44. "E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_PARENT",
  45. "E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_PARENT_DONE"
  46. ],
  47. "bodyExcludes": [
  48. "Async agent launched successfully",
  49. "Generate a concise title",
  50. "CRITICAL: Respond with TEXT ONLY"
  51. ]
  52. },
  53. "response": {
  54. "statusCode": 200,
  55. "toolUse": {
  56. "id": "toolu_e2e_background_subagent_rate_limit_agent",
  57. "name": "Agent",
  58. "input": {
  59. "description": "世界杯冠军预测分析",
  60. "prompt": "E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_CHILD: make one provider request; the replay server will return a stable 429.",
  61. "run_in_background": true,
  62. "subagent_type": "general-purpose"
  63. }
  64. }
  65. }
  66. },
  67. {
  68. "id": "background-subagent-rate-limit-parent-launch-ack",
  69. "description": "父模型在 background Agent launch ACK 后结束当前 turn。",
  70. "metadata": {
  71. "kind": "main",
  72. "timingPolicy": "fast-text",
  73. "source": "synthetic",
  74. "syntheticReason": "让父会话先回 idle,随后由 failed task notification 唤醒。"
  75. },
  76. "maxMatches": 1,
  77. "match": {
  78. "method": "POST",
  79. "pathIncludes": "/messages",
  80. "bodyIncludes": [
  81. "E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_PARENT",
  82. "Async agent launched successfully",
  83. "toolu_e2e_background_subagent_rate_limit_agent"
  84. ],
  85. "bodyExcludes": [
  86. "Generate a concise title",
  87. "CRITICAL: Respond with TEXT ONLY"
  88. ],
  89. "lastUserMessageExcludes": ["<task-notification>"]
  90. },
  91. "response": {
  92. "statusCode": 200,
  93. "text": {
  94. "id": "upstream-e2e-background-subagent-rate-limit-launch-ack",
  95. "text": "background-subagent-rate-limit-launched-ok"
  96. }
  97. }
  98. },
  99. {
  100. "id": "background-subagent-rate-limit-child-initial-429",
  101. "description": "child-only marker 的首个请求延迟返回 429,确保父 turn 先消费 launch ACK。",
  102. "metadata": {
  103. "kind": "subagent",
  104. "timingPolicy": "fault-stream",
  105. "source": "synthetic",
  106. "syntheticReason": "首个 429 延迟到父 turn 消费 launch ACK 后返回;BG26 worker 禁用模型 retry,只验证 terminal/UI/snapshot 的原始错误投影。"
  107. },
  108. "maxMatches": 1,
  109. "match": {
  110. "method": "POST",
  111. "pathIncludes": "/messages",
  112. "lastUserMessageIncludes": ["E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_CHILD"],
  113. "bodyIncludes": ["E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_CHILD"],
  114. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  115. },
  116. "response": {
  117. "statusCode": 429,
  118. "statusMessage": "Too Many Requests",
  119. "delayMs": 1500,
  120. "headers": {
  121. "content-type": "application/json; charset=utf-8",
  122. "retry-after": "0"
  123. },
  124. "body": "{\"error\":{\"code\":\"AccountRateLimitExceeded\",\"message\":\"Requests are too frequent. Please reduce your request frequency, wait a short moment, and retry your request. Request id: e2e-background-subagent-rate-limit\",\"param\":null,\"type\":\"TooManyRequests\"}}"
  125. }
  126. },
  127. {
  128. "id": "background-subagent-rate-limit-parent-notification",
  129. "description": "父模型消费 failed background Agent notification。",
  130. "metadata": {
  131. "kind": "main",
  132. "timingPolicy": "task-notification",
  133. "source": "synthetic",
  134. "syntheticReason": "证明 failed notification 经 runtime command queue 回到父模型并正常收口。"
  135. },
  136. "maxMatches": 1,
  137. "match": {
  138. "method": "POST",
  139. "pathIncludes": "/messages",
  140. "lastUserMessageIncludes": ["<task-notification>", "<status>failed</status>"],
  141. "bodyIncludes": [
  142. "E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_PARENT",
  143. "<tool-use-id>toolu_e2e_background_subagent_rate_limit_agent</tool-use-id>",
  144. "<status>failed</status>"
  145. ],
  146. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  147. },
  148. "response": {
  149. "statusCode": 200,
  150. "text": {
  151. "id": "upstream-e2e-background-subagent-rate-limit-parent-done",
  152. "text": "E2E_BACKGROUND_SUBAGENT_RATE_LIMIT_PARENT_DONE"
  153. }
  154. }
  155. }
  156. ]
  157. }