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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-tool-input-validation-provider-content",
  4. "spec": "./test/e2e/conversation-session/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,触发首次模型输入 schema failure。",
  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": [
  46. "Generate a concise title",
  47. "CRITICAL: Respond with TEXT ONLY"
  48. ]
  49. },
  50. "response": {
  51. "statusCode": 200,
  52. "headers": {
  53. "cache-control": "no-cache",
  54. "content-type": "text/event-stream; charset=utf-8"
  55. },
  56. "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_SHOULD_NOT_LEAK\"}}\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"
  57. }
  58. },
  59. {
  60. "id": "tool-input-validation-live-continuation",
  61. "description": "首次 schema failure 的精确 error tool_result 进入 live continuation 后固定收口。",
  62. "metadata": {
  63. "kind": "main",
  64. "timingPolicy": "fast-text",
  65. "source": "synthetic",
  66. "syntheticReason": "响应正文只用于稳定结束首轮;核心证据是请求中的归一化 tool_use 和精确 error tool_result。"
  67. },
  68. "maxMatches": 1,
  69. "match": {
  70. "method": "POST",
  71. "pathIncludes": "/messages",
  72. "lastUserMessageIncludes": [
  73. "<tool_use_error>InputValidationError: AskUserQuestion failed due to the following issue:",
  74. "The required parameter `questions` is missing</tool_use_error>"
  75. ],
  76. "bodyIncludes": [
  77. "E2E_TOOL_INPUT_VALIDATION_PROVIDER_CONTENT",
  78. "toolu_e2e_tool_input_validation"
  79. ],
  80. "bodyExcludes": [
  81. "E2E_TOOL_INPUT_VALIDATION_RAW_SHOULD_NOT_LEAK",
  82. "Tool input failed inputSchema validation",
  83. "Generate a concise title",
  84. "CRITICAL: Respond with TEXT ONLY"
  85. ]
  86. },
  87. "response": {
  88. "statusCode": 200,
  89. "text": {
  90. "id": "e2e-tool-input-validation-live-final",
  91. "inputTokens": 192,
  92. "outputTokens": 12,
  93. "text": "E2E_TOOL_INPUT_VALIDATION_LIVE_OK"
  94. }
  95. }
  96. },
  97. {
  98. "id": "tool-input-validation-cold-followup",
  99. "description": "完整 CLI cold restart 后发送下一轮,固定回复用于捕获 hydration 后的 provider history。",
  100. "metadata": {
  101. "kind": "main",
  102. "timingPolicy": "fast-text",
  103. "source": "synthetic",
  104. "syntheticReason": "响应正文只用于稳定结束 cold follow-up;核心证据是历史 tool_result content 与 live continuation 字节一致。"
  105. },
  106. "maxMatches": 1,
  107. "match": {
  108. "method": "POST",
  109. "pathIncludes": "/messages",
  110. "lastUserMessageIncludes": ["E2E_TOOL_INPUT_VALIDATION_COLD_REPLAY"],
  111. "bodyIncludes": [
  112. "E2E_TOOL_INPUT_VALIDATION_PROVIDER_CONTENT",
  113. "toolu_e2e_tool_input_validation",
  114. "<tool_use_error>InputValidationError: AskUserQuestion failed due to the following issue:",
  115. "The required parameter `questions` is missing</tool_use_error>"
  116. ],
  117. "bodyExcludes": [
  118. "E2E_TOOL_INPUT_VALIDATION_RAW_SHOULD_NOT_LEAK",
  119. "Tool input failed inputSchema validation",
  120. "Generate a concise title",
  121. "CRITICAL: Respond with TEXT ONLY"
  122. ]
  123. },
  124. "response": {
  125. "statusCode": 200,
  126. "text": {
  127. "id": "e2e-tool-input-validation-cold-final",
  128. "inputTokens": 224,
  129. "outputTokens": 12,
  130. "text": "E2E_TOOL_INPUT_VALIDATION_COLD_OK"
  131. }
  132. }
  133. }
  134. ]
  135. }