Skip to content

Commit 3c42e63

Browse files
committed
Advance OSS contribution for openai migration on Windows WSL error. instructions are wrong
Nightly Codex produced a focused contribution for #1880. Constraint: Automated nightly run; keep changes small and reviewable. Confidence: medium Scope-risk: narrow Tested: See uploaded nightly artifacts and workflow logs. Not-tested: Maintainer CI beyond this workflow.
1 parent 94c88b8 commit 3c42e63

3 files changed

Lines changed: 47 additions & 1 deletion

File tree

NIGHTLY_CODEX_FINAL_ATTEMPT_1.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Implemented a small targeted fix for [issue #1880](https://github.com/openai/openai-python/issues/1880).
2+
3+
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.
4+
5+
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).
6+
7+
Verification passed:
8+
- `pytest ... tests/cli/test_tools_migrate.py -q``2 passed`
9+
- `ruff format --check ...` → passed
10+
- `ruff check ...` → passed
11+
12+
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.

src/openai/cli/_tools/migrate.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ def _debug(message: str) -> None:
8282
def install() -> Path:
8383
"""Installs the Grit CLI and returns the location of the binary"""
8484
if sys.platform == "win32":
85-
raise CLIError("Windows is not supported yet in the migration CLI")
85+
raise CLIError(
86+
"Windows is not supported directly in the migration CLI. To migrate on Windows, "
87+
"run `openai migrate` from WSL or another Linux/macOS shell; the command downloads "
88+
"and invokes Grit itself, so you do not need to install `grit` or add it to PATH."
89+
)
8690

8791
_debug("Using Grit installer from GitHub")
8892

tests/cli/test_tools_migrate.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from __future__ import annotations
2+
3+
from pathlib import Path
4+
5+
import pytest
6+
7+
from openai.cli._tools import migrate
8+
from openai.cli._errors import CLIError
9+
10+
11+
def test_install_explains_how_to_migrate_on_windows(monkeypatch: pytest.MonkeyPatch) -> None:
12+
monkeypatch.setattr(migrate.sys, "platform", "win32")
13+
14+
with pytest.raises(CLIError) as exc_info:
15+
migrate.install()
16+
17+
message = str(exc_info.value)
18+
assert "run `openai migrate` from WSL" in message
19+
assert "do not need to install `grit` or add it to PATH" in message
20+
21+
22+
def test_migrate_invokes_downloaded_grit_without_requiring_path(monkeypatch: pytest.MonkeyPatch) -> None:
23+
calls: list[list[str | Path]] = []
24+
25+
monkeypatch.setattr(migrate, "install", lambda: Path("/tmp/grit"))
26+
monkeypatch.setattr(migrate.subprocess, "check_call", calls.append)
27+
28+
migrate.migrate(migrate.MigrateArgs(unknown_args=["--force"]))
29+
30+
assert calls == [[Path("/tmp/grit"), "apply", "openai", "--force"]]

0 commit comments

Comments
 (0)