Skip to content

Tests: make unsloth_cli/tests/test_start.py pass on Windows - #15987

Merged
danielhanchen merged 3 commits into
mainfrom
tests-start-mode-bits-posix-only
Oct 29, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
tests-start-mode-bits-posix-only

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

unsloth_cli/tests/test_start.py has 9 tests that fail on Windows on main. They only show up when a PR touching unsloth start gets a Windows leg (first seen on the staging xplat run for #15865, which changes none of them), because the regular CI does not run this file on Windows. In each case the product does the right thing for Windows and the test encoded a POSIX-only expectation:

Test Windows failure Why
test_write_codex_subagent_bridge_keeps_parent_credentials_out, test_write_codex_parent_overlay_preserves_user_state_and_instructions assert (33206 & 63) == 0 st_mode & 0o077 is a POSIX promise; Windows reports 0o666 for any writable file, whatever os.open(..., 0o600) asked for
test_no_launch_last_line_is_self_contained, test_no_launch_claude_last_line_blanks_conflicting_auth KeyError: 'CODEX_HOME', no ANTHROPIC_API_KEY= they parse inline NAME=value cmd; on Windows --no-launch prints PowerShell, which the neighbouring test_no_launch_output_is_parseable already skips for
test_start_studio_server_builds_command_and_waits assert '-X' == 'run', then start_new_session is None on Windows the server is launched through this interpreter (python -X utf8 ..., #8490), so run is not cmd[1], and it is detached with CREATE_NEW_PROCESS_GROUP, not a POSIX session
test_connect_pi_as_subagent_preserves_cloud_parent[False/True] '...\\unsloth_cli\\pi_subagent.ts'.endswith('unsloth_cli/pi_subagent.ts') separator, compared as a POSIX path now
test_session_config_falls_back_when_existing_temp_root_is_unwritable, ..._when_studio_auth_root_is_unwritable the "unwritable" root was written to mkdir(mode = 0o500) / chmod(0o500) do not make a directory unwritable on Windows

What changed

  • The two mode-bit checks become os.name == "nt" or ... & 0o077 == 0.
  • The two last-line tests and the two unwritable-root tests skip on Windows, with the reason.
  • The studio server test finds run after the interpreter head on Windows and checks creationflags & CREATE_NEW_PROCESS_GROUP there; on POSIX it still requires cmd[1] == "run" and start_new_session=True.
  • The pi subagent test compares Path(command[2]).as_posix().

Nothing changes on Linux or macOS except that comparison.

Verification

  • Linux: unsloth_cli/tests/test_start.py 949 passed, 1 skipped.
  • With start.py's two os.open(..., 0o600) calls changed to 0o644, both credential tests fail on Linux, so the permission guard still bites where it means something.
  • Windows (staging windows-latest): the first push fixed the two mode-bit tests and showed the other 7; the second left only the server test's detach check (919 passed, 1 failed); this push covers it, and the leg is re-running.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T16:04:59.602038Z 02c6f9d Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: bc07429dea

ℹ️ 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".

…, interpreter launch head, path separators, chmod-only unwritable dirs)
@danielhanchen danielhanchen changed the title Tests: check the Codex bridge files' POSIX mode bits only off Windows Tests: make unsloth_cli/tests/test_start.py pass on Windows Oct 29, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 334884bbff

ℹ️ 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".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Oct 29, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 02c6f9d4e4

ℹ️ 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".

@danielhanchen
danielhanchen merged commit 41c39c4 into main Oct 29, 2026
0 of 40 checks passed
@danielhanchen
danielhanchen deleted the tests-start-mode-bits-posix-only branch October 29, 2026 16:16
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.

1 participant