Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions NIGHTLY_CODEX_FINAL_ATTEMPT_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Implemented a small targeted fix for [issue #1880](https://github.com/openai/openai-python/issues/1880).

Changed [src/openai/cli/_tools/migrate.py](/home/runner/work/oss-nightly-control/oss-nightly-control/target/src/openai/cli/_tools/migrate.py:85) so the Windows migration CLI error now points users to WSL and clarifies that `openai migrate` downloads and invokes Grit directly, without `grit install` or PATH edits.

Added focused tests in [tests/cli/test_tools_migrate.py](/home/runner/work/oss-nightly-control/oss-nightly-control/target/tests/cli/test_tools_migrate.py:1), and wrote [NIGHTLY_REPORT.md](/home/runner/work/oss-nightly-control/oss-nightly-control/target/NIGHTLY_REPORT.md:1).

Verification passed:
- `pytest ... tests/cli/test_tools_migrate.py -q` → `2 passed`
- `ruff format --check ...` → passed
- `ruff check ...` → passed

I did not commit, push, or open a PR. Note: `.codex-nightly-prompt.md` and `uv.lock` were already untracked when I started; I left them alone.
6 changes: 5 additions & 1 deletion src/openai/cli/_tools/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ def _debug(message: str) -> None:
def install() -> Path:
"""Installs the Grit CLI and returns the location of the binary"""
if sys.platform == "win32":
raise CLIError("Windows is not supported yet in the migration CLI")
raise CLIError(
"Windows is not supported directly in the migration CLI. To migrate on Windows, "
"run `openai migrate` from WSL or another Linux/macOS shell; the command downloads "
"and invokes Grit itself, so you do not need to install `grit` or add it to PATH."
)

_debug("Using Grit installer from GitHub")

Expand Down
30 changes: 30 additions & 0 deletions tests/cli/test_tools_migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from __future__ import annotations

from pathlib import Path

import pytest

from openai.cli._tools import migrate
from openai.cli._errors import CLIError


def test_install_explains_how_to_migrate_on_windows(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(migrate.sys, "platform", "win32")

with pytest.raises(CLIError) as exc_info:
migrate.install()

message = str(exc_info.value)
assert "run `openai migrate` from WSL" in message
assert "do not need to install `grit` or add it to PATH" in message


def test_migrate_invokes_downloaded_grit_without_requiring_path(monkeypatch: pytest.MonkeyPatch) -> None:
calls: list[list[str | Path]] = []

monkeypatch.setattr(migrate, "install", lambda: Path("/tmp/grit"))
monkeypatch.setattr(migrate.subprocess, "check_call", calls.append)

migrate.migrate(migrate.MigrateArgs(unknown_args=["--force"]))

assert calls == [[Path("/tmp/grit"), "apply", "openai", "--force"]]