Skip to content

feat(codex): add Windows support and compatibility for Codex plugin#101

Open
SparshGarg999 wants to merge 1 commit into
microsoft:mainfrom
SparshGarg999:fix/46-windows-support-codex
Open

feat(codex): add Windows support and compatibility for Codex plugin#101
SparshGarg999 wants to merge 1 commit into
microsoft:mainfrom
SparshGarg999:fix/46-windows-support-codex

Conversation

@SparshGarg999

Copy link
Copy Markdown

Root Cause

The Codex integration for skillopt-sleep was previously designed primarily for Unix-like environments, using bash runner scripts (run-sleep.sh), unix-style mkdir -p directory creation in the scheduler, shell profile export paths, and a Unix bash installer (install.sh). This caused installation and execution to fail when running under Windows CMD or PowerShell. Additionally, the Codex CLI backend did not support Windows-style tool shims (.cmd), unlike the Copilot backend.

Solution

This PR adds comprehensive Windows compatibility and support for the Codex plugin:

  1. Added Windows Install/Runner Scripts:
    • plugins/codex/install.ps1: A PowerShell installer for Windows that replicates the exact logic of install.sh (copies skill files, retires legacy prompts, and suggests User-level environment variable setup).
    • plugins/run-sleep.cmd: A CMD runner wrapper.
    • plugins/run-sleep.ps1: A PowerShell runner wrapper.
  2. Exposed Windows execution steps:
    • Updated the Codex skill definition plugins/codex/skills/skillopt-sleep/SKILL.md to include Windows CMD and PowerShell commands, allowing Codex to run correctly in Windows terminals.
    • Updated plugins/codex/README.md with Windows installation instructions.
  3. Cross-Platform Backend Shims:
    • Updated resolve_codex_path in skillopt_sleep/backend.py to search Windows global Node/npm/NVM directories (e.g. %APPDATA%\npm\codex.cmd).
    • Updated CodexCliBackend.attempt_with_tools in skillopt_sleep/backend.py to write Windows-style .cmd tool shims when running on Windows (os.name == "nt").
  4. Scheduler Portability:
    • Updated _runner_cmd in skillopt_sleep/scheduler.py to produce a Windows CMD-compatible directory creation and launch string when sys.platform == "win32".

Files Changed

  • plugins/codex/README.md
  • plugins/codex/skills/skillopt-sleep/SKILL.md
  • skillopt_sleep/backend.py
  • skillopt_sleep/scheduler.py
  • tests/test_sleep_engine.py
  • plugins/codex/install.ps1 (NEW)
  • plugins/run-sleep.cmd (NEW)
  • plugins/run-sleep.ps1 (NEW)

Testing/Benchmark Performed

  1. Added unit tests test_codex_resolve_path_windows and test_codex_attempt_with_tools_windows to tests/test_sleep_engine.py to verify path resolution and .cmd shim generation.
  2. Normalized unix/windows path formats in test_sleep_engine.py to ensure cross-platform test parity.
  3. Successfully ran the entire core sleep engine test suite:
    python -m pytest tests/test_sleep_engine.py tests/test_json_utils.py tests/test_mcp_schema.py tests/test_plugin_sync.py tests/test_types.py
    (129 passed, 4 skipped)
  4. Ran the deterministic sleep experiment locally to verify improvements:
    python -m skillopt_sleep.experiments.run_experiment --persona researcher --assert-improves
    (PASS: lift +0.6667, gate blocks harmful edits)

Fixes #46

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.

Feat: Add Windows support / compatibility for Codex plugin

1 participant