Skip to content

fix(relay): allow managed startup on Windows - #83

Open
abdfattahz wants to merge 1 commit into
anomalyco:mainfrom
abdfattahz:fix/windows-lifecycle-directory-fsync
Open

fix(relay): allow managed startup on Windows#83
abdfattahz wants to merge 1 commit into
anomalyco:mainfrom
abdfattahz:fix/windows-lifecycle-directory-fsync

Conversation

@abdfattahz

Copy link
Copy Markdown

Why

On Windows, a managed relay writes its Ready lifecycle event and then exits before it can accept requests. appendRelayLifecycleEvent() successfully syncs the lifecycle file, but the following directory-handle fsync fails with EPERM because Windows does not support syncing a read-only directory handle.

This produces Browser Control relay did not start at http://127.0.0.1:19989 for every relay-backed command. Running browser-control serve in the foreground reaches the same lifecycle path; the underlying error is:

Error: EPERM: operation not permitted, fsync
    at appendRelayLifecycleEvent (.../dist/cli.js)

#82 addresses the equivalent failure when persisting sessions.json, but the relay first encounters this independent lifecycle-log sync during managed startup. Both paths need the unsupported-directory-sync handling for normal Windows operation.

What Changes

Operation Behavior
Lifecycle file write and file sync Remains required; errors still fail lifecycle recording
Directory sync reports EPERM, EINVAL, or ENOTSUP Keep the recorded event and continue because the platform/filesystem does not support directory sync
Directory sync reports any other error Preserve the existing failure behavior
  • Add focused regression coverage for each unsupported directory-sync code.
  • Preserve existing coverage proving generic directory-sync failures propagate and descriptors close.
  • Add a patch changeset.

Scope

This changes only synchronous relay lifecycle logging. It does not alter lifecycle event contents, session persistence, restart coordination, extension behavior, or public APIs. It complements rather than duplicates #82.

Verification

pnpm test test/relay-lifecycle-log.test.ts -t "tolerates unsupported|propagates directory-sync|syncs the file"
pnpm typecheck
pnpm check:locals
pnpm check:unused
pnpm exec changeset status
git diff --check
  • The new regression failed for all three codes before the production change and passes afterward.
  • Five focused lifecycle durability tests pass, including unsupported and real-error paths.
  • Typecheck, unused-local, Knip, changeset, and whitespace checks pass.
  • The complete lifecycle-log test file has two existing Windows-only failures unrelated to this change: POSIX permission-bit expectations and truncating an append-mode descriptor. GitHub Linux CI remains the authoritative full-suite/build gate.
  • Installed 0.7.0 was also validated on Windows with the equivalent bundled guard: detached relay startup, Edge extension connection, MCP connection, browser-control doctor, and navigation to Example Domain succeeded.

@abdfattahz abdfattahz changed the title fix: allow managed relay startup on Windows fix(relay): allow managed startup on Windows Sep 9, 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.

1 participant