conversation-session-bash-read-state.json 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-bash-read-state",
  4. "spec": "./test/e2e/conversation-session/tools/conversation-session-bash-read-state.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-conversation-bash-read-state-title",
  8. "description": "Bash read-state case 的标题生成固定响应,避免严格 case-local replay 依赖 legacy provider-basic。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题生成不属于 Bash read-state 产品语义,只需要稳定返回,避免标题请求误命中主流程 fixture。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_BASH_READ_STATE"]
  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-bash-read-state-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Bash Read State E2E\\\"}\"}],\"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\"}}"
  27. }
  28. },
  29. {
  30. "id": "upstream-conversation-bash-read-state-cat-call",
  31. "description": "O08 首段响应:返回 Bash cat tool_use,制造 Bash read-state producer 输入。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "真实 provider 不一定稳定选择 Bash cat;本响应固定触发 Bash read-state producer,专门验证后续 Edit read-before-write guard。"
  37. },
  38. "maxMatches": 1,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "bodyIncludes": ["E2E_BASH_READ_STATE", "cat bash-read-state-e2e/target.txt"],
  43. "bodyExcludes": [
  44. "Generate a concise title",
  45. "CRITICAL: Respond with TEXT ONLY",
  46. "has been updated successfully",
  47. "Call Read before editing"
  48. ]
  49. },
  50. "response": {
  51. "statusCode": 200,
  52. "toolUse": {
  53. "id": "toolu_e2e_bash_read_state_cat",
  54. "messageId": "msg_e2e_bash_read_state_cat",
  55. "name": "Bash",
  56. "input": {
  57. "command": "cat bash-read-state-e2e/target.txt",
  58. "description": "Read target through Bash cat"
  59. }
  60. }
  61. }
  62. },
  63. {
  64. "id": "upstream-conversation-bash-read-state-edit-call",
  65. "description": "O08 第二段响应:Bash cat tool_result 进入历史后调用 Edit。",
  66. "metadata": {
  67. "kind": "main",
  68. "timingPolicy": "fast-text",
  69. "source": "synthetic",
  70. "syntheticReason": "该响应验证 Bash cat 已回填 read-state,使后续 Edit 不再触发未读 guard。"
  71. },
  72. "maxMatches": 1,
  73. "match": {
  74. "method": "POST",
  75. "pathIncludes": "/messages",
  76. "bodyIncludes": ["E2E_BASH_READ_STATE", "alpha", "beta"],
  77. "bodyExcludes": [
  78. "Generate a concise title",
  79. "CRITICAL: Respond with TEXT ONLY",
  80. "has been updated successfully",
  81. "Call Read before editing"
  82. ]
  83. },
  84. "response": {
  85. "statusCode": 200,
  86. "toolUse": {
  87. "id": "toolu_e2e_bash_read_state_edit",
  88. "messageId": "msg_e2e_bash_read_state_edit",
  89. "name": "Edit",
  90. "input": {
  91. "file_path": "bash-read-state-e2e/target.txt",
  92. "old_string": "alpha",
  93. "new_string": "gamma"
  94. }
  95. }
  96. }
  97. },
  98. {
  99. "id": "upstream-conversation-bash-read-state-format-call",
  100. "description": "O08 第三段响应:Edit 成功后运行 formatter Bash,制造 stale hint。",
  101. "metadata": {
  102. "kind": "main",
  103. "timingPolicy": "fast-text",
  104. "source": "synthetic",
  105. "syntheticReason": "该响应固定触发带 --fix marker 的 Bash 写类命令,验证已读文件被 Bash 改写后的 stale hint。"
  106. },
  107. "maxMatches": 1,
  108. "match": {
  109. "method": "POST",
  110. "pathIncludes": "/messages",
  111. "bodyIncludes": ["E2E_BASH_READ_STATE", "has been updated successfully"],
  112. "bodyExcludes": [
  113. "Generate a concise title",
  114. "CRITICAL: Respond with TEXT ONLY",
  115. "Call Read before editing"
  116. ]
  117. },
  118. "response": {
  119. "statusCode": 200,
  120. "toolUse": {
  121. "id": "toolu_e2e_bash_read_state_format",
  122. "messageId": "msg_e2e_bash_read_state_format",
  123. "name": "Bash",
  124. "input": {
  125. "command": "node bash-read-state-e2e/overwrite-target.mjs --fix",
  126. "description": "Rewrite the previously read target file"
  127. }
  128. }
  129. }
  130. },
  131. {
  132. "id": "upstream-conversation-bash-read-state-final",
  133. "description": "O08 最终回复:formatter Bash tool_result 后,provider-visible 历史必须包含 stale hint。",
  134. "metadata": {
  135. "kind": "main",
  136. "timingPolicy": "fast-text",
  137. "source": "synthetic",
  138. "syntheticReason": "该响应只在 stale hint 已进入 provider-visible 请求后结束 case,真实 provider 回复内容不影响产品语义。"
  139. },
  140. "maxMatches": 1,
  141. "match": {
  142. "method": "POST",
  143. "pathIncludes": "/messages",
  144. "bodyIncludes": ["E2E_BASH_READ_STATE", "formatted target", "Call Read before editing"],
  145. "bodyExcludes": [
  146. "Generate a concise title",
  147. "CRITICAL: Respond with TEXT ONLY",
  148. "File has not been read yet. Read it first before writing to it."
  149. ]
  150. },
  151. "response": {
  152. "statusCode": 200,
  153. "statusMessage": "OK",
  154. "text": {
  155. "id": "upstream-e2e-bash-read-state-final",
  156. "inputTokens": 240,
  157. "outputTokens": 12,
  158. "text": "upstream-e2e-ok"
  159. }
  160. }
  161. }
  162. ]
  163. }