diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b02116a0..b7cec813 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,10 +57,8 @@ jobs: os: [ubuntu-22.04] jdk: [24] include: - # FIXME - # Windows keep failing randomly because of CI issues. - # - os: windows-latest - # jdk: 24 + - os: windows-latest + jdk: 24 - os: macos-latest jdk: 24 steps: diff --git a/integration-test/integration/chat/anthropic_test.clj b/integration-test/integration/chat/anthropic_test.clj index da049a65..c124d687 100644 --- a/integration-test/integration/chat/anthropic_test.clj +++ b/integration-test/integration/chat/anthropic_test.clj @@ -230,7 +230,7 @@ :origin "native" :id "tool-1" :name "eca_directory_tree" - :argumentsText (str "h\":\"" (h/project-path->canon-path "resources") "\"}") + :argumentsText (str "h\":\"" (h/json-escape-path (h/project-path->canon-path "resources")) "\"}") :summary "Listing file tree"}) (match-content chat-id "system" {:type "usage" :sessionTokens 35 diff --git a/integration-test/integration/chat/commands_test.clj b/integration-test/integration/chat/commands_test.clj index 5aeb54bc..5a6cae33 100644 --- a/integration-test/integration/chat/commands_test.clj +++ b/integration-test/integration/chat/commands_test.clj @@ -63,8 +63,11 @@ (eca/request! (fixture/initialize-request {:initializationOptions (merge fixture/default-init-options {:mcpServers {"mcp-server-sample" - {:command "bash" - :args ["-c" (str "cd " h/mcp-server-sample-path " && clojure -M:server")]}}})})) + (if h/windows? + {:command "cmd.exe" + :args ["/c" (str "cd /d " h/mcp-server-sample-path " && clojure -M:server")]} + {:command "bash" + :args ["-c" (str "cd " h/mcp-server-sample-path " && clojure -M:server")]})}})})) (eca/notify! (fixture/initialized-notification)) (Thread/sleep 10000) ;; wait MCP server start TODO Improve this diff --git a/integration-test/integration/chat/openai_test.clj b/integration-test/integration/chat/openai_test.clj index 9679647f..8d637c59 100644 --- a/integration-test/integration/chat/openai_test.clj +++ b/integration-test/integration/chat/openai_test.clj @@ -275,7 +275,7 @@ {:type "function_call" :name "eca_directory_tree" :call_id "tool-1" - :arguments (str "{\"path\":\"" (h/project-path->canon-path "resources") "\"}")} + :arguments (str "{\"path\":\"" (h/json-escape-path (h/project-path->canon-path "resources")) "\"}")} {:type "function_call_output" :call_id "tool-1" :output (str (h/project-path->canon-path "resources") "\n" diff --git a/integration-test/integration/helper.clj b/integration-test/integration/helper.clj index 8f60ee5c..b6e10598 100644 --- a/integration-test/integration/helper.clj +++ b/integration-test/integration/helper.clj @@ -45,6 +45,12 @@ windows? (string/replace #"/([a-zA-Z]):/" "/$1%3A/"))) +(defn json-escape-path + "Escapes the filesystem PATH string for safe use in JSON and returns the + result." + [path] + (string/replace path "\\" "\\\\")) + (defn file->uri [file] (let [uri (-> file fs/canonicalize .toUri .toString)] (if *escape-uris?* diff --git a/integration-test/llm_mock/anthropic.clj b/integration-test/llm_mock/anthropic.clj index 7c277586..705504d4 100644 --- a/integration-test/llm_mock/anthropic.clj +++ b/integration-test/llm_mock/anthropic.clj @@ -180,7 +180,7 @@ {:type "content_block_delta" :index 2 :delta {:type "input_json_delta" - :partial_json (str "h\":\"" (h/project-path->canon-path "resources") "\"}")}}) + :partial_json (str "h\":\"" (h/json-escape-path (h/project-path->canon-path "resources")) "\"}")}}) ;; Finish the message indicating a tool_use stop so the client triggers tools (sse-send! ch "message_delta" {:type "message_delta"