Skip to content

fix: let the server start on Windows - #38

Closed
muleskin wants to merge 1 commit into
ethanplusai:mainfrom
muleskin:fix/windows-startup
Closed

muleskin wants to merge 1 commit into
ethanplusai:mainfrom
muleskin:fix/windows-startup

Conversation

@muleskin

@muleskin muleskin commented Oct 7, 2026

Copy link
Copy Markdown

Summary

Three POSIX assumptions stopped python server.py from starting on Windows. Each one failed before the server could serve anything:

  • usage_scan.py: _DAY_MIN / _DAY_MAX were built from naive datetimes. .timestamp() on those goes through local time, which raises OSError: [Errno 22] on Windows for years before 1970, so the import failed. The bounds are now UTC-aware. On Windows the floor is the epoch, because datetime.fromtimestamp there also refuses negative values.
  • data_paths.ensure_tool_token: reusing an existing token used os.O_NOFOLLOW, os.getuid and os.fchmod, which Windows doesn't have, so app startup failed. A Windows-only path (_adopt_tool_token_windows) still refuses links and non-regular files via lstat. It leaves access control to the user profile's ACLs. The POSIX path is unchanged.
  • brain.py / run_executor.py: both shlex.split the claude path. POSIX splitting treats the backslashes in C:\Users\...\claude.exe (exactly what shutil.which returns) as escapes and drops them, so the brain could never start. The new claude_env.split_command uses an existing file path as-is and splits anything else exactly as before.

This only gets the server running on Windows. The macOS-only features (AppleScript, screencapture, Accessibility) still don't work there.

Testing

  • Checked by running it on Windows 11 / Python 3.14: the server starts, the brain reaches brain ready, and the Fish TTS check passes.
  • The test suite has not been run on Windows. It can't be collected there (os.geteuid in tests/test_usage_scan.py, and cp1252 decode errors in four other test files). The POSIX code paths are unchanged apart from split_command, which behaves exactly as shlex.split did for anything that isn't an existing file path.

🤖 Generated with Claude Code

Three POSIX assumptions stopped server.py from starting on Windows:

- usage_scan built its day bounds from naive datetimes, whose
  .timestamp() goes through local time and raises OSError before 1970
  on Windows, at import. Build them UTC-aware, and floor at the epoch
  there since fromtimestamp refuses negative values too.
- ensure_tool_token adopts an existing token via O_NOFOLLOW, getuid and
  fchmod, none of which Windows has. Add a Windows path that still
  refuses links and non-regular files via lstat.
- brain and run_executor shlex.split the claude path, which drops the
  backslashes from C:\Users\...\claude.exe. claude_env.split_command
  takes an existing file path whole and splits anything else as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@muleskin muleskin closed this by deleting the head repository Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants