build: --provision none with clean enabled (release preset default) deletes hook-managed toolchains and nothing restores them
Summary
With the release preset and --provision none, the plan is clean with no sync step after it. clean calls reset_source(), which runs git clean -fdx on third_party/ (among others). That removes hook-managed, git-ignored toolchains such as third_party/llvm-build (clang) and third_party/rust-toolchain. Since provision=none never runs gclient sync / runhooks, the following build fails until the developer restores them by hand.
The planner already handles this for provision=shallow (it adds source_sync after clean), so this looks like a gap in the none path only.
Steps to reproduce
- Windows x64, Chromium checkout synced with gclient (hooks run, so clang and the Rust toolchain are present under
third_party/). - Run a release-preset build with
--provision none(clean is on by default for this preset).
Expected
Either the toolchains survive clean, or the build restores them before compiling, or it stops early and says --no-clean / a sync is needed.
Actual
After clean, third_party/llvm-build/Release+Asserts/bin/clang-cl.exe and third_party/rust-toolchain/ are gone and the build cannot compile. We recovered with gclient sync + gclient runhooks (or tools/clang/scripts/update.py and tools/rust/update_rust.py).
Root cause (main @ b16f2272cb1a3f0141c3f432cfa460886b70396a)
packages/browseros/bos_build/steps/source/provision.py:333-349:reset_source()runsgit clean -fdxonchrome/ components/ third_party/, excluding onlybuild_tools/ uc_staging/ buildtools/ tools/ build/, so git-ignored hook output underthird_party/is removed. The docstring at L309-314 says sync/hooks must follow this operation.packages/browseros/bos_build/core/planner.py:297-315:_provision_steps()addssource_syncaftercleanonly forshallow; fornoneit returns just["clean"]. The docstring at L300-301 already notes that clean deletes hook-managed toolchains that sync restores.planner.py:99: the release preset defaults toclean: True.
Suggested fix
Any one of these (smallest first):
- In
_provision_steps(), whenprovision == "none"andcleanis on, followcleanwith a hooks-only step (gclient runhooks). - Add
--exclude=third_party/llvm-build/and--exclude=third_party/rust-toolchain/(and other hook output dirs) to thegit clean -fdxcall inreset_source(). - At minimum, make
cleanwithprovision=nonewarn or fail early, pointing to--no-clean.
We can open a PR for whichever you prefer.
Environment
- Windows 11 Home x64, local (non-CI) build
- BrowserOS 0.51.2 build scripts, Chromium 155.0.8059.26
- Hit on 2026-10-26; the same code paths are still present on current main.
Related: #2174 mentions in passing a local workaround of skipping clean for the same reason.
Drafted with AI assistance; reviewed and tested by us.