Windows: full test suite + gate auto-discovery for local MCP#54
Conversation
- additional tcp path for tests - Scaled down number of open sockets in Windows. - fixes raw config paths by switching to JSON.json
Default serve() to TCP on Windows, write discoverable sock metadata for loopback gates, escape backslashes in session JSON, fix PID liveness checks, and align XDG_CACHE_HOME between gate and server. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
This test was taking over 10 minutes. Pulled out the database setup outside of @check, it currently finishes in under 15 seconds.
|
Thanks for this — the Windows end-to-end work is great, and the JSON-escaping fix in particular is a real bug squashed. I reviewed and tested it on macOS:
On the I did find two smaller refinements for the new localhost-TCP discovery path, which I've pushed as a single commit on top of your head on branch
+function _resolve_local_gate_token()
+ tok = get(ENV, "KAIMON_GATE_TOKEN", "")
+ isempty(tok) || return tok
+ try
+ config = load_global_config()
+ if config.mode != :lax && !isempty(config.api_keys)
+ return first(config.api_keys)
+ end
+ catch
+ end
+ return ""
+end
@@ discover_sessions, TCP branch @@
- if session_mode != :tcp && haskey(known_id_pids, session_id) && known_id_pids[session_id] == pid
+ if haskey(known_id_pids, session_id) && known_id_pids[session_id] == pid
continue
end
@@ conn construction @@
server_pubkey = server_pubkey,
+ auth_token = session_mode == :tcp ? _resolve_local_gate_token() : "",Those discovery/TCP testsets pass for me (83 total: stale-session, TCP auth, ephemeral+auth, poll backoff, PID refresh + localhost reaping). Since I can't validate Windows here: could you fold in |
Summary
Windows is now usable end-to-end: the full test suite passes, and a local gate REPL is discoverable by a Kaimon MCP server (including Cursor).
Tests (914 passing on Windows / Julia 1.12.6)
mode=:tcpinstead of unsupportedipc://EMFILEon Windows handle limitsJSON.json(...)so paths likeD:\Temp\...are not corruptedjulia -e sleep(...)instead of Unixsleeptest/Project.tomlforjulia --project=testProduction: Windows gate auto-discovery
serve()defaults to TCP on Windows; localhost gates write sock metadata for file-based discoveryproject_pathwas invalid JSON and got deleted on parse)_is_pid_aliveon Windows (psunavailable; trustuv_kill)discover_sessions(skiptcp-*poll bookkeeping only)XDG_CACHE_HOMEhandling between gate and server cache dirsManually verified operational flow
using Kaimon; Kaimon.KaimonGate.serve()→ bindstcp://127.0.0.1:<ephemeral>and writes%LOCALAPPDATA%\Kaimon\sock\<session>.jsonKaimon.start!()→ ConnectionManager discovers the gate from that sock dir~/.cursor/mcp.json→http://localhost:<port>/mcp(lax mode, no auth header)extool evaluates code in the connected gate REPL (e.g.df.dates[end]→2020-03-31)Test plan
julia --project=test test/runtests.jl— 914 passed on WindowsPkg.test()inlib/KaimonGate— passing (3 IPC-only tests skipped on Windows)serve()+start!(), metadata persists in sock dir, session visible to serverexreaches gate REPL (eval mirrored in host REPL)