Skip to content

Port Milo's first native workflow to Windows x64 - #125

Draft
mcc0x wants to merge 50 commits into
mainfrom
windows-native-reader
Draft

mcc0x wants to merge 50 commits into
mainfrom
windows-native-reader

Conversation

@mcc0x

@mcc0x mcc0x commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Refs #54. This draft adds Milo's first native Windows (x86-64, MSVC) version. It covers the Reader, Outline, History and Home panes, the Usage pane, and the packaged browser settings from milo web, all tested on a GitHub-hosted Windows runner. Anything not ported says "not supported on Windows yet" instead of doing nothing. Nothing is published.

What changed

  • Panes in the console. Home, Outline, History, the Reader (open, edit, explicit save, refusing to overwrite another program's change) and Usage run in Windows' own console. The console's modes and code page are restored on exit.
  • Browser settings with milo web.
    • The local settings page opens in the default browser through the same private hand-off page as on Unix.
    • Settings saved there are read after Milo restarts, including the Usage pane's choice of which tools to show.
    • Settings files, setup locks and the hand-off page are created so that only the user and SYSTEM can open them. Locks and the hand-off page sit in folders only the user and SYSTEM can change, and Milo refuses to use any it didn't create that way. A file system without access lists, such as FAT, is refused.
    • The hand-off page lives in the user's own local application data folder as Windows records it, whatever the environment says. This matches Unix, which uses the system temporary folder whatever TMPDIR says.
    • Saving preferences gives up after five seconds if another process holds the lock.
    • Milo never runs a rex command on Windows, so a rex.exe beside milo.exe or in a project is never started.
  • Usage.
    • Codex session totals and Claude Code token activity are read from the local session files. Claude Code is shown only when it is set to Always show.
    • OMP limits and OpenCode totals are read only while OMP or OpenCode is closed (see below).

Limited support: OMP and OpenCode on Windows

Windows has no sqlite3 program, and the SQLite built into Windows writes beside a database it opens, even read-only. So Milo never opens these databases in place. It copies a database into memory under SQLite's own shared lock and queries the copy. It does this only when no -wal, -shm or unfinished -journal file is beside the database, and it checks again after the copy.

  • While OMP or OpenCode has its database open, Milo leaves it unread. The pane keeps the last figures and shows "On Windows, OMP and OpenCode usage is read only while they are closed." This is not live parity with macOS and Linux.
  • Milo never writes, creates or changes a file beside the database. Each look holds SQLite's shared lock for as long as the copy takes, which can make a writer's commit wait.
  • The result matches what SQLite itself would read only if the tool opens the database by its own name. A database with a second hard link, or reached through a different name, is left unread. If a tool opened its database through a file symbolic link, Milo could not see that, so this case isn't covered.
  • A database over 64 MiB is not read, and the pane says so.

Not supported on Windows yet

These are missing in this version, as opposed to inputs that a Windows machine simply doesn't have:

  • the Rex listener and tasks;
  • the Markdown preview;
  • video playback;
  • alerts and Discord presence;
  • milo setup, doctor, uninstall and layout profiles;
  • moving settings between computers;
  • milo web --host and --forwarded-port;
  • Usage accounts;
  • the Claude Code status line.

milo ssh stays supported on Linux and macOS and is not supported on native Windows. There is no menu bar or tray app.

Rex on Windows. Rex's Windows app is in preview, and Rex Server on Windows is in testing: personal server only, one account, reached over a named pipe. The shared or login server, socket activation, rex terminfo setup, rex server install ssh:// and Tailscale Serve are not available on Windows. Milo's Rex integration isn't ported to Windows yet, so native Windows, WSL (a Linux build) and a Windows Rex client attached to a remote host are separate cases. Only native Windows is covered here.

Verification

.github/workflows/windows.yml runs on a GitHub-hosted windows-2025 runner (Windows Server 2025, build 26100) with Rust 1.91.0:

  • cargo test passes in both debug and release profiles.
  • tests/windows_console.rs drives the built executable in a real pseudoconsole: the Reader edit/save/refuse workflow, Home, Outline, History, and Usage reading local Codex sessions.
  • A Chromium smoke test drives the packaged milo web. It saves layout and Usage choices, and the next pseudoconsole run checks that the Usage pane follows the saved choices.
  • The OMP and OpenCode reader is tested against databases made by Windows' own SQLite. The folder's names and bytes are compared before and after each read, covering:
    • a closed WAL database and a rollback-journal database are read;
    • a live database is left unread;
    • leftover sidecars, hard links, short names and symbolic links are refused;
    • the time, output and size limits hold.
  • Every run prints the SHA-256 of the executables it tested. A manual run given a recipient certificate keeps the release executable for one day, encrypted to that certificate. Pull-request runs keep nothing.

The Linux and macOS jobs run as before.

Not covered: Windows Terminal or conhost used by hand, launching a real default browser interactively, WSL, and a Windows Rex client. On Windows the settings page still says "No Rex server answered", while Health correctly says Rex integration is not supported on Windows yet.

An independent review covered every change since the previously reviewed head and found no remaining blocker at 828cca2. d9d68ac only moves one existing check earlier.

Screenshots

None: the settings page is the same page as on Unix, and the only new pane text is the notices quoted above.

Compatibility

No new dependencies. Unix behaviour is unchanged, and #126 still merges cleanly on top. No Windows binary is published.

Open in Capy

Windows gets a console session that reads keys as terminal sequences and
restores the console's modes and code page, a job object in place of a
process group for Git, positional file I/O, and settings and state under
APPDATA and LOCALAPPDATA. Usage, setup, tasks, Rex and the Markdown preview
report that they are not supported on Windows yet instead of running.
Each folder on the way to a working file is opened relative to the one
before it with NtCreateFile, never through a reparse point, and held so it
cannot be moved mid-save. Links, junctions, device names, alternate streams
and cloud placeholders are refused rather than followed or recalled, and the
save handle shares only reading while it is open.
A dedicated workflow builds and tests the MSVC target on a GitHub-hosted
Windows runner. Its pseudoconsole test opens a CRLF, BOM and Unicode file
with milo view --edit, saves an edit, refuses to write over a change made
by another program, quits, and checks the console modes are as before.
@capy-ai capy-ai Bot added enhancement New feature or request reliability Resilience, recovery, and regression coverage labels Nov 26, 2026
mcc0x added 15 commits November 26, 2026 12:06
Video playback says it is not supported on Windows yet before it touches
the file. Editing tests that only need ordinary files, including the BOM,
CRLF and Unicode save tests, now run on Windows too.
…Windows

Each command says it is not supported on Windows yet. Secret files and
trusted-program checks refuse on Windows rather than skip their ownership and
mode checks. Unix-only tests are gated, and a Windows test checks that the
outline does not descend into directory links or junctions.
The I/O manager rejects that option beside FILE_DIRECTORY_FILE as an invalid
parameter, so every Reader root open failed on NTFS. Test the temporary folder as
written, canonicalized and with the verbatim prefix removed.
Windows can't lock a directory handle, so preference saves lock a fixed file in
the folder. Test fixtures drop the verbatim prefix Git can't use, a path through a
file is reported as not a directory, and tests of features that refuse on Windows
run on Unix only.
Canonicalizing on Windows adds a verbatim prefix that a path from Git or the user
never has, so the Reader could not place a file in its repository. Drop the prefix
wherever the plain form names the same file.
Git for Windows reads a backslash in a pathspec as a folder separator, so the
escaped final character turned page.txt into page.tx/t and every working diff
came back empty.
The Reader and agent output now name a file inside a project the way Git does, so
committed reads, tabs and places find it. Folders on the way to a Reader entry
share delete access, so Milo never blocks another program's rename. Tests of
native actions, Rex requests, tasks, tab titles, video and file names Windows
can't hold run on Unix only.
The Reader's stamp now includes the file length, so a write that lands in the same
change-time tick as the last one is still seen.
The test's output is redirected on CI, and a child started without explicit
handles inherited it, so Milo refused to run without a terminal.
An eighth field put the startup flags where the window state goes, so the child
never got the pseudoconsole's handles.
The pseudoconsole repaints the first report when Milo leaves its alternate screen,
so counting reports could not tell the two apart.
A manual run given a recipient certificate encrypts the executable the tests used
and keeps it for one day. Every run prints that executable's hash.
@capy-ai
capy-ai Bot marked this pull request as ready for review November 26, 2026 13:32
The optimised build is what a release would ship, so the native job runs every
test against it too, prints its hash beside the debug build's, and a sealed manual
run keeps the release executable.

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found 1 potential issue (1 medium).

View 1 other finding in Capy.

Open in Capy

Comment thread src/git/run.rs Resolved
Git's glob never lets a bracket match a separator, so a file whose name ends
without ASCII, such as docs/日本語, got an empty diff. The stand-in character is
now the last ASCII character other than a slash, and a test reads exactly one
file's diff for nested, non-ASCII and bracketed names.
@capy-ai
capy-ai Bot marked this pull request as draft November 26, 2026 13:38
milo ssh stays supported on Unix and says it isn't supported on native Windows
yet. The terminal is lent and taken back through the shared raw_mode and restore,
and the Unix-only ownership, mode and process code is gated. Patches from the
milo ssh thread.
milo ssh isn't supported on native Windows yet, so the tests that lend a pane to
another host run only where it is.
Session folders are walked relative to held directory handles, with every link,
junction and mount point refused. Usage accounts, OpenCode and OMP say they are
not supported on Windows yet, and so do the usage doctor and menu stream.
mcc0x added 20 commits November 26, 2026 14:33
Each pane draws its content, takes a key or two, quits with exit code 0 and leaves
the console modes as they were.
Windows has no sqlite3 program, so the query runs in process against
System32\winsqlite3.dll, loaded from System32 only, and writes the shell's
JSON form. Links are refused before opening because that build follows
them despite SQLITE_OPEN_NOFOLLOW. Wall time and output stay bounded.
Windows' SQLite ignores readonly_shm and makes the missing file, which the
native run showed. Only the checked query, which requires both sidecars,
is the guarantee now.
Windows' SQLite ignores readonly_shm, so opened in place it writes the
shared-memory file and makes missing sidecars. Read the database and its
log through read-only handles instead, fold committed frames into a copy
in memory when the log header is unchanged around the copy, and query
that copy with sqlite3_deserialize. Nothing beside the database is
opened or written; a database and log over 64 MiB are left unread.
…age copy

The lock keeps a closing writer from checking its log into the database
and deleting it during the copy, and keeps a rollback writer out of the
file; a hot journal, a replaced file, a changed size or a rewritten log
header makes the copy start again, then leaves the database unread. A
log is folded only into a WAL database with its page size, and never
past the size limit.
…d end

Hold WAL read-lock slot 0 beside the database's shared lock, so no
checkpoint can write the database during a copy, and replay the log only
to the end a live writer published in its WAL index. A log with an
unknown version or page size leaves the database unread; WAL mode follows
the read version byte; page 1 is checked after replay. Output is bounded
before every append, TEXT is read as UTF-8, files are told apart by their
128-bit IDs, reads stop at the deadline, and locks are released before
the copy is folded.
Open the packaged settings editor on loopback through a private handoff
page in %LOCALAPPDATA%\milo that lasts 120 seconds and is removed when the
browser connects, the open fails or Milo stops. ShellExecuteExW gets only
the page path. Settings, layouts and lock files Milo creates admit only the
user and SYSTEM, and per-user locks use LockFileEx on such files; a lock
file with any other security is refused. sys::poll waits on sockets through
WSAPoll. --host, --forwarded-port, settings transfer and alert routes stay
explicitly unsupported on Windows. The native job adds a headless Chrome
handoff test and a Chromium smoke against the tested release build.
The Chromium smoke chooses Claude Code always shown and OpenCode hidden,
saves them globally, finds them after a restart and hands the saved file
to a pseudoconsole test, which opens the Usage pane without it and with
it: Claude Code's tokens appear only with the browser's choice.
…g the WAL index

The index is SQLite's shared memory: a file read is not guaranteed to see
what a live writer published through its mapping, and an index left by a
stopped process cannot be told from a live one without a mapping or a lock
that SQLite would notice. Use SQLite's recovery rule instead: every frame
that carries the log's salts and continues its checksum, up to the last
commit. Unlock guards are made only for locks taken, and folding and
loading stop at the deadline.
A database with a write-ahead log or index beside it is left unread
instead of folding its log, so every total is one SQLite's committed
reader would see. The sidecars are checked before and under SQLite's
shared lock and again after the copy; a hot journal is refused.
Sidecar absence proves nothing when the owner opens the database by
another name, so a database with a second hard link, or read by a
name other than its own long name, is left unread, and a log, index or
journal beside its short name counts. The pane now shows the closed-
only note while a look finds OMP or OpenCode using its database,
rather than whenever one existed at startup.
A failed GetShortPathNameW no longer reads as having no short name, and
the pane's in-use note looks under the same names as the reader.
Rex has a Windows app in preview, so task and Markdown preview messages
now say what Milo has not ported rather than that Rex cannot run.
The browser hand-off page and setup locks now live in folders only this
user and SYSTEM may change, created with that security and refused if
anything else made them. The page's folder is held open so it cannot be
renamed while the browser reads it, lock files share no deletion so they
cannot be swapped while held, and a newly created private file whose
access list did not take, as on FAT, is removed and refused. Preference
saves lock a private file and give up after five seconds rather than
waiting on another account for ever. The shell is no longer asked to
share Milo's console with the program it starts.
On Windows the settings page no longer offers Claude Code's status
line, and Rust refuses it, because the command it would install only
says it is unsupported. Settings and Health no longer run a bare rex
command, which Windows would look for in the working folder. The Usage
file walk counts names as it reads them and marks a folder that stops
answering as partial. The browser smoke redacts URLs and tokens from
its errors, the Windows console tests drop every variable that points
Usage at real data, and a dispatched run seals its executable only after
every test has passed.
The hand-off page now goes under the local application data folder the
system records for the user rather than one the environment names, and
both the page and each lock file are checked, while their private
folder is held, to resolve inside that folder; the browser is given the
page's resolved path. No Rex command is run on Windows from any entry
point: scripts, Health's layout check, server and app queries, alerts,
attention, presence and remote editors all report Rex as unavailable.
@capy-ai capy-ai Bot changed the title Build and test the Reader workflow on native Windows Port Milo's first native workflow to Windows x64 Nov 26, 2026
install-windows.ps1 installs the executable beside it for this account
only after checking its SHA-256, keeps a receipt and a copy of itself as
uninstall-milo.ps1, and adds its folder to the user PATH once. An
upgrade moves a running milo.exe aside rather than failing, and clears
it once it has stopped. Removal refuses a running or changed milo.exe
and takes back only the PATH entry it added; settings stay. Uninstall
in Home explains this instead of saying it is unsupported. Native CI
installs, upgrades and removes the tested release this way, and a
dispatched run seals that package.
Doctor now reports the host, worktree, preferences, the layout saved in
the browser and every Usage source on Windows, and names the Markdown
preview, Rex integration, layout listener, Discord presence and Claude
status line as not supported on Windows yet, without running rex or
raising problems for pieces Windows cannot have. Its Usage lines say
when OMP or OpenCode is in use or too large to read. The settings page
says why alerts, presence and Rex are missing on Windows instead of
showing a generic or misleading message.
…r removed

The installer rebuilt the user PATH from its non-empty entries, so a
trailing or doubled semicolon was lost on removal. It now appends its
folder to the value as written and removes only that entry. The install
test starts from a PATH with empty entries and expects it back byte for
byte.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request reliability Resilience, recovery, and regression coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant