Skip to content

[WS1][CUDA][Qwen3-Next] Follow-up to the RFC #428 stack: CI skip guard, case outcomes, worker attributes, user-site guard, CUDA_DEVICE_MAX_CONNECTIONS - #740

Open
fusheng-ji wants to merge 11 commits into
RL-Align:test-qwennextfrom
fusheng-ji:feat/qwen3-next-followup-20261119
Open

fusheng-ji wants to merge 11 commits into
RL-Align:test-qwennextfrom
fusheng-ji:feat/qwen3-next-followup-20261119

Conversation

@fusheng-ji

@fusheng-ji fusheng-ji commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

RFC #428 Qwen3-Next, follow-up to the merged stack (#503 → #551) (base test-qwennext).

  • It fixes the OpenCodeReview findings that arrived after the stack's last push, and two problems the chain hit on H100.
  • It changes no model or kernel code and no published number.

Evidence location: the run outputs behind the Results tables are not part of this PR's diff. They are on the fork's pr_assets branch under pending/qwen3-next-followup/ (links fixed to a commit).

What

  1. The four-GPU real-model CI step fails when a check is skipped (.github/workflows/qwen3-next-provider-gpu.yml, ecd28a81).
    • The step only asserted four visible GPUs. A missing vLLM, kernel or dtype support makes check_qwen3_next_vllm_model_contract.py and check_qwen3_next_vllm_real_model.py skip, and pytest exits 0 for an all-skipped run.
    • The step now uses the provider step's guard: set -o pipefail, a tee'd log, fail on any skip, and require at least one pass. (finding on #557)
  2. xfail and xpass are recorded as themselves (rl_engine/validation/models/pytest_case_manifest.py, qwen3_next_cases.py, add156f5).
    • The case recorder wrote skipped for both.
    • The verdict is unchanged: xfail counts as a skip and xpass as a failure, and either fails the run. (finding on #543)
  3. SharedQwenWorker sets its trace attributes before Worker.__init__ (qwen3_next_vllm_worker.py, e863c090). vLLM 0.30.0's constructor calls no model method, so nothing read them early; this guards against a later vLLM that does. (finding on #543)
  4. The environment identity refuses a user site that shadows the environment (tools/validation/models/qwen3_next/qwen3_next_runtime.py, 55928823).
    • The problem: on H100, every chain rollout smoke aborted while FlashInfer loaded (__ffi_repr__ already registered). apache-tvm-ffi 0.1.16 in the user site-packages was imported ahead of the environment's copy.
    • The fix: current_identity() now raises environment_mismatch when a distribution in the user site also exists in another installation root, naming the packages and PYTHONNOUSERSITE=1. docs/usage/qwen3-next-chain.md says so.
  5. Every chain stage runs with CUDA_DEVICE_MAX_CONNECTIONS=1 (tools/validation/models/qwen3_next/qwen3_next_run.py, 8284ce2b).
    • The problem: on H100 the l2 recompute failed in Megatron's validate_args, which requires this setting with tensor parallelism. The B200 runs did not hit the check, and the dense launcher already sets it.
    • It is set in the stage environment, not in provider_config.runtime_env, so the run manifest does not change.
Commit What
ecd28a81 ci: the four-GPU real-model step fails on any skipped check
add156f5 xfail and xpass recorded as their own case outcomes
e863c090 worker trace attributes set before the native constructor
55928823 refuse an environment whose user site shadows its packages
8284ce2b CUDA_DEVICE_MAX_CONNECTIONS=1 for every chain stage
be9b0285 merge of test-qwennext 12d50412 (#622, strict-provider files only; no overlap)
6dbfcfc2 the environment probe keeps the child's refusal and its failure kind
7e4c504c user-site pip and wheel do not count as shadowing
a20cb715 test: the worker's execution mode reaches vLLM's constructor
41f79bbe test: the activator gets the configured identity; a strict xpass is recorded as a failure
cfeadffd docs: the merged Qwen3-Next reports cite the re-uploaded evidence ZIPs; the RMSNorm docs link the rewritten pr_assets

Prior art & reuse decision

No item changes arithmetic, so batch invariance does not apply; the question for each is whether an existing mechanism already covers the case.

Item Existing mechanism Covers the case? Decision
1. CI step where every check skips pytest's exit status: 0 when every test skips (5 only when none is collected) No reused the provider step's existing guard (set -o pipefail, tee'd log, fail on any skip, require a pass)
2. xfail / xpass outcomes pytest's own report: outcome is skipped for an xfail and passed for a non-strict xpass, both with wasxfail set Yes, read as is reused: the recorder reads wasxfail with the outcome
3. Worker trace attributes vLLM 0.30.0 Worker.__init__ No hook before the constructor set in our subclass before super().__init__()
4. User site shadowing the environment PYTHONNOUSERSITE=1 / python -s remove the user site; pip check checks requirements, not which copy is imported Avoids it, but nothing detects it own check in current_identity() over importlib.metadata; the error names PYTHONNOUSERSITE=1 as the remedy
5. CUDA_DEVICE_MAX_CONNECTIONS Megatron requires 1 with tensor parallelism; the dense launcher (vime/experiments/dense/run_arm.py) sets it Yes reused the dense launcher's setting, in each stage environment

Decision: reuse pytest's outcomes, the provider step's guard and the dense launcher's setting; the only new check is item 4, which no existing tool provides.

Before and after

Results (B200 / Blackwell)

All at 8284ce2b, on 4 × B200.

Step Result
A. User-site guard (b200/tp4-chain/A) With a user-site apache-tvm-ffi planted, the identity probe and the preflight both fail with environment_mismatch: the user site-packages shadows apache-tvm-ffi. Clean, the probe exits 0
B. TP4 chain and the full batch-invariance matrix (b200/tp4-chain/B) preflight, layers, l2 and bi passed, each with source_commit 8284ce2b. bi-matrix.json: 97 of 97 cells passed. Chain report passed=True, 16 cells, no first drift. Gate: 17 passed, rc 0 (run with the environment's python; the node's python3 had no pytest)
C. EP4 chain (b200/ep4-chain) preflight, layers and l2 passed, TP4 EP4
D. The provider-GPU workflow's two steps, extracted as written (b200/ci-steps-and-cpu-suite/D) Provider step: 196 passed. Four-GPU step: 21 passed. No skips, both rc 0. _C built in the checkout
E. CPU suite, tests/models/qwen3_next/ 645 passed, 15 failed. All 15 are test_qwen3_next_training_checkpoint.py with AssertionError: Invalid device id in the training environment: its fixture patches torch.cuda.device_count to 0 before FlashInfer's first import. The file passes in the repository's reference environment, and this PR touches neither it nor the import path

Results (H100 / Hopper)

All at 8284ce2b on 4 × H100 (driver 580.173.02, torch 2.13.0+cu130, vLLM 0.30.0, FlashInfer 0.6.18.post1, TE 2.18.0, megatron-core 0.16.0rc0). The tester's SUMMARY.md has one row per step.

Step Result
A. User-site guard Without PYTHONNOUSERSITE, the identity and the preflight exit 1 with environment_mismatch, naming apache-tvm-ffi and the other shadowed packages. The preflight stops before using a GPU. With PYTHONNOUSERSITE=1 the identity exits 0
B. TP4 chain and bi full preflight, layers, l2 and bi passed at 8284ce2b. l2 passed without CUDA_DEVICE_MAX_CONNECTIONS exported by the caller: the stage environment sets it (item 5). bi-matrix.json: 97 of 97. Chain report passed=True, 16 cells. Gate rc 0
C. EP4 chain preflight, layers and l2 passed
D. The provider-GPU workflow's two steps Provider: 196 passed. Four-GPU: 21 passed. No skips, no ::error
E. CPU suite 645 passed, 15 failed: the same 15 Invalid device id tests as on B200

The first attempts of B and C ran on a node where another job held GPU memory: l2 reported gpu_memory_not_released, and the preflight found fewer than four usable GPUs. They are kept in not-green-attempts/, and their reruns on an idle node are the rows above.

Status

  • Head cfeadffd: the five commits on bcc549bf, a merge of test-qwennext 12d50412 ([ROCm] Add provider lock and execution checks #622's strict-provider files only, which these changes do not touch), two fixes from the bot round, two tests, and one docs commit for the re-uploaded evidence (cfeadffd). Every commit is signed off.
  • Measured at 8284ce2b on both GPUs (Results). The two later fixes change only the environment probe's error path and the user-site check, which the CPU tests cover.
  • Help wanted: none.

History

Tests

Command Environment Result
pytest on the follow-up's test files (test_qwen3_next_case_manifest.py, test_qwen3_next_operator_gates.py, test_qwen3_next_environment_identity.py, test_qwen3_next_run.py) and #622's (test_strict_provider.py ×3, test_strict_provider_manifest_cli.py, test_strict_provider_observer.py, test_provider_identity.py) training environment, head be9b0285 210 passed
pytest tests/models/qwen3_next/ 4 × B200 and 4 × H100, 8284ce2b 645 passed, 15 failed (the known Invalid device id group of the training environment; see Results)
the provider-GPU workflow's two steps 4 × B200 and 4 × H100, 8284ce2b 196 and 21 passed, no skips
the four-GPU step's script with stubbed pytest output all passed → 0; one skip, all skipped, a failure or no tests → non-zero
pytest check_qwen3_next_vllm_model_contract.py -k spawn_worker 1 × B200, head 41f79bbe 2 passed; at a20cb715 the new test failed when the worker set the mode to None
pytest test_qwen3_next_case_manifest.py training environment, head 41f79bbe 16 passed, the strict-xpass case included
mypy --ignore-missing-imports rl_engine/ as CI, without site-packages, head be9b0285 no errors in files this PR changes (the same 8 as test-qwennext, in two other files)
pre-commit run --from-ref 12d50412 --to-ref HEAD passed

Scope / Known limitations

  • No model, kernel or published number changes.

  • The 15 Invalid device id failures of test_qwen3_next_training_checkpoint.py come from the training environment (its FlashInfer import with a patched device count), not from this PR, and are not fixed here.

  • Not part of this PR:

    • the one-launch GDN recurrence (strict prefill 11.6 → 0.30 s on B200);
    • the end-to-end speed test.

    Both follow as their own PRs on top of this one.

  • Two other post-merge findings on [WS1][CUDA][Qwen3-Next] Batch-invariance matrix for the full model, 97/97 cells bitwise (RFC #428 stack 8/11) #544 are not bugs and get replies instead: the exact provider pins in the provider job are intentional, and CudaVocabParallelLogprobOp inherits apply_with_entropy.

…pped

The step only asserted four visible GPUs. A missing vLLM, kernel or
dtype support makes these modules skip, and pytest exits 0 for an
all-skipped run, so the job reported a real-model pass that never ran.
Apply the provider step's guard: tee the log, fail on any skip and
require at least one pass.

Signed-off-by: Wenbo Ji <[email protected]>
The case recorder wrote "skipped" for every report with wasxfail, so a
non-strict xpass of a mandatory case showed up as a skip. Record xfail
and xpass as themselves. The verdict is unchanged: xfail counts as a
skip and xpass as a failure, and either fails the run.

Signed-off-by: Wenbo Ji <[email protected]>
…constructor

SharedQwenWorker assigned shared_l2_trace and the execution mode after
Worker.__init__. vLLM 0.30.0's constructor calls no model method, so
nothing read them early, but an override reached from a later vLLM's
constructor would raise AttributeError. Assign both first; the contract
test checks they exist when the native constructor runs.

Signed-off-by: Wenbo Ji <[email protected]>
…ckages

On an H100 host every rollout smoke aborted while FlashInfer loaded
(__ffi_repr__ already registered): apache-tvm-ffi 0.1.16 in the user
site-packages was imported ahead of the environment's own copy. The
user site comes first on sys.path, so a package there replaces the
environment's copy, and the environment identity listed both without
flagging it.

current_identity() now raises environment_mismatch when a distribution
in the user site also exists in another installation root, and names
the packages and PYTHONNOUSERSITE=1. Packages only in the user site are
still recorded as before. The chain usage doc says so.

Signed-off-by: Wenbo Ji <[email protected]>
On four H100s the l2 recompute failed in Megatron's validate_args, which
requires CUDA_DEVICE_MAX_CONNECTIONS=1 with tensor parallelism. The B200
runs did not hit the check. The dense launcher already sets it; the
Qwen3-Next stage environment did not.

Set it next to the thread limits, outside provider_config.runtime_env,
so the run manifest does not change. It limits the hardware work queues
and does not change any kernel's arithmetic. The B200 chain has not been
rerun with it.

Signed-off-by: Wenbo Ji <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 299a0696-cea2-446c-bf3e-be0413fdd272

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 1 issue(s) in this PR.

  • ✅ Successfully posted inline: 0 comment(s)
  • 📋 Routed to summary by policy: 1 comment(s)

⚠️ 3 warning(s) occurred during review.


test · low

📄 tests/models/qwen3_next/test_qwen3_next_case_manifest.py (L80-L81)

⚠️ GitHub could not post this as an inline comment: Routed to summary (severity low · category test)

The xfail marker here has no reason, so for the passing (xpass) reports pytest sets report.wasxfail to the empty string "". Any classification code that checks if report.wasxfail: (truthiness) rather than is not None will treat this XPASS as an ordinary pass, so the xpass/strict-xpass cases here would either fail for the wrong reason or not exercise the intended xfail/xpass branch at all — the test then proves less than it appears to. Give the marker an explicit reason so wasxfail is non-empty, matching how real xfail markers are written.

💡 Suggested Change

Before:

    if outcome in ("xpass", "strict-xpass"):
        marker = f"@pytest.mark.xfail(strict={outcome == 'strict-xpass'})\n"

After:

    if outcome in ("xpass", "strict-xpass"):
        marker = (
            f"@pytest.mark.xfail(strict={outcome == 'strict-xpass'}, reason='expected failure')\n"
        )

⚠️ Warnings:

  • rl_engine/validation/models/pytest_case_manifest.py,rl_engine/validation/models/qwen3_next/qwen3_next_cases.py,tools/validation/models/qwen3_next/qwen3_next_run.py,tools/validation/models/qwen3_next/qwen3_next_runtime.py (review_limit_reached): reached the aggregate token budget before finishing; the grace round completed the task
  • tests/models/qwen3_next/check_qwen3_next_vllm_model_contract.py,tests/models/qwen3_next/test_qwen3_next_case_manifest.py,tests/models/qwen3_next/test_qwen3_next_environment_identity.py,tests/models/qwen3_next/test_qwen3_next_run.py (review_limit_reached): reached the aggregate token budget before finishing; the grace round did not complete the task
  • tests/models/qwen3_next/check_qwen3_next_vllm_model_contract.py (token_budget_reached): stopped group "tests/models/qwen3_next/check_qwen3_next_vllm_model_contract.py,tests/models/qwen3_next/test_qwen3_next_case_manifest.py,tests/models/qwen3_next/test_qwen3_next_environment_identity.py,tests/models/qwen3_next/test_qwen3_next_run.py" mid-review: used 622194 tokens exceeds budget 500000

@github-actions

Copy link
Copy Markdown

@fusheng-ji The automated OCR review has completed.

Please review and address all automated review bot findings, then push your updates. Maintainers will begin manual review after the bot findings have been addressed.

probe_environment ran qwen3_next_runtime.py --json with check_output, so a refusal in the
child (environment_mismatch for a shadowing user site) reached the launcher as a bare
'returned non-zero exit status 1'. It now captures the child's stderr and raises a
ProcessFailure with its tail and failure_kind. New test with a refusing stand-in interpreter
(fails on the old code).

Signed-off-by: Wenbo Ji <[email protected]>
Any pip install --user leaves pip (and often wheel) in the user site next to the
environment's copies, and the guard refused every run on such a machine although no stage
imports them. They are now exempt. setuptools stays in the check: torch.utils.cpp_extension
imports it for the JIT builds the stages allow. New test.

Signed-off-by: Wenbo Ji <[email protected]>
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Nov 22, 2026
@fusheng-ji

Copy link
Copy Markdown
Contributor Author

Reply to the OpenCodeReview finding routed to the summary (run on be9b0285).

tools/validation/models/qwen3_next/qwen3_next_runtime.py L167-170: the user-site refusal reaches the launcher as an opaque exit status. Fixed in 6dbfcfc2. probe_environment() now captures the child's stderr. On a non-zero exit it raises ProcessFailure with the stderr tail in the message and failure_kind=failure_kind(text=stderr), so the launcher's own error names environment_mismatch and the shadowed packages. New test test_probe_keeps_the_child_refusal_and_its_failure_kind, with a stand-in interpreter that refuses; it fails on the old code.

Two details of the finding do not hold:

  • The child's stderr was not lost: the B200 and H100 step-A logs show environment_mismatch: the user site-packages shadows apache-tvm-ffi, ....
  • prepare() writes no status file for any failure before run.json, so nothing was classified unknown. The fix only makes the launcher's own message carry the cause.

The related finding raised on #745 (installers in the user site) is fixed here too, in 7e4c504c: see the reply there.

@fusheng-ji

Copy link
Copy Markdown
Contributor Author

Reply to the OpenCodeReview finding routed to the summary (run on 7e4c504c).

tests/models/qwen3_next/test_qwen3_next_case_manifest.py L77: the xpass literal. Not changed. The plugin writes that literal itself.

  • CaseManifestPlugin.pytest_runtest_logreport (rl_engine/validation/models/pytest_case_manifest.py) maps a report with wasxfail to "xpass" when pytest says passed, and to "xfail" otherwise.
  • execution_verdict counts xpass under failures and sets passed to false.
  • The test does not hard-code what pytest produces. It runs a real pytest subprocess with the plugin on a non-strict xfail marker that passes, then reads the plugin's report: outcomes[case]["call"] == "xpass", counts["failures"] == 1, passed false and exit status 1.

…e constructor

The existing check builds the worker without a config, so the mode it sees
is None. The new check passes a config with an identity and asserts that
the mode activated for it is already set when vLLM's Worker.__init__ runs;
it fails if the worker drops the mode.

Signed-off-by: Wenbo Ji <[email protected]>
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Nov 23, 2026
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Nov 23, 2026
@Flink-ddd Flink-ddd added platform: cuda Specific optimizations or bugs in NVIDIA graphics cards (such as FlashInfer, TMA optimizations) new-model qwen WS1 labels Nov 24, 2026
…s a failure

The worker execution-mode test also checks that the activator gets the
configured identity itself, so a dropped or different identity fails it.

A strict xpass gets its own case in the plugin test: pytest reports it as
"failed" without wasxfail, and the report counts it under failures.

Signed-off-by: Wenbo Ji <[email protected]>
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Nov 24, 2026
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Nov 24, 2026
@fusheng-ji

Copy link
Copy Markdown
Contributor Author

Replies to the two OpenCodeReview findings routed to the summary (run on a20cb715).

Both (L190 and L198, the activator stub ignores which identity it gets) are fixed in 41f79bbe.

  • The stub now records the identity it is called with.
  • The test asserts activated == [identity] and activated[0] is identity, and seen == [mode]. So it fails if the worker passes another identity or none, or if the mode is not set before vLLM's Worker.__init__.

…_assets

The release ZIPs were re-uploaded with the B200 PCI bus IDs masked, and
pr_assets was rewritten to remove host and user identifiers. The merged
batch-invariance, chain and EP4 logprob reports cite the ZIPs' new SHA-256,
and the two RMSNorm docs link pr_assets c44f3f1 (was 692c408), which holds
the same files.

Signed-off-by: Wenbo Ji <[email protected]>
fusheng-ji added a commit to fusheng-ji/RL-Kernel that referenced this pull request Nov 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-model platform: cuda Specific optimizations or bugs in NVIDIA graphics cards (such as FlashInfer, TMA optimizations) qwen WS1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants