Stop committing the built `clai2` web UI bundle (`app.js`) in pull requests, so they stop getting ejected from the merge queue
Merged
MP
1mo ago+615+615+012345678901234567890123456789-28-28-01234567890123456789
Fixes #11554
Why: every clai2 web UI PR rebuilt and committed the minified static/assets/app.js, so any two of them conflicted on it even when their sources merged cleanly. Reproduced on the parents of #11352 and #11342: git merge-tree auto-merges App.tsx and the browser tests, and conflicts only in app.js. 17 commits on main rebuilt it in the last 14 days.
Approach (the issue's fallback): a hatch build hook would need Node on user machines for uv tool install git+… and for older builds whose /update installs a commit archive. So the bundle stays committed, PRs stop changing it, and main keeps it current:
- New
CLAI 2 web bundleworkflow (push tomaintouchingweb-ui/**): a credential-free job builds the bundle. When it differs from the committed one, a second job force-pushes it toclai2-web-bundleand opens one bundle-only PR with auto-merge, using thepydantic-docsApp token likegh-aw-engine-pin-bump. A workflow can't push tomaindirectly because the ruleset requires the merge queue and has no bypass actors. clai2-web.ymlbuilds from source (newbuild-clai2-web-uicomposite action) instead of requiring the committed bundle to be current. Onpull_requestandmerge_group, the PR fails if it changesstatic/together with anything else, or if a bundle-only PR's bundle isn't the build of its sources.- Release and bleeding builds use the fresh bundle, never a stale committed one:
release-buildbuilds it beforeuv build.clai2-bleedingpublishes the build from its credential-freevalidatejob, via an artifact, so no job with write access runs npm code. - Docs:
web-ui/README.md,PLUGINS.md, andFILE_MAP.mdnow say to build locally but not to commit the bundle.
New public surface: none.
Verification
- New
.github/scripts/test_clai2_web_bundle.py: 20 tests, all failing with the workflow changes stashed. They cover the guard's scenarios in a real git repo, the rebuild/PR flow against a stubgh, that packaging jobs build or download the bundle beforeuv buildand runcheck_web_assets.pyafter it, and that no job running npm holds write permissions or secrets. test_ci_content_classifier.pypasses, andpyright -p .github/scripts, ruff, and zizmor are clean.- Local wheel and sdist contain the web UI, and so does a git install made without Node on
PATH:check_web_assets.pypasses and the installedclai2 --webserves it (output below).
What changes for existing users: nothing. Web UI contributors now leave static/ out of their PRs.
Evidence: local wheel/sdist build, Node-free git install, and clai2 --web
$ uv build --no-sources --package pydantic-clai2 --out-dir /tmp/clai2-11554/dist
$ python3 -m zipfile -l dist/*.whl | grep web/static
pydantic_clai2/builtin_plugins/web/static/index.html 1317
pydantic_clai2/builtin_plugins/web/static/assets/app.js 506797
pydantic_clai2/builtin_plugins/web/static/assets/index.css 53318
$ tar tzvf dist/*.tar.gz | grep web/static
… pydantic_clai2-0.62.1.dev12+bcda52227/pydantic_clai2/builtin_plugins/web/static/index.html (1317)
… pydantic_clai2-0.62.1.dev12+bcda52227/pydantic_clai2/builtin_plugins/web/static/assets/app.js (506797)
… pydantic_clai2-0.62.1.dev12+bcda52227/pydantic_clai2/builtin_plugins/web/static/assets/index.css (53318)
$ env -i PATH=<uv dir>:/usr/bin:/bin … uv tool install --compile-bytecode \
"git+file://<repo>@547be42f2…#subdirectory=src/pydantic_clai2"
node/npm: not on PATH
Installed 2 executables: clai2, pydantic-clai2
$ <tool python> -I src/pydantic_clai2/scripts/check_web_assets.py src/pydantic_clai2/pydantic_clai2/builtin_plugins/web/static
check_web_assets: installed assets match the source bundle
$ clai2 -m test --web --port 8795 --token-file token # installed tool, PATH=/usr/bin:/bin
Web UI running at http://127.0.0.1:8795/
GET /?token=... -> 200 (src="/assets/app.js?v=bd80a2eb7bdeb4d8", href="/assets/index.css?v=150e8cd5e928c561")
GET /assets/app.js -> 200, 506797 bytes, text/javascript; charset=utf-8
served app.js == committed bundle
GET /assets/index.css -> 200, 53318 bytes
PR decisions
2026-10-27 · fallback over a build hook · iter -
- Decision: Keep the bundle committed. PRs leave it alone, and a main-only workflow opens a bot PR (pydantic-docs App token) that commits the rebuild.
- Why: uv tool install git+... and older /update commit-archive installs build from the tree, so a hatch hook would need Node on user machines. main's ruleset (merge_queue, required check, no bypass) forbids a direct push from a workflow.
- Source: https://github.com/pydantic/pydantic-ai/issues/11554
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.