Skip to content

[Cherry-pick] PRs #3491 #3492 #3501 - #3538

Open
sychen52 wants to merge 3 commits into
release/0.49.0from
codex/cherry-pick-0.49.0-20261123
Open

sychen52 wants to merge 3 commits into
release/0.49.0from
codex/cherry-pick-0.49.0-20261123

Conversation

@sychen52

@sychen52 sychen52 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Cherry-picked PRs

Summary by CodeRabbit

  • Behavior Changes
    • Job submissions no longer allow callers to choose a source revision; they use the operator-configured revision or the default.
    • Source repositories are limited to the configured repository or the default NVIDIA Model-Optimizer repository. Other repository URLs are rejected.
  • Documentation
    • Corrected wording and product-name references in the tutorials and documentation.
    • Updated the job-submission guidance to reflect the available source and repository settings.

sychen52 and others added 3 commits November 23, 2026 10:42
### What does this PR do?

Type of change: documentation

**Problem:** The `tools/mcp/README.md` usage example names a real
internal cluster login node as `cluster_host`.

**Fix:** Replace it with the placeholder `login.cluster.example.com`,
matching the `*.example.com` hosts the MCP tests already use.

### Testing

Docs-only. `git grep` finds no other internal login hostnames in the
tree.

### Before your PR is "*Ready for review*"

- Is this change backward compatible?: N/A
- If you copied code from any other sources or added a new PIP
dependency, did you follow guidance in `CONTRIBUTING.md`: N/A
- Did you write any new necessary tests?: N/A
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A
- Did you get Claude approval on this PR?: N/A

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Documentation**
* Updated the remote Slurm workflow example to use a generic cluster
login hostname consistently in the connection check and job submission
examples. The sample response now uses `login` as the hostname.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

(cherry picked from commit d2d92b0)

Co-authored-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
Signed-off-by: sychen52 <41452870+sychen52@users.noreply.github.com>
### What does this PR do?

Type of change: Bug fix

**Problem:** `submit_job` lets the calling agent choose which code the
MCP server checks out and runs locally (`uv run --with-editable`,
including on `dry_run=True`):
- `source_repo` accepts any git URL.
- `source_ref` accepts any ref or SHA, and on GitHub the parent repo
also serves refs and commits from its forks.

**Fix:**
- `source_repo` now accepts only the public NVIDIA/Model-Optimizer repo
or the one the operator set in `MODELOPT_MCP_SOURCE_REPO`. Anything else
returns `reason: source_repo_not_allowed` before any git command runs.
- `source_ref` is removed from the `submit_job` tool. The ref comes only
from the operator's `MODELOPT_MCP_SOURCE_REF`, defaulting to `main`.

### Testing

- `cd tools/mcp && python -m pytest tests`: 92 passed, 4 skipped.
- `test_ensure_source_checkout_source_repo_allowlist` covers the default
repo, an env-configured fork, an unlisted URL and a local path. The two
rejection cases fail without the fix.
- `test_source_ref_is_operator_only` checks that the `submit_job` tool
schema has no `source_ref` and that the checkout uses
`MODELOPT_MCP_SOURCE_REF`. It fails without the fix.

### Before your PR is "*Ready for review*"

- Is this change backward compatible?: ❌ Agents can no longer pass
`source_ref`, or a `source_repo` other than the default or
`MODELOPT_MCP_SOURCE_REPO`. Operators set `MODELOPT_MCP_SOURCE_REF` /
`MODELOPT_MCP_SOURCE_REPO` in the MCP server environment instead.
- If you copied code from any other sources or added a new PIP
dependency, did you follow guidance in `CONTRIBUTING.md`: N/A
- Did you write any new necessary tests?: ✅
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
N/A
- Did you get Claude approval on this PR?: ❌

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Behavior Changes**
* Managed checkouts use the operator-configured source version,
defaulting to `main`. The job submission tool no longer accepts a source
version; the managed checkout version is controlled through the
`MODELOPT_MCP_SOURCE_REF` setting and is resolved against the selected
repository.
* Submissions and dry runs accept only the default Model-Optimizer
repository or the operator-configured repository. Other repository URLs
are rejected.
* **Documentation**
* Updated the submission guidance to reflect the source-version setting
and repository restrictions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

(cherry picked from commit 8579444)

Co-authored-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
Signed-off-by: sychen52 <41452870+sychen52@users.noreply.github.com>
### What does this PR do?

Type of change:  Bug fix: https://nvbugs/7126379

**Problem:** The 0.49.0rc0 documentation QA check (LLM Doc Check) caught
4 typos and missing words in published API docstrings, example READMEs,
and notebooks (`count such a checkpoint one ...` missing `as`,
`algorithm it to find`, `ModelOpt-Window` missing `s`, and `include you
token`).

**Fix:** Fixes the 4 typos in place across the docstring, two example
READMEs, and one notebook markdown cell. Text-only change with no
runtime or API impact.


### Usage

```python
N/A
```

### Testing
- Ran `pre-commit` on all changed files (`ruff check`, `ruff format`,
`mypy`, `check json`, `markdownlint-cli2`, `bandit`) and `typos`: all
passed.
- Verified `examples/llm_qat/notebooks/QAT_QAD_Walkthrough.ipynb`
remains valid JSON with only the markdown cell text updated.

### Before your PR is "*Ready for review*"

- Is this change backward compatible?: ✅ 
- If you copied code from any other sources or added a new PIP
dependency, did you follow guidance in `CONTRIBUTING.md`: N/A
- Did you write any new necessary tests?: N/A 
- Did you update
[Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:N/A
- Did you get Claude approval on this PR?: N/A

### Additional Information
N/A


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Documentation**
  * Corrected typos and product naming in example guides.
  * Clarified the expert-parallel checkpoint support documentation.
  * Updated the notebook’s Hugging Face token instructions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Noey Yang <174223378+noeyy-mino@users.noreply.github.com>

(cherry picked from commit 9373b18)

Co-authored-by: noeyy-mino <174223378+noeyy-mino@users.noreply.github.com>
Signed-off-by: sychen52 <41452870+sychen52@users.noreply.github.com>
@sychen52
sychen52 requested review from a team as code owners November 23, 2026 18:43
@sychen52
sychen52 requested review from ChenhanYu, grzegorz-k-karch, kinjalpatel27, meenchen and ynankani and removed request for a team November 23, 2026 18:43
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The MCP submission API no longer accepts a caller-supplied source ref, and managed checkouts restrict repository selection. The README and tests reflect these rules. Four other edits correct wording in examples and documentation.

Changes: MCP managed source selection

Layer / File(s) Summary
Submission contract and managed checkout
tools/mcp/modelopt_mcp/server.py, tools/mcp/modelopt_mcp/bridge.py, tools/mcp/tests/test_bridge.py, tools/mcp/README.md
submit_job no longer accepts or forwards source_ref. Managed checkout resolves its ref from MODELOPT_MCP_SOURCE_REF or defaults to main. The checkout accepts only the configured repository or the default repository. Tests and README examples document and check these rules.

Example and documentation wording

Layer / File(s) Summary
Wording corrections
examples/llm_qat/notebooks/QAT_QAD_Walkthrough.ipynb, examples/puzzletron/README.md, examples/windows/README.md, modelopt/torch/models/specs.py
Corrected a token instruction typo, a tutorial sentence, the Windows product name, and wording in the decompressed_formats documentation.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Agent
  participant submit_job
  participant submit_job_impl
  participant _ensure_source_checkout
  Agent->>submit_job: Submit job with optional source_repo
  submit_job->>submit_job_impl: Forward source_repo
  submit_job_impl->>_ensure_source_checkout: Resolve managed checkout
  _ensure_source_checkout-->>submit_job_impl: Use configured ref or default main
Loading

Possibly related PRs

Merge Risk: Minimal · up to a29c5

This change moves checkout ref and repository selection from the calling agent to operator configuration, and it fixes a few documentation typos. The change is covered by tests and no concrete merge risk was found.

Security architecture risk: Minimal · up to a29c5

The change removes callers’ ability to choose a checkout revision and limits them to approved repositories. The review did not identify a new or worsened security risk. Deployments that relied on per-request revision pins should set the intended revision before upgrading.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The narrower policy limits what a caller who can invoke submit_job can select for execution on the MCP host. It does not itself change the launcher’s privileges or the downstream Docker and Slurm execution model.

Trust Boundaries and Controls

  • observed — Configuring a custom repository changes the default, not the set of sources to that repository alone. A caller can still choose the public upstream, and the same operator-selected branch or tag can resolve to different commits in the two repositories.

Hardening Proposals

  • proposed — For deployments that require a single approved source, enforce an operator-owned repository and immutable commit together rather than treating a custom repository setting as an exclusive policy.
Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Inconclusive The title "[Cherry-pick] PRs #3491 #3492 #3501" names only the cherry-pick action and PR numbers. It does not describe the main change, which restricts MCP submit_job checkouts to the allowed reposito… Rewrite the title to name the main change. For example: "[Cherry-pick] Restrict MCP submit_job source repo and ref to operator configuration (release/0.49.0)". Keep the PR numbers if the release team needs them.
Passed Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns Passed The security anti-pattern check finds no listed pattern in the pull request's added lines. Scope and evidence: - The diff changes 8 files: 3 Markdown READMEs, 1 notebook (.ipynb), `modelopt/torch/mode…
Full details: Security Anti-Patterns

Explanation

The security anti-pattern check finds no listed pattern in the pull request's added lines. Scope and evidence: - The diff changes 8 files: 3 Markdown READMEs, 1 notebook (.ipynb), modelopt/torch/models/specs.py, the MCP README, tools/mcp/modelopt_mcp/bridge.py, tools/mcp/modelopt_mcp/server.py, and tools/mcp/tests/test_bridge.py. - A grep of all added lines in the diff found no torch.load, numpy.load/np.load, allow_pickle, trust_remote_code, eval(, exec(, or nosec. - No pyproject.toml or requirements*.txt file changed, so criterion 6 does not apply. Per criterion: 1. torch.load(..., weights_only=False): not added. 2. numpy.load(..., allow_pickle=True): not added. 3. Hardcoded trust_remote_code=True: not added. 4. eval()/exec() on external input: not added. 5. # nosec: not added. 6. New non-permissive pip dependencies: no dependency files changed. The modelopt/torch/models/specs.py change is a docstring edit only. The tools/mcp changes are outside the stated scope (modelopt package and examples). Even if they were in scope, they add no listed pattern. They remove source_ref and restrict source_repo to an allowlist, which tightens input handling. The bridge code passes the repository and ref to git-related helpers, but no listed anti-pattern appears in that code. The supplied review findings report zero actionable findings. Those findings were not used for this verdict.

Full details: Title check

Explanation

The title "[Cherry-pick] PRs #3491 #3492 #3501" names only the cherry-pick action and PR numbers. It does not describe the main change, which restricts MCP submit_job checkouts to the allowed repositories and moves ref selection to operator configuration. The title is vague because it lacks any descriptive terms about the changes, so the check is inconclusive.

Resolution

Rewrite the title to name the main change. For example: "[Cherry-pick] Restrict MCP submit_job source repo and ref to operator configuration (release/0.49.0)". Keep the PR numbers if the release team needs them.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5fb4a01 and a29c5d4.

Files selected for processing: 8

  • examples/llm_qat/notebooks/QAT_QAD_Walkthrough.ipynb
  • examples/puzzletron/README.md
  • examples/windows/README.md
  • modelopt/torch/models/specs.py
  • tools/mcp/README.md
  • tools/mcp/modelopt_mcp/bridge.py
  • tools/mcp/modelopt_mcp/server.py
  • tools/mcp/tests/test_bridge.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/Model-Optimizer/pr-preview/pr-3538/

Built to branch gh-pages at 2026-11-23 18:49 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.23%. Comparing base (5fb4a01) to head (a29c5d4).

Additional details and impacted files
@@                Coverage Diff                 @@
##           release/0.49.0    #3538      +/-   ##
==================================================
- Coverage           79.33%   71.23%   -8.11%     
==================================================
  Files                 721      721              
  Lines               81235    81235              
==================================================
- Hits                64451    57870    -6581     
- Misses              16784    23365    +6581     
Flag Coverage Δ
examples-diffusers 19.83% <ø> (-0.03%) ⬇️
examples-llm_qat 17.27% <ø> (-0.09%) ⬇️
examples-specdec_bench 13.27% <ø> (-0.04%) ⬇️
examples-torch_trt 15.19% <ø> (-0.05%) ⬇️
examples-vllm_serve 17.53% <ø> (-0.05%) ⬇️
gpu 15.48% <ø> (-39.87%) ⬇️
regression 14.95% <ø> (-0.05%) ⬇️
unit 64.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant