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.
…ate discovery The Windows localhost-TCP discovery path (PR kahliburke#54) let discover_sessions file-discover serve()-advertised localhost gates. Harden it so it can't regress the kahliburke#50 tokenless-double-connect class: - Apply the already-tracked/same-PID dedup to localhost TCP too (was gated !=:tcp), so a stable discovered gate isn't re-emitted as a 'restart' every cycle. - Resolve and attach the local auth token (env KAIMON_GATE_TOKEN / global config api key, mirroring connect_tcp!) for discovered localhost TCP gates, so an auth-required local gate authenticates instead of failing tokenless each cycle; ignored by a lax gate. Poll/reconnect markers (sid 'tcp-host-port') remain skipped, so the original kahliburke#50 path is untouched. Discovery/TCP tests: 83 pass.
|
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 |
|
Sorry for the delayed response. pr54-50-hardening tests pass on windows. I believe the branch is already based on 2.0-integration. Are you interested in setting up CI with a Windows server? |
|
I'm not sure what's going on with these merge conflicts. It seems there was Windows specific work different from what's in my PR. |
|
@mind6 Hey since you last did this the 2.0 release has happened, we've done a couple windows fixes along the way and will probably have some more. You should align your changes with the main branch now. |
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)