← Back to Pull requests

fix(cc): run clang in cl mode through a clang-cl alias of the shim #1080

Closed
unknown closed this pull request without merging on Dec 04, 2026 03:17 UTC
View on GitHub
unknown unknown commented on Dec 04, 2026 02:42 UTC
Author

A clang-cl link that points at mbx's clang shim now runs clang in its cl.exe mode. cargo-xwin makes such a link to whichever clang is first on PATH.

Before this change mbx did not recognize the name clang-cl and ran its own CLI instead:

$ ln -s "$(command -v clang)" bin/clang-cl   # `clang` resolves to the shim
$ bin/clang-cl --version
mbx 1.32.0

Now the call reaches the real clang with --driver-mode=cl. A --driver-mode the caller passes still wins. This works both inside mbx exec and after the session has ended. These compilations are not cached.

Validation: a new unit test and a Bats case that runs the alias inside and after mbx exec; all 19 cases in test/cc_standalone_exec.bats pass on macOS arm64. I reproduced the original failure with hand-made links, not a cargo-xwin build. In a local mise run ci, test:pretty timed out on test --test custom (as it did on other branches on this machine), which stopped the run before the full Bats suite.

AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: unavailable.

🤖 Generated with Claude Code

<!-- CURSOR_SUMMARY -->
---

[!NOTE]

Low Risk

Isolated cc-shim alias path with transparent compile only; no caching or auth changes, with unit and integration tests added.

> Overview

Fixes clang-cl symlinks to the mbx clang shim (as cargo-xwin does): invocations no longer print mbx’s version/help and instead run the real clang with --driver-mode=cl, with a caller-supplied --driver-mode still taking precedence (prepended first, clang uses the last flag).

> Recognition is added in cc_shim_language for the alias name mbx does not install itself. run_cc_shim branches early into run_clang_cl_alias, which resolves clang via session pins or compiler_on_path, not MBX_REAL_CC. These runs skip the cc cache and use run_transparent_cc. real_compiler’s PATH walk is factored into compiler_on_path for reuse.

> Docs note the behavior; unit and Bats tests cover driver-mode ordering and cl-mode help output inside and after mbx exec.

> <sup>Reviewed by Cursor Bugbot for commit e648edeec774fae4503207b5405e37e6570a827d. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

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

Summary by CodeRabbit

New Features
clang-cl aliases that point to the clang shim now run Clang in cl.exe mode. These compilations are not cached.
Documentation
Clarified how clang-cl aliases behave with mbx exec.
Tests
Added coverage for clang-cl alias behavior and compatibility help output.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 373 lines (+279 / -94) across 4 files Reviewer: jdx Review duration: 35m
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 373 lines diff across 4 files
0.43
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.354
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1080"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 42.8% (MEDIUM) · Higher = larger blast radius
42.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 18.5% · Safe to merge
18.5%