Repository navigation
Studio CLI tests: keep the --secure re-exec tests off the cloudflared download - #17129
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
added a commit
that referenced
this pull request
Nov 8, 2026
…ichever rank fails first (#17151) ## Summary `Repo tests (CPU, rest)` fails on some PRs at a test #15880 added yesterday. Today that includes #17129 and #17132, neither of which touches context parallelism: ``` tests/test_remote_moe_shims.py:920: in test_without_context_parallelism_idle_experts_stall_ddp E AssertionError: Regex pattern did not match. E Expected regex: 'not close|finished reduction|did not receive grad' E Actual message: '-- Process 1 terminated with the following error: ... File "tests/test_remote_moe_shims.py", line 895, in _moe_ddp_worker assert got.grad is not None, name # a zero gradient, never None, for DDP AssertionError: experts.0.gate_proj.weight ``` The test is a negative control. With context parallelism off, each rank leaves the experts its peer routes to with a `None` gradient, so DDP without `find_unused_parameters` never reduces that bucket. The test expects the run to fail, and it does, every time. Which error the test sees depends on which of the two spawned ranks fails first: - the rank that **used** an expert holds an unreduced local gradient, and `assert_close` fails with `not close`, which the regex accepts; - the rank that left the **same** expert idle reaches `assert got.grad is not None` first, and that assertion's message is just the parameter name, which the regex does not accept. `torch.multiprocessing.spawn` reports whichever process dies first. So the test passes or fails on scheduling, while the product behaviour it checks is identical either way. Context parallelism itself is correct. The positive test next to it, with context parallelism on, passes. ## Change `tests/test_remote_moe_shims.py`, test only: - The worker's gradient assertion says what it found: `f"{name}: no gradient"`. - The negative control's regex also accepts `no gradient`, with a comment on why both ranks' errors are the same finding. The control still fails if context-parallel-off training ever stops stalling DDP, because then nothing raises at all. ## Testing | | result | |---|---| | main, with rank 0 delayed 3 s before its checks so rank 1 fails first (the CI case) | fails: `Regex pattern did not match`, `Process 1 terminated` | | this branch, same delay | passes | | this branch, `tests/test_remote_moe_shims.py` | 49 passed |
[skip ci]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
--securere-exec tests inunsloth_cli/tests/test_studio_secure_flag.pyandtest_studio_cloudflare_flag.pyreach the real_tunnel_binary_confirmed_unavailable()check. On a runner with no cachedcloudflared, that check downloads the binary from GitHub releases.When the download fails, the check reports cloudflared as unavailable and
run --securecorrectly refuses to start. No re-exec happens, so these six tests fail withassert 0 == 1:test_run_reexec_forwards_secure_polarity[--secure-...]test_run_secure_forces_localhost_in_reexectest_run_not_secure_alias_respects_last_wins[argv_order1-...]test_run_secure_resolves_tools_against_loopbacktest_run_secure_enable_tools_no_auto_yestest_run_reexec_forwards_cloudflare_polarity[extra_flags3-...]This happened on a CPU
restshard today. The log showedHTTP Error 504: Gateway Time-outoncloudflared-linux-amd64before each of these failures. The PR under test did not touch the CLI.Fix
An autouse fixture in both files stubs
_tunnel_binary_confirmed_unavailabletoFalse. These tests only check the re-exec argv.The real check stays covered by
test_studio_password_prompt.py, which already stubs it per test where needed and tests the function itself directly. The change is test-only.Tests
The two files plus
test_studio_password_prompt.py, run with an emptyUNSLOTH_STUDIO_HOMEand the network blocked (HTTPS_PROXYpointed at a closed port):ba22bb2051)With the network and a cached binary, the two files pass on both trees (47 passed).