conversation-session-tool-input-validation-provider-content.json 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-tool-input-validation-provider-content",
  4. "spec": "./test/e2e/conversation-session/tools/conversation-session-tool-input-validation-provider-content.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "tool-input-validation-title",
  8. "description": "为本 case 的首轮 session title generation 提供固定辅助响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题生成与 tool input validation 无关,但必须独立收口,避免抢占或阻塞主链路 fixture。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "lastUserMessageIncludes": ["E2E_TOOL_INPUT_VALIDATION_PROVIDER_CONTENT"],
  20. "bodyIncludes": ["Generate a concise title"]
  21. },
  22. "response": {
  23. "statusCode": 200,
  24. "statusMessage": "OK",
  25. "headers": {
  26. "content-type": "application/json; charset=utf-8"
  27. },
  28. "body": "{\"id\":\"e2e-tool-input-validation-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"e2e-model\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Tool Input Validation E2E\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"output_tokens\":8}}"
  29. }
  30. },
  31. {
  32. "id": "tool-input-validation-malformed-call",
  33. "description": "首轮返回 malformed AskUserQuestion arguments,触发入参 JSON 无法解析的错误。",
  34. "metadata": {
  35. "kind": "main",
  36. "timingPolicy": "fast-text",
  37. "source": "synthetic",
  38. "syntheticReason": "常规 toolUse fixture 会 JSON.stringify input;必须使用 raw SSE 才能稳定覆盖 final tool-call malformed arguments。"
  39. },
  40. "maxMatches": 1,
  41. "match": {
  42. "method": "POST",
  43. "pathIncludes": "/messages",
  44. "lastUserMessageIncludes": ["E2E_TOOL_INPUT_VALIDATION_PROVIDER_CONTENT"],
  45. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  46. },
  47. "response": {
  48. "statusCode": 200,
  49. "headers": {
  50. "cache-control": "no-cache",
  51. "content-type": "text/event-stream; charset=utf-8"
  52. },
  53. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_tool_input_validation\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"e2e-model\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"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_e2e_tool_input_validation\",\"name\":\"AskUserQuestion\",\"input\":{}}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"not-json-E2E_TOOL_INPUT_VALIDATION_RAW_INPUT\"}}\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\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":16,\"service_tier\":\"standard\"}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  54. }
  55. },
  56. {
  57. "id": "tool-input-validation-live-continuation",
  58. "description": "入参 JSON 无法解析的精确 error tool_result 进入 live continuation 后固定收口。",
  59. "metadata": {
  60. "kind": "main",
  61. "timingPolicy": "fast-text",
  62. "source": "synthetic",
  63. "syntheticReason": "响应正文只用于稳定结束首轮;核心证据是请求中的归一化 tool_use 和精确 error tool_result。"
  64. },
  65. "maxMatches": 1,
  66. "match": {
  67. "method": "POST",
  68. "pathIncludes": "/messages",
  69. "lastUserMessageIncludes": [
  70. "<tool_use_error>InputValidationError: AskUserQuestion was called with input that could not be parsed as JSON.",
  71. "You sent (first 44 of 44 bytes): not-json-E2E_TOOL_INPUT_VALIDATION_RAW_INPUT"
  72. ],
  73. "bodyIncludes": [
  74. "E2E_TOOL_INPUT_VALIDATION_PROVIDER_CONTENT",
  75. "toolu_e2e_tool_input_validation"
  76. ],
  77. "bodyExcludes": [
  78. "The required parameter `questions` is missing",
  79. "Tool input failed inputSchema validation",
  80. "Generate a concise title",
  81. "CRITICAL: Respond with TEXT ONLY"
  82. ]
  83. },
  84. "response": {
  85. "statusCode": 200,
  86. "text": {
  87. "id": "e2e-tool-input-validation-live-final",
  88. "inputTokens": 192,
  89. "outputTokens": 12,
  90. "text": "E2E_TOOL_INPUT_VALIDATION_LIVE_OK"
  91. }
  92. }
  93. },
  94. {
  95. "id": "tool-input-validation-cold-followup",
  96. "description": "完整 CLI cold restart 后发送下一轮,固定回复用于捕获 hydration 后的 provider history。",
  97. "metadata": {
  98. "kind": "main",
  99. "timingPolicy": "fast-text",
  100. "source": "synthetic",
  101. "syntheticReason": "响应正文只用于稳定结束 cold follow-up;核心证据是历史 tool_result content 与 live continuation 字节一致。"
  102. },
  103. "maxMatches": 1,
  104. "match": {
  105. "method": "POST",
  106. "pathIncludes": "/messages",
  107. "lastUserMessageIncludes": ["E2E_TOOL_INPUT_VALIDATION_COLD_REPLAY"],
  108. "bodyIncludes": [
  109. "E2E_TOOL_INPUT_VALIDATION_PROVIDER_CONTENT",
  110. "toolu_e2e_tool_input_validation",
  111. "<tool_use_error>InputValidationError: AskUserQuestion was called with input that could not be parsed as JSON.",
  112. "You sent (first 44 of 44 bytes): not-json-E2E_TOOL_INPUT_VALIDATION_RAW_INPUT"
  113. ],
  114. "bodyExcludes": [
  115. "The required parameter `questions` is missing",
  116. "Tool input failed inputSchema validation",
  117. "Generate a concise title",
  118. "CRITICAL: Respond with TEXT ONLY"
  119. ]
  120. },
  121. "response": {
  122. "statusCode": 200,
  123. "text": {
  124. "id": "e2e-tool-input-validation-cold-final",
  125. "inputTokens": 224,
  126. "outputTokens": 12,
  127. "text": "E2E_TOOL_INPUT_VALIDATION_COLD_OK"
  128. }
  129. }
  130. }
  131. ]
  132. }