Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

docs: record how Windows checks run in the test VM

leepokai2b81c8fd944b
diff --git a/docs/README.md b/docs/README.md
index 9b3306a4..aa638c38 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -57,6 +57,7 @@ Source review, a passing build, local integration tests and production acceptanc
Production signals (PostHog errors, failed turns) traced to a root cause, newest first. Dated
records: the fixes they name have shipped or are listed as open.
+- [Claude reported signed in on Windows while signed out, 2026-10-20](investigations/windows-claude-sign-in-2026-10-20.md)
- [PostHog error triage, 2026-10-19](investigations/posthog-errors-2026-10-19.md): host panics, desktop and iPhone crashes, failed Claude turns
- [npm agents failing to start on Windows, 2026-10-14](investigations/windows-npm-agents-2026-10-14.md)
diff --git a/docs/guides/windows-testing.md b/docs/guides/windows-testing.md
index 25294321..d483ba68 100644
--- a/docs/guides/windows-testing.md
+++ b/docs/guides/windows-testing.md
@@ -3,7 +3,8 @@
Codync ships an x64 Windows app (Electron + the bundled `codync-host.exe`). Real Windows behavior is
checked in a UTM virtual machine on the Mac. Everyday end-to-end checks stay on the Mac (minimal
e2e); use the VM for a full e2e, or when a change or a bug depends on Windows itself (paths,
-`cmd.exe`, `.cmd` shims, the service).
+`cmd.exe`, `.cmd` shims, the service, timing). The VM slows the whole Mac down: start it for the
+check and stop it as soon as the check is done.
## The VM
@@ -13,49 +14,203 @@ e2e); use the VM for a full e2e, or when a change or a bug depends on Windows it
`osascript -e 'tell application "UTM" to start virtual machine named "Codync Windows"'`
(`stop … by force` only when a normal stop hangs; `query ip of …` works). `utmctl` fails with
OSStatus -10004. Pressing UTM's Run button through accessibility crashed UTM once; if UTM is in a
- bad state, quit it and reopen it in the background with `open -g -a UTM`.
+ bad state, quit it and reopen it in the background with `open -g -a UTM`. After stopping, end
+ leftover sessions with `pkill -f "ssh codync-win"`.
- **Shell**: `ssh codync-win` (PowerShell). The `~/.ssh/config` alias points at `192.168.64.4` with
- the key `~/.ssh/codync_windows_vm`.
+ the key `~/.ssh/codync_windows_vm`. SSH is up a minute or two after start:
+ `until ssh -o ConnectTimeout=5 -o BatchMode=yes codync-win 'echo up'; do sleep 10; done`.
- **GUI apps** must start in the signed-in session (session 2):
`schtasks /create /tn X /tr <exe> /sc once /st 23:59 /it /f; schtasks /run /tn X`.
- **Screen** without touching the Mac's UI: QEMU VNC on `127.0.0.1:5905`, e.g.
`uvx --from vncdotool vncdo --force-caps -s 127.0.0.1::5905 capture x.png`. Input lags a few
seconds; `--force-caps` is needed for symbols.
+- **Network**: the VM's internet is slow and drops connections (2026-10-20: a 4.4 MB npm tarball
+ took 27 s in the VM and 0.3 s on the Mac, about 165 KB/s; a 130 MB `Invoke-WebRequest` download
+ stopped at 45 MB without an error). Download large files on the Mac and `scp` them in.
- The Mac sleeping pauses the VM: wrap long installs in `caffeinate -i`.
- Rebuilding the VM: the unattended install assets live in `~/VMs/codync-windows/` (about 20
minutes). NVMe must be the first drive and both ISOs detached afterwards, or Windows reinstalls on
every boot.
-## Testing a build
+## Installing a release
-1. Install the release under test (`codync-windows-x64.exe` from the GitHub release). The first
- launch asks Defender Firewall about `codync-host`; the host then starts at sign-in.
-2. **Turn analytics off on the test host before anything else**, so the VM never counts as a user:
- `setAnalytics {"enabled": false}`.
-3. Drive the host over SSH instead of the GUI where possible. The API is loopback-only, which SSH
- satisfies:
+1. Download the installer on the Mac and copy it in under a new name (`scp` can't overwrite a file
+ Windows still holds open: `dest open … Failure`):
+
+ ```sh
+ gh release download v2.20.3 --repo leepokai/Codync -p codync-windows-x64.exe -p codync-windows-x64.exe.sha256 -D <dir>
+ shasum -a 256 <dir>/codync-windows-x64.exe # must match the .sha256 file
+ scp <dir>/codync-windows-x64.exe codync-win:codync-2.20.3.exe
+ ```
+
+2. Stop Codync, then install silently over SSH:
```powershell
- $t = Get-Content "$env:USERPROFILE\.codync\token"
- Invoke-RestMethod -Method Post -Uri http://127.0.0.1:19222/api/refreshBackends `
- -Headers @{ Authorization = "Bearer $t" } -ContentType application/json -Body '{}'
+ Get-Process Codync,codync-host,codync-hostw -ErrorAction SilentlyContinue | Stop-Process -Force
+ $i = Start-Process "$env:USERPROFILE\codync-2.20.3.exe" -ArgumentList "/S","/currentuser" -Wait -PassThru; $i.ExitCode
+ & "$env:LOCALAPPDATA\Programs\codync-desktop\resources\codync-host.exe" --version
```
- `createBot`, `send` and `history` cover most agent checks; a failed start shows up as an error
- notice in `history`. Host logs are under `%USERPROFILE%\.codync`.
-4. Agents: *Install* in the agent sheet runs the CLI's native installer. Agents whose ACP adapter
- comes from npm (Claude, Codex, Gemini, Qwen, …) need Node.js: without one on the VM, Extensions
- shows *Add Node.js*, which puts Codync's own copy in `%USERPROFILE%\.codync\node` (see
- [agent setup](../features/marketplace.md)). To test the computer's own Node instead,
- `winget install OpenJS.NodeJS`.
+ Exit code 2 is the installer's integrity check: the file is truncated, so compare
+ `(Get-FileHash <file>).Hash` with the release's `.sha256`. `taskkill` can leave the old
+ binaries locked; `Stop-Process -Force` on all three processes frees them.
+3. Start the app in the signed-in session (`schtasks` above, with
+ `$env:LOCALAPPDATA\Programs\codync-desktop\Codync.exe`). The first launch asks Defender Firewall
+ about `codync-host`; the host then starts at sign-in through the HKCU Run value `CodyncHost`
+ (`codync-hostw.exe`).
+4. **Turn analytics off on the test host before anything else**, so the VM never counts as a user:
+ `setAnalytics {"enabled": false}`. `hello` reports the current setting (`analytics`).
+
+## Driving the host over SSH
+
+The API is loopback-only, which SSH satisfies. Copy this helper to the VM as `api.ps1`:
+
+```powershell
+param([string]$Method, [string]$Body = "{}")
+# A body of "@file.json" is read from that file (avoids quoting JSON through ssh).
+if ($Body.StartsWith("@")) { $Body = Get-Content -Raw $Body.Substring(1) }
+$t = Get-Content "$env:USERPROFILE\.codync\token"
+$r = Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:19222/api/$Method" -Headers @{ Authorization = "Bearer $t" } -ContentType "application/json; charset=utf-8" -Body ([System.Text.Encoding]::UTF8.GetBytes($Body))
+$r | ConvertTo-Json -Depth 12
+```
+
+- Run it as `powershell -NoProfile -ExecutionPolicy Bypass -File api.ps1 <method> "@<body>.json"`:
+ Windows refuses scripts by default, and JSON quoted through ssh and PowerShell arrives broken, so
+ write each body to a file on the Mac and `scp` it over.
+- `refreshBackends` lists agents (`installed`, `available`, `signedIn`); `agentAuth`
+ (`{"backend":"claude"}`) runs the sign-in check the agent sheet shows; `createBot`
+ (`{"name":…,"backend":"claude","cwd":"C:\\Users\\codync","connectors":[],"skills":[]}`), `send`
+ (`{"botId":…,"text":…}`) and `history` (`{"botId":…,"limit":20}`) cover most agent checks. A
+ failed start or a sign-in card shows up in `history` as a notice
+ (`data.text`, `data.connectionRequest`).
+- Waiting for a reply: poll `history` every few seconds until an entry that isn't `user` appears.
+ Agent starts in the VM take minutes, so run the wait as a background command on the Mac rather
+ than one long foreground `ssh`.
+- Host log: `%USERPROFILE%\.codync\host.log` (strip colors with `-replace "\x1b\[[0-9;]*m",""`).
+ Agent processes: `Get-CimInstance Win32_Process | Where-Object { $_.Name -like "node*" } |
+ Select ProcessId,ParentProcessId,Name,CommandLine`.
+
+## Agents
+
+- *Install* in the agent sheet runs the CLI's native installer. Agents whose ACP adapter comes from
+ npm (Claude, Codex, Gemini, Qwen, …) need Node.js: without one on the VM, Extensions shows *Add
+ Node.js*, which puts Codync's own copy in `%USERPROFILE%\.codync\node` (see
+ [agent setup](../features/marketplace.md)). To test the computer's own Node instead,
+ `winget install OpenJS.NodeJS` (the VM has Node 24, ARM64).
+- **Signing an agent in needs the user**: it's an interactive browser sign-in on the VM's screen,
+ with their account. Ask them; never sign in on their behalf. Claude Code in the VM is signed out.
+- **First npm adapter download**: Claude's adapter with its Claude binary is about 340 MB, and on
+ the VM's network the host's 20-minute prefetch timed out (`couldn't download Claude Agent with
+ npm: timed out`). Seed the npx cache from the Mac instead. The folder name is the first 16 hex
+ digits of the SHA-512 of the package spec; `--cpu` must match the VM's Node (`node -p
+ process.arch`), not Codync's x64:
+
+ ```sh
+ P=@agentclientprotocol/[email protected]
+ printf '%s' "$P" | shasum -a 512 | cut -c1-16 # npx cache key, e.g. 1f872328d1400346
+ mkdir -p <dir> && printf '%s\n' '{"dependencies":{"@agentclientprotocol/claude-agent-acp":"^0.94.0"},"_npx":{"packages":["@agentclientprotocol/[email protected]"]}}' > <dir>/package.json
+ npm install --prefix <dir> --os=win32 --cpu=arm64 --no-audit --no-fund
+ COPYFILE_DISABLE=1 tar -C <dir> -czf npx-claude-win.tgz . && scp npx-claude-win.tgz codync-win:
+ ```
+
+ ```powershell
+ $d = "$env:LOCALAPPDATA\npm-cache\_npx\<key>"
+ New-Item -ItemType Directory -Force $d | Out-Null; tar -xzf "$env:USERPROFILE\npx-claude-win.tgz" -C $d
+ Remove-Item -Recurse -Force "$d\node_modules\.bin"; cd $d; npm rebuild --offline --no-audit --no-fund
+ ```
+
+ The Mac's `node_modules\.bin` has symlinks, not Windows `.cmd` shims; `npm rebuild` writes them
+ (check for `claude-agent-acp.cmd`).
+- **Launches stay unreliable** even with a seeded cache: `npx -y` asks the registry on every launch
+ and fetches anything missing (one 2026-10-20 launch spent 55 s on a single small tarball), so an
+ adapter can sit silent past the host's start limit (`the agent didn't start within 180s`), with
+ or without `--prefer-offline`. When that blocks a check, run the agent's commands by hand (next
+ section) or reproduce the condition on the Mac.
+
+## Checking an agent by hand
+
+- **Time a CLI** the way the host or adapter runs it, e.g.
+ `foreach ($i in 1..3) { $s = Get-Date; & "$env:USERPROFILE\.local\bin\claude.exe" auth status | Out-Null; ((Get-Date) - $s).TotalSeconds }`
+ (2026-10-20: 5.5 to 8.8 s in the VM).
+- **See what an ACP adapter reports**: a small Node script that starts the adapter's command with
+ `shell: true` (for a cached npm adapter, `…\_npx\<key>\node_modules\.bin\claude-agent-acp.cmd`),
+ writes one `initialize` line, and prints every line it gets back with a timestamp for 25 s
+ (stderr passes through):
+
+ ```json
+ {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{"fs":{"readTextFile":false,"writeTextFile":false},"terminal":false,"auth":{"terminal":true},"_meta":{"terminal-auth":true}}}}
+ ```
+
+ An adapter that advertises `agentCapabilities._meta.authStatus` should follow its answer with an
+ `_auth/status_update` notification.
+- **npm**: run the host's command yourself with `--loglevel http` (or `silly`) and
+ `-RedirectStandardError`; npm's own logs are in `%LOCALAPPDATA%\npm-cache\_logs`.
+
+## Testing an unreleased host
+
+Cross-build the host on the Mac (Homebrew `mingw-w64` and the pinned toolchain), from the change's
+worktree:
+
+```sh
+T=~/.rustup/toolchains/1.99.0-aarch64-apple-darwin/bin
+cd host && PATH="$T:$PATH" CARGO_TARGET_DIR=<scratch>/tgt-win CODYNC_ENV=main \
+ CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++ \
+ AR_x86_64_pc_windows_gnu=x86_64-w64-mingw32-ar CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \
+ "$T/cargo" build --locked --profile dev-app --target x86_64-pc-windows-gnu --bin codync-host --bin codync-hostw
+```
+
+The binaries land in `<scratch>/tgt-win/x86_64-pc-windows-gnu/dev-app/`. `CODYNC_ENV=main` gives
+the build the installed host's identity (port 19222, `~/.codync`, the `CodyncHost` Run value), so it
+replaces that host and keeps its analytics-off setting. `dev-app` is a release build and sends
+analytics when they're on, so only run it on the VM's host, where they're off. Without
+`CODYNC_ENV` it would be Codync Dev (19223, `~/.codync-dev`, analytics on by default).
+
+`scp` both files in as `codync-host-fix.exe` and `codync-hostw-fix.exe`, then swap them in, keeping
+the release's binaries:
+
+```powershell
+$r = "$env:LOCALAPPDATA\Programs\codync-desktop\resources"
+Get-Process Codync,codync-host,codync-hostw -ErrorAction SilentlyContinue | Stop-Process -Force
+if (-not (Test-Path "$r\codync-host.orig.exe")) { Copy-Item "$r\codync-host.exe" "$r\codync-host.orig.exe"; Copy-Item "$r\codync-hostw.exe" "$r\codync-hostw.orig.exe" }
+Copy-Item -Force "$env:USERPROFILE\codync-host-fix.exe" "$r\codync-host.exe"; Copy-Item -Force "$env:USERPROFILE\codync-hostw-fix.exe" "$r\codync-hostw.exe"
+schtasks /create /tn CodyncHostFix /tr "`"$r\codync-hostw.exe`" serve --port 19222" /sc once /st 23:59 /it /f; schtasks /run /tn CodyncHostFix
+```
+
+The first start of a swapped host took several minutes to answer `hello`; poll it for up to ten
+minutes. Until the swap is undone, the test host also starts at every sign-in. To undo it, stop
+the three processes and copy the `.orig.exe` files back, or reinstall the release.
+
+## Reproducing Windows conditions on the Mac
+
+When the VM can't run a check, reproduce the Windows condition in the worktree's desktop sandbox
+(`npm run dev -- --cdp`, [worktree sandboxes](dev-app.md#worktree-sandboxes)); the host and the
+agents it starts inherit the environment:
+
+- **Signed out**: `CLAUDE_CONFIG_DIR=<empty folder> npm run dev -- --cdp`. Use a fresh folder per
+ run: signing in from the sheet stores a login for that folder in the keychain (remove it with
+ `CLAUDE_CONFIG_DIR=<folder> claude auth logout`).
+- **A slow CLI**: Claude's adapter runs `CLAUDE_CODE_EXECUTABLE` instead of its bundled `claude`.
+ Point it at a wrapper that delays one command and runs the real binary:
+
+ ```sh
+ #!/bin/sh
+ # `claude auth status` taking 6 s, past the adapter's own 5 s limit (as on Windows).
+ if [ "$1" = auth ] && [ "$2" = status ]; then sleep 6; fi
+ exec ~/.npm/_npx/<key>/node_modules/@anthropic-ai/claude-agent-sdk-darwin-arm64/claude "$@"
+ ```
+
+ The host's own `claude auth status` uses the `claude` on PATH, so only the adapter is slowed.
## Limits
-- An unreleased host can't be built on the Mac for Windows (its C dependencies need a MinGW
- toolchain that isn't installed). CI builds Windows only for pull requests and tags
- (`.github/workflows/host.yml`), so a fix is usually reproduced by hand in the VM first (running
- the exact command the host would) and checked on Windows again with the next release.
-- `cfg(windows)` code can still be compile-checked on the Mac by copying it into a scratch crate and
- running clippy with the pinned toolchain's `--target x86_64-pc-windows-gnu`.
+- Agent launches in the VM depend on its network (see [agents](#agents)); a check that needs an
+ npm adapter to start may not finish.
+- CI builds Windows only for pull requests and tags (`.github/workflows/host.yml`); a direct push
+ to `dev` gets no Windows compile. Clippy the whole host for Windows on the Mac with the
+ cross-build variables above and
+ `"$T/cargo" clippy --locked --target x86_64-pc-windows-gnu --all-targets -- -D warnings`.
+
+Investigations done this way:
-Investigations done this way: [npm agents failing to start on Windows, 2026-10-14](../investigations/windows-npm-agents-2026-10-14.md).
+- [Claude reported signed in on Windows while signed out, 2026-10-20](../investigations/windows-claude-sign-in-2026-10-20.md)
+- [npm agents failing to start on Windows, 2026-10-14](../investigations/windows-npm-agents-2026-10-14.md)
diff --git a/docs/investigations/windows-claude-sign-in-2026-10-20.md b/docs/investigations/windows-claude-sign-in-2026-10-20.md
new file mode 100644
index 00000000..061c439d
--- /dev/null
+++ b/docs/investigations/windows-claude-sign-in-2026-10-20.md
@@ -0,0 +1,90 @@
+# Claude reported signed in on Windows while signed out — 2026-10-20
+
+> Historical record of one investigation, not a current test result. How to test on Windows:
+> [Windows testing](../guides/windows-testing.md).
+
+## Signal
+
+PostHog (project 649427), production (`env = main`), owner and e2e test hosts excluded (cohort
+618410), queried 2026-10-20:
+
+- Claude turns failed on 28% of attempts on Windows, 8% on macOS. Only 29% of Windows users' first
+ Claude turn succeeded (macOS 58%, Linux 74%).
+- New computers that sent a message but got no reply on their first day: Windows 33%, macOS 15%,
+ Linux 6%.
+- Claude `sign_in` failures reached 57 people, and 60% of them never had a successful turn after
+ it. On Windows, 5 of 18 people whose first turn failed with `sign_in` recovered.
+
+## Reproduction
+
+VM "Codync Windows", Codync v2.20.3 from the GitHub release, analytics off on the host, Claude Code
+installed and signed out (`claude auth status`: `loggedIn: false`), Node.js 24 (ARM64).
+
+1. A new Claude bot's first message: `Couldn't start the agent: couldn't download Claude Agent
+ with npm: timed out`. The npm prefetch (`npm exec --yes --package
+ @agentclientprotocol/[email protected] -c "exit 0"`) ran into the host's 20-minute limit on
+ the VM's network. The adapter's npx cache was then seeded from the Mac (see
+ [agents](../guides/windows-testing.md#agents)).
+2. Sent again: the bot showed the agent sign-in card (`Needs you to sign in. Your message goes out
+ again once you're signed in.`), which is right.
+3. `agentAuth {"backend":"claude"}` (the agent sheet's check) took 72 s and returned
+ `signedIn: true` with both sign-in methods. So the sheet said *Signed in.* with no sign-in
+ button, and tapping done on the card completed it and resent the message, which failed again:
+ a loop the user can't leave.
+4. `claude auth status` in the VM took 8.8, 6.1 and 5.5 s on three runs.
+5. Sending `initialize` to the adapter by hand
+ ([checking an agent by hand](../guides/windows-testing.md#checking-an-agent-by-hand)): the answer
+ came after 5.0 s and advertised `agentCapabilities._meta.authStatus`, stderr said `claude auth
+ status did not answer within 5 s; the identity is not refreshed`, and no
+ `_auth/status_update` followed within 25 s.
+
+## Root cause
+
+Claude's adapter reports the login only if its own `claude auth status` answers within 5 s; on
+Windows (x64 under emulation in the VM) it takes longer, so the adapter stays silent. The host's
+check (`auth::probe`, `host/src/agent/auth.rs`) then fell back to `session/new`, the test it uses
+for agents that don't report a login. Claude's adapter opens a session without checking the login,
+so the check said signed in.
+
+## Fix
+
+f95b9fff (2.21.0): an agent that advertises `authStatus` is never judged by a session. When its
+report doesn't come, the harness's own CLI check (`claude auth status`, 15 s, with the same
+environment the agent gets) decides, and when there is none the answer is "can't tell", so the
+sheet keeps offering sign-in. The same release added ad36a247 (the sign-in card before the first
+message) and 3dc8d56a (`turn_finished` failure categories), which make the next round of this
+signal readable.
+
+## Verification
+
+- Done: unit tests for the new rule (a report wins, no report and no CLI check means "can't tell",
+ agents without `authStatus` still use a session).
+- Done on the Mac, in a worktree desktop sandbox: the Windows condition reproduced with a
+ `CLAUDE_CODE_EXECUTABLE` wrapper that delays `auth status` by 6 s and an empty
+ `CLAUDE_CONFIG_DIR`
+ ([reproducing Windows conditions](../guides/windows-testing.md#reproducing-windows-conditions-on-the-mac)).
+ `agentAuth` took 9 s and returned `signedIn: false` with the sign-in methods; the sheet said *Not
+ signed in yet.* with its options; a new Claude bot got the *Needs you to sign in before your
+ first message.* card and it stayed pending, with no resend loop. Signed in with the same slow
+ wrapper, the check said signed in (10 s), and a normal signed-in bot answered.
+- Not done in the VM: the cross-built fixed host ran there, but its check never finished. The
+ adapter launch sat silent on the VM's network (`the agent didn't start within 180s` after
+ 392 s). After 2.21.0 ships, check in PostHog that Windows Claude `sign_in` failures and
+ first-turn success improve, and repeat step 3 in the VM when its network allows.
+
+## Seen, not fixed
+
+- `npx -y` asks the registry on every launch and fetches anything missing (one launch in the VM
+ spent 55 s on a single small tarball), so an adapter that is already cached can still fail to
+ start on a slow or offline network. `--prefer-offline` didn't change it in the VM.
+- A first Claude message downloads about 340 MB (the adapter and its Claude binary). On a slow
+ link the user waits up to the 20-minute prefetch limit before seeing an error.
+
+VM state left behind: Codync 2.20.3 installed, but `resources\codync-host.exe` and
+`codync-hostw.exe` are the cross-built test host (2.20.4, an early version of the fix), with the
+release's binaries saved as `codync-host.orig.exe` and `codync-hostw.orig.exe`; restore them
+before testing a release. Also: scheduled tasks `CodyncSetup`, `CodyncSetupUI`, `CodyncApp` and
+`CodyncHostFix`; in `C:\Users\codync` the helpers (`api.ps1`, `wait-reply.ps1`, `wait-more.ps1`,
+`wait-host.ps1`, `acp-auth-probe.mjs`, JSON bodies), `codync-2.20.3.exe`, the `*-fix.exe` builds and
+`npx-claude-win.tgz`; the seeded npx cache `1f872328d1400346` (claude-agent-acp 0.94.0); test bot
+`WinClaude`; Claude Code still signed out.