The Worker answers /api/search against search-corpus.json, which the GitHub Pages build produces. Cloudflare was deploying it on its own git trigger, in parallel with that build, so on any given push the Worker could go live pointing at the previous corpus until Pages caught up.
It now deploys from a job in the Pages workflow gated on the deploy step rather than the build step, since the corpus has to be published and not merely built before the Worker can read it.
This needs two things done outside the repo, both noted in the Worker README: add CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as repository secrets, and disconnect the Worker from this repository under Settings > Builds in the Cloudflare dashboard. Until that second step is done both deploy paths fire and the ordering buys nothing.