remodex-windows-fix
v1.3.9
Published
Local bridge between Codex and the Remodex mobile app with a Windows-safe Codex launcher.
Maintainers
Readme
remodex-windows-fix
Windows-friendly mirror of remodex with a launcher fix for codex app-server.
What Changed
- Fixes Windows startup when
remodex uptries to spawncodexand fails withspawn codex ENOENT. - Prefers
codex.cmdorcodex.baton Windows and runs them with shell support. - Falls back to
codex.exewhen a wrapper script is not present. - Adds
REMODEX_CODEX_BINandPHODEX_CODEX_BINoverrides for explicit Codex binary selection. - Prevents immediate uncaught startup crashes by routing launcher failures through Remodex error handling.
Why This Exists
On Windows, codex is often installed through npm as a .cmd shim. A plain Node spawn("codex", ["app-server"]) call can fail even when codex works in PowerShell. This fork resolves the executable explicitly before launching the bridge.
Install
Install from npm:
npm install -g remodex-windows-fixGlobal CLI command:
remodex-windows-fixThe iPhone app is available on the App Store.
Usage
Start the bridge:
remodex-windows-fix upReset the saved pairing state and force a brand new QR:
remodex-windows-fix reset-pairingResume the last active thread:
remodex-windows-fix resumeWatch rollout output:
remodex-windows-fix watch [threadId]macOS service commands inherited from upstream:
remodex-windows-fix start
remodex-windows-fix restart
remodex-windows-fix stop
remodex-windows-fix statusGet a fresh QR on Windows without stale pairing state:
run-clean-qr.batThis helper:
- stops any existing
remodex-windows-fixbridge process - runs
reset-pairing - starts a fresh bridge in a new PowerShell window
- waits for
C:\Users\%USERNAME%\.remodex\pairing-qr.pngand opens it automatically
It defaults to:
wss://remodex-relay.th07290828.workers.dev/relayYou can also pass a custom relay URL:
run-clean-qr.bat wss://YOUR-RELAY/relayPairing Behavior
The bridge now keeps a stable saved relay session id, so you only need to scan the QR once per paired iPhone in normal use.
After the first QR pairing:
- you can stop and start
remodex-windows-fix upagain - the same trusted client can reconnect without rescanning
- you can bootstrap an additional trusted browser client with a fresh QR
- you do not need a fresh QR unless you intentionally reset pairing
Use remodex-windows-fix reset-pairing when you want to:
- pair a different iPhone
- discard the saved trust/session state
- force a brand new QR bootstrap
Windows Override
If you want to force a specific Codex binary, set one of these environment variables before running remodex up:
$env:REMODEX_CODEX_BIN = "C:\Users\th072\AppData\Roaming\npm\codex.cmd"Legacy alias:
$env:PHODEX_CODEX_BIN = "C:\Users\th072\AppData\Roaming\npm\codex.cmd"Self-Hosted Relay
This repository now includes the upstream-compatible relay code and a local runner.
Start your own relay:
npm run relayOr use the bundled binary directly:
remodex-relayDocker Compose:
docker compose up -dBrowser client skeleton:
http://YOUR_HOST:9000/app/The Node relay now serves a PWA shell at /app/ so you can start building a browser-based client on the same origin as the relay.
Current scope:
- imports pairing JSON directly
- attempts QR image decoding through
BarcodeDetectorwhen the browser supports it - opens a browser WebSocket as
role=iphone - persists relay/pairing state locally
Current limitation:
- the browser secure pairing handshake (
clientHello/clientAuth/ encrypted envelopes) is scaffolded in the UI only and is not implemented yet
Optional relay host/port overrides:
$env:REMODEX_RELAY_HOST = "0.0.0.0"
$env:REMODEX_RELAY_PORT = "9000"Optional relay hardening overrides:
$env:REMODEX_TRUST_PROXY = "true"
$env:REMODEX_RELAY_EXPOSE_DETAILED_HEALTH = "true"
$env:REMODEX_RELAY_UPGRADE_WINDOW_MS = "60000"
$env:REMODEX_RELAY_UPGRADE_MAX_PER_WINDOW = "60"Point the bridge at your relay:
$env:REMODEX_RELAY = "ws://YOUR_HOST:9000/relay"
remodex-windows-fix upFor TLS/reverse-proxy setups, use the public wss://YOUR_DOMAIN/relay URL instead.
Health endpoint:
GET /healthBy default the relay returns a minimal health payload. Set REMODEX_RELAY_EXPOSE_DETAILED_HEALTH=true
if you want /health to include session counters for monitoring.
Cloudflare Deploy
This repository also includes a Cloudflare Workers relay implementation in cloudflare/worker.mjs with Durable Objects configured in wrangler.toml.
GitHub itself still does not host persistent WebSocket servers, but Cloudflare Workers can deploy this relay directly from your GitHub repository without running anything locally.
The Worker also accepts browser iphone clients through ?role=iphone, which is necessary because browser WebSockets cannot send the x-role header.
The same Worker deployment now also serves the browser client shell at:
https://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/app/Import this repository in Cloudflare:
- Open Cloudflare Workers & Pages.
- Create or import a Worker from your GitHub repository.
- Use the worker name
remodex-relayso it matches wrangler.toml. - Deploy the repository as-is.
- After deploy, use the public Worker URL as the relay base:
$env:REMODEX_RELAY = "wss://YOUR-WORKER.YOUR-SUBDOMAIN.workers.dev/relay"
remodex-windows-fix upCurrent deployed example for this repository:
$env:REMODEX_RELAY = "wss://remodex-relay.th07290828.workers.dev/relay"
remodex-windows-fix upIf you are using cmd.exe instead of PowerShell:
set REMODEX_RELAY=wss://remodex-relay.th07290828.workers.dev/relay
remodex-windows-fix upHealth check:
https://remodex-relay.th07290828.workers.dev/healthCloudflare health endpoint:
GET /healthAlternative GitHub Deploy
If you prefer a normal Node web service instead of Workers, this repository still includes the Render-compatible runner in render.yaml.
$env:REMODEX_RELAY = "wss://YOUR-SERVICE.onrender.com/relay"
remodex-windows-fix upValidation
Typical local verification:
codex --version
codex app-server --help
remodex-windows-fix upExpected Windows resolution after the fix:
C:\Users\th072\AppData\Roaming\npm\codex.cmd app-serverProject Layout
bin/
cloudflare/
compose.yaml
Dockerfile
relay/
src/
web/
wrangler.toml
package.jsonAttribution
This repository preserves the upstream Remodex package structure and credits the original package author in package.json. This fork adds a Windows launcher compatibility patch and accompanying documentation.
