BrowserOS icon indicating copy to clipboard operation
BrowserOS copied to clipboard

build: --provision none with clean enabled (release preset default) deletes hook-managed toolchains and nothing restores them

Open WindriseAI opened this issue 1 month ago • 0 comments

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

  1. Windows x64, Chromium checkout synced with gclient (hooks run, so clang and the Rust toolchain are present under third_party/).
  2. 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() runs git clean -fdx on chrome/ components/ third_party/, excluding only build_tools/ uc_staging/ buildtools/ tools/ build/, so git-ignored hook output under third_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() adds source_sync after clean only for shallow; for none it 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 to clean: True.

Suggested fix

Any one of these (smallest first):

  1. In _provision_steps(), when provision == "none" and clean is on, follow clean with a hooks-only step (gclient runhooks).
  2. Add --exclude=third_party/llvm-build/ and --exclude=third_party/rust-toolchain/ (and other hook output dirs) to the git clean -fdx call in reset_source().
  3. At minimum, make clean with provision=none warn 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.

WindriseAI avatar Oct 31 '26 11:10 WindriseAI