Skip to content

feat: native Windows support#3

Merged
Kevin7Qi merged 18 commits intomainfrom
feat/windows-support
Mar 2, 2026
Merged

feat: native Windows support#3
Kevin7Qi merged 18 commits intomainfrom
feat/windows-support

Conversation

@Kevin7Qi
Copy link
Copy Markdown
Owner

@Kevin7Qi Kevin7Qi commented Mar 1, 2026

Closes #2

Summary

  • Add cross-platform path handling (path.join(), os.homedir(), os.tmpdir()) across all source and test files
  • Add Windows process termination in protocol.ts close() using taskkill /T /F for process tree cleanup
  • Add PowerShell installer (install.ps1) with .cmd and bash shims, symlink support, and PATH management
  • Add Windows runner to CI matrix with installer smoke test
  • Add .gitattributes for consistent line endings
  • Rewrite mock servers to use Node.js process.stdin events for Windows compatibility
  • Harden captureErrorMessage test helper and installer error handling

Test plan

  • 95 tests pass on Linux (0 fail, 2 skip)
  • 95 tests pass on Windows (0 fail, 2 skip)
  • install.sh --dev works on Linux
  • install.ps1 and install.ps1 -Dev work on Windows
  • Smoke test: health, run, run --resume, review, models, jobs, output, progress, kill, delete, clean all functional
  • CI passes on both Linux and Windows runners

Kevin7Qi added 15 commits March 1, 2026 15:46
- Check $LASTEXITCODE after bun install and bun build in install.ps1
- Use -Encoding OEM for .cmd shims to preserve non-ASCII paths
- Use -Encoding UTF8 for built script with shebang
- Distinguish "not found on PATH" from "health check failed"
- Add fail-fast: false to CI matrix for independent OS results
- Fix stale comments: close() docstring, HOME references, CRLF note
- Add Windows sections to Chinese README and CONTRIBUTING.md
- Fix ambiguous "Both" wording in README prerequisites
- Merge prerequisites inline with installation heading
- Share git clone step, split into Linux/macOS and Windows subheadings
- Apply same structure to Chinese README
- Add extensionless bash shim alongside .cmd for Git Bash/MSYS2 compat
- Fall back to copy when symlinks fail (no Developer Mode)
- Use system default encoding for .cmd shims (locale-safe)
- Add spawnSync timeout to CLI tests (prevents hang when codex installed)
- Fix protocol test race: use local clients instead of shared afterEach
- Show only first result from 'where' in health check output
- Add installer smoke tests to CI for both platforms
On Windows, bun:test's expect(promise).rejects.toThrow() prevents the
event loop from reaching the I/O phase needed to flush Bun's FileSink
stdin buffer, causing request timeouts in tests 4 and 5.

Replace the four affected assertions with a captureErrorMessage() helper
that uses plain await (matching how production callers use the client),
which flushes correctly.

Also fix install.ps1 to write bash shims without a UTF-8 BOM using
[System.IO.File]::WriteAllText with UTF8Encoding($false), replacing
Set-Content -Encoding UTF8 which emits a BOM in PowerShell 5.1 and
breaks shebang recognition.
The bash wrapper script in install.ps1 used #!/usr/bin/env bun but
contained bash syntax (exec bun ...), causing Git Bash to pass it
to Bun which failed to parse it as JavaScript. Fixed both dev-mode
and build-mode shims to use #!/usr/bin/env bash.
- Log warnings on proc.kill() and taskkill failures instead of empty catches
- Check taskkill exit status via stdio: pipe
- Harden captureErrorMessage test helper to throw on unexpected resolve
- Wrap bun build in try/catch consistent with bun install
- Exit 1 when codex-collab health fails in installer
taskkill returns status null when the process is already dead (killed
by proc.kill()). Add null to the skip condition so this expected case
doesn't produce a noisy warning during health checks.
P1: Swap kill order in close() — run taskkill /T /F first to kill the
process tree, then proc.kill() as fallback. Previous order killed the
direct child first, removing the PID that taskkill needs to traverse
the tree when codex is invoked via a .cmd wrapper.

P2: Use UTF-8 encoding for .cmd shims instead of ASCII. ASCII encoding
corrupts non-ASCII path segments (e.g. Chinese directory names),
breaking dev installs in those locations.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23d73999ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
- Add npm install -g @openai/codex step before installer smoke tests
- Run install.ps1 in-session with Set-ExecutionPolicy Bypass so PATH propagates
- Simulate terminal reload in CMD step by reading PATH from registry
- Verify codex-collab --help and health from both pwsh and CMD shells
- Remove dead code in installer health check, add "open new terminal" hint
@Kevin7Qi Kevin7Qi force-pushed the feat/windows-support branch from 9c53f90 to e6f3500 Compare March 1, 2026 15:52
Kevin7Qi added 2 commits March 2, 2026 10:30
- Extract shim-creation block from install.ps1 if/else branches
- Hoist spawnSync import to top-level instead of dynamic await import
- Add inline comment for taskkill exit codes (128, null)
- Assert specific error message for run-without-prompt test
Avoids spurious "rollout" warnings from the Codex app-server when
killing a thread that was already killed or archived. Instead of
suppressing the errors, check local status in threads.json first
and early-exit if the thread is already marked as killed.
@Kevin7Qi Kevin7Qi merged commit 91786bd into main Mar 2, 2026
2 checks passed
@Kevin7Qi Kevin7Qi deleted the feat/windows-support branch March 2, 2026 06:07
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.

Native Windows support

1 participant