Skip to content

Studio: pin MXC 1.1.0 where Windows has the built-in container, fall back to 1.0.1 elsewhere - #19443

Merged
danielhanchen merged 14 commits into
mainfrom
studio-mxc-1-1-0-dual-pin
Nov 25, 2026
Merged

danielhanchen merged 14 commits into
mainfrom
studio-mxc-1-1-0-dual-pin

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Studio pins Microsoft MXC 0.8.0. npm's latest is 1.1.0, and on the built-in Windows container 0.9.0 and newer run about 20 ms faster per call: 103 vs 127 ms for a shell command and 110 vs 135 ms for Python on Windows 11 ARM64, measured with bare wxc-exec and Studio's own policy.

1.1.0 cannot simply replace 0.8.0. It removed the AppContainer + DACL tier and wxc-host-prep (microsoft/mxc#1558), so it runs only where Windows has the built-in container (BaseContainer): Windows 11 at build 26100.9278, 26200.9278, 26300.9550, 28000.2804 or newer. On Windows Server 2025 and 2022 it refuses every launch, while --probe still exits 0 and names no tier.

This PR pins both:

  • 1.1.0 where Windows has the built-in container.
  • 1.0.1 everywhere else. It is the newest release that still has the AppContainer + DACL tier and wxc-host-prep, so those PCs keep today's opt-in fallback sandbox.

How the pin is chosen

mxc_runtime.selected_pin():

  1. UNSLOTH_MXC_PIN=1.1.0 or 1.0.1 forces a pin.
  2. Windows Server (product type other than workstation), or a Windows 11 build below the floor for its release, gets 1.0.1. The floors are the ones Studio already used for its "update Windows" hint, now kept in mxc_runtime.BUILTIN_CONTAINER_MIN_UBR.
  3. Everything else gets 1.1.0. That includes builds newer than the table, Insider builds between its rows, and a Windows version that cannot be read.
  4. When 1.1.0 was chosen automatically, the installer verifies it in its staging folder and runs that copy's wxc-exec --probe before it replaces anything. If the probe reports any tier other than base-container, or none, the installer installs 1.0.1 instead and only then records that for this exact Windows release (mxc-runtime/pin-demoted.json). A Windows update changes the release, so 1.1.0 is tried again after it. A probe that fails or prints no report is no verdict: it never demotes, and it never replaces a working 1.0.1 with an unproven 1.1.0. A failed 1.0.1 install records nothing, so the next run asks again. The marker and journal live beside --install-dir, so a custom UNSLOTH_HOME keeps them together.

Both pins install into the same mxc-runtime/windows-<arch> folder. setup.ps1 and Desktop are unchanged and still call install_mxc_prebuilt.py --install-dir ... on every setup and update. A PC that crosses the floor after a Windows update keeps running its installed 1.0.1, which also uses the built-in container, until the next update or the Settings install button installs 1.1.0. target_pin() is what the installer installs; selected_pin() is what Studio runs, which is the same except for that case.

What changes

  • Pins (mxc_runtime.MxcPin, PRIMARY_PIN, LEGACY_PIN): version, release commit, archive size and SHA-256, and per-architecture wxc-exec.exe (plus wxc-host-prep.exe for 1.0.1) member, size and SHA-256. I downloaded each archive from npm, checked it against npm's dist.integrity, and hashed every member. All of them carry a valid Microsoft Corporation Authenticode signature.
  • Policy schema 1.0.0 (mxc_policy.build_launch_request). 1.0 and newer reject 0.8.0-alpha. The only change the parser demands is the network section: {"egress": {"default": "allow"}, "ingress": {"default": "allow", "hostLoopback": "deny"}}.
    • This keeps 0.8.0's behaviour: internet allowed, host loopback blocked.
    • deny is also the only hostLoopback value the DACL tier accepts.
    • PROFILE_ID moves to -v3, so cached capability verdicts from the 0.8.0 profile are not reused.
  • Runtime identity includes the pin's version and commit, so a probe verdict for one pin never answers for the other.
  • The fallback sandbox exists only on the 1.0.1 pin:
    • probe_host_prep_steps() returns nothing to prepare on 1.1.0.
    • mxc_policy.dacl_fallback_enabled() is always off on 1.1.0, so a choice saved under 0.8.0 or 1.0.1 never adds grants or leases, or asks for allowDaclMutation, there.
    • The setup plan for a 1.1.0 PC only offers the runtime install (the same windows-setup action Chat and Settings already show), never the consent or the administrator step, and its remediation text no longer points at the fallback sandbox.
  • Installer (install_mxc_prebuilt.py):
    • It downloads and verifies the selected pin.
    • Before replacing a runtime that has the DACL tier (0.8.0 or 1.0.1), it lets that runtime replay its DACL restore journal, since 1.1.0 has no DACL tier to restore those ACEs. Only a runtime whose hash matches a known pin is run, only under the deny-write guard, and never from an elevated installer. If the replay cannot finish cleanly, cannot read the journal or the old runtime, or leaves entries behind (a sandboxed run still alive), and the incoming pin is 1.1.0, the install stops and keeps the current runtime so the next run can try again.
  • Daily npm check (.github/workflows/mxc-pin-network-check.yml): schedule and manual only, never on pull requests, modeled on the model catalog check. It runs test_mxc_pin.py with UNSLOTH_MXC_PIN_NETWORK=1 in a bare Python with pytest only (about 0.5 s) and fails when npm's latest is not the primary pin.

Tests

  • New test_mxc_pin.py (about 0.5 s, offline by default):
    • both pins are well formed, and only 1.0.1 ships wxc-host-prep;
    • pin selection across 18 Windows releases (Server 2025 and 2022, 23H2, 24H2 and 25H2 below and at their floors, 26300, 28000, newer and Insider builds, unreadable, and an unreadable update revision on Windows 11, Server and 23H2);
    • the forced pin, and the demotion marker keyed on the Windows release and written atomically;
    • probe_tier parsing, and a failed or report-less probe raising instead of naming no tier;
    • no host-prep probe, and the DACL tier off even with saved consent, on 1.1.0.
  • test_install_mxc_prebuilt.py:
    • a pin without host prep installs only wxc-exec.exe;
    • 1.1.0 falls back to 1.0.1 when the probe names appcontainer-dacl or no tier, and stays when it names base-container;
    • a candidate that fails the probe is checked in its staging folder and never replaces the working runtime, and a matching install is still checked;
    • a probe that cannot run never demotes, a failed 1.0.1 install records no demotion, a forced pin is never second-guessed, and an unknown UNSLOTH_MXC_PIN value still lets the probe decide;
    • the journal of a known DACL runtime is replayed before the swap, an unknown or empty one is not, and an unfinished replay keeps the retiring runtime when 1.1.0 would replace it.
  • test_sandbox_setup_plan.py: a 1.1.0 PC is offered only the runtime install, installed or not.
  • The existing MXC, sandbox, install and settings suites were ported from the module constants to pins; the suites that exercise the DACL tier run under the 1.0.1 pin.
  • Base vs head on the MXC, sandbox, settings and tools suites (Linux): the same 59 failures on both (pre-existing), none only on head, 66 more passing on head.

Staging (real Windows runners)

mxc_pin_e2e runs the branch's own installer into a fresh Studio home, checks the Authenticode signatures, makes real sandboxed tool calls through tools.execute_tool in required mode, times selected_pin() per call, and runs the MXC test files on the runner. Head 98ee5d10a:

Runner Windows (type, build.UBR) Pin --probe tier Python warm median Terminal warm median selected_pin() per call MXC tests
windows-11-arm Windows 11, 26200.9974 1.1.0 base-container 241 ms 185 ms 136 us pass
windows-11-vs2026-arm Windows 11, 26200.9974 1.1.0 base-container 232 ms 188 ms 135 us pass
windows-2025 Server, 26100.33828 1.0.1 appcontainer-dacl 175 ms 158 ms 1.6 us pass
windows-latest Server, 26100.33828 1.0.1 appcontainer-dacl 189 ms 152 ms 1.6 us pass
windows-2022 Server, 20348.5870 1.0.1 appcontainer-dacl not run: Studio needs build 26100 1.4 us pass
  • On both Windows 11 ARM64 runners the job first installs 1.0.1, checks that Studio keeps running it (real Python and Terminal calls succeed on 1.0.1), then runs the normal installer, which qualifies 1.1.0 and replaces it.
  • Every installed binary carried a valid Microsoft Corporation signature, and each tool call ran in mxc-processcontainer with effective mode os_isolated. The 1.0.1 legs ran the fallback sandbox after --prepare-host.
  • Warm medians are from 4 calls per tool on shared runners, so they vary between runs; the bare wxc-exec comparison above is the version-to-version number.
  • GitHub has no standard Windows 11 x64 runner, so 1.1.0 on x64 Windows 11 is covered by the unit tests only.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T11:13:15.443275Z 98ee5d1 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 508a0e10c9

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

Comment thread studio/install_mxc_prebuilt.py Resolved
… a fallback recorded on an unreadable Windows release
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20f7cc2a44

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

Comment thread studio/install_mxc_prebuilt.py Resolved
…tier off on it

- The installer probes the 1.1.0 candidate in its staging folder and falls back to 1.0.1 before swapping;
  the demotion is recorded only once 1.0.1 is installed.
- A probe that fails or prints no report is no verdict and never demotes; the tier probe uses an empty journal.
- UNSLOTH_MXC_PIN only skips the probe when it names a real pin.
- dacl_fallback_enabled() is off on 1.1.0, so saved consent adds no grants, leases or allowDaclMutation.
- A 1.1.0 PC without MXC gets the windows-setup action with only the install step, which Chat and
  Settings already offer, and remediation that does not point at the fallback sandbox.
- A DACL journal that cannot be replayed cleanly keeps the retiring runtime instead of swapping in 1.1.0.
- An unreadable UBR still uses the product type and build; the demotion marker is written atomically.

[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Nov 25, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5c768760e

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

Comment thread studio/backend/tests/test_mxc_pin.py Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f8f7e73228

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

…in container

target_pin() is what the installer puts on this PC; selected_pin() is what Studio runs. When the target
is 1.1.0 but 1.0.1 is still installed, Studio keeps using 1.0.1 (which also runs in the built-in
container) instead of reporting the runtime missing until the next install moves the PC to 1.1.0.

[skip ci]
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 25, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: bdf45b2b12

ℹ️ 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 added a commit to LeoBorcherding/unsloth that referenced this pull request Nov 25, 2026
…er strand a DACL journal

- A staged 1.1.0 whose probe gives no verdict, or that an elevated installer would have to probe, no
  longer replaces a working 1.0.1; the next install asks again.
- An unreadable journal or retiring runtime, or journal entries a live run left behind, block the swap
  to 1.1.0, which cannot replay them.
- The installer keeps the demotion marker and journal beside --install-dir (setup.ps1 also honours
  UNSLOTH_HOME), and a marker only demotes the primary pin it was recorded for.
- A marker write error is reported like any other install error.

[skip ci]
danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Nov 25, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 25, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 61a0eed06a

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

…Windows release and architecture once

An elevated installer already runs Python from the same user-writable Studio folder, so refusing the probe
protected nothing and kept administrators without UAC on 1.0.1. The release and the native architecture
cannot change while a process runs; selected_pin() measured about 300 us per call on Windows 11 ARM64.

[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Nov 25, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 98ee5d10a0

ℹ️ 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 added codex-converged# security# Moves a security boundary: sandbox, allowlist, permission or network guard labels Nov 25, 2026
@danielhanchen
danielhanchen merged commit ae1eaee into main Nov 25, 2026
@danielhanchen
danielhanchen deleted the studio-mxc-1-1-0-dual-pin branch November 25, 2026 12:33
shimmyshimmer pushed a commit to Imagineer99/unsloth that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex-converged# security# Moves a security boundary: sandbox, allowlist, permission or network guard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant