Skip to content

Release 0.8.13: route the widget through widget.osc.earth/osa - #442

Merged
neuromechanist merged 12 commits into
mainfrom
develop
Sep 22, 2026
Merged

neuromechanist merged 12 commits into
mainfrom
develop

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Promotes develop to main. The whole diff is the widget-hostname work (#437) plus CI-owned version bumps; no other feature landed in this window.

What reaches production

The OSA chat widget stops calling two account-scoped *.workers.dev hostnames and calls stable product-owned names instead: widget.osc.earth/osa in production, develop-widget.osc.earth/osa in dev.

widget.osc.earth is a generic host reserved for widgets; /osa is this widget's path under it, so a later widget can take its own path without consuming a subdomain. That rules out custom_domain = true, which maps a whole hostname to one worker and cannot carry a path, so this is an ordinary zone route.

The one thing that actually changes at the edge

widget.osc.earth/osa/* has never been registered. It answers 522 today. Merging this runs sync-worker-cors.yml's production wrangler deploy, which attaches the route for the first time.

That step failed on develop until a few minutes ago, because CLOUDFLARE_API_TOKEN held Workers Routes scoped to a zone that did not include osc.earth (#439, now resolved). The dev deploy has since attached both triggers cleanly, so the same call is expected to succeed here. If it does not, the failure is loud and non-destructive: the script upload still succeeds and only route reconciliation fails, so the worker serves the new code on its existing hostnames while widget.osc.earth keeps returning 522.

DNS for both names already exists, created 2026-09-21 as proxied AAAA records to 100::.

Risk, and why it is low

The widget's endpoint flips for real embedders on this merge. Two things bound that:

  • nemarOrg/website Produce&manage collection of plugin/skill(s) which would (re)use assistant "specifications" #342 is already merged to staging and lists both the new osc.earth origins and the legacy workers.dev ones in nemar.org's Content-Security-Policy, so that page keeps working whichever order the two sides reach production.
  • Both *.workers.dev hostnames keep serving. workers_dev = true is set explicitly at the top level and in [env.dev], because a [[routes]] table silently flips that default to false. Cached SRI-pinned widget builds that still call the old names continue to work.

Review already done

#438 went through code, test, comment and error-handling review. Two critical defects were found and fixed before merge:

  1. The mount-prefix strip was host-blind. A community whose id is osa was silently swallowed on the workers.dev host: /osa/logo returned community logo's config as a 200. Now gated on the request host.
  2. The demo page's new dependency on the widget script was unguarded, so a failed script load threw uncaught and suppressed the page's own error UI. A regression that PR introduced, now resolved inside the existing try.

A pre-existing CI gap was fixed too: test.yml's all-tests job listed frontend-tests in needs but never checked its result. That matters here specifically, because test.yml is the workflow that runs on this promotion.

Worker routing tests went from none to 93, covering host gating, query strings, the admin metrics routes and the path actually forwarded to the backend.

Version

src/version.py is 0.8.13.dev3. ensure-stable-version.yml strips the suffix on main; not hand-bumped.

This release is also the first to run #380's image workflow from the default branch, so it should be the first to publish versioned images and move :latest.

After merge

  • sync-cors production deploy green, with widget.osc.earth/osa/* in its trigger list
  • curl https://widget.osc.earth/osa/health returns 200, not 522
  • curl https://widget.osc.earth/osa/communities returns 200
  • osa-worker.shirazi-10f.workers.dev/health still 200
  • osa-worker.shirazi-10f.workers.dev/osa/health returns 404, confirming the host gate
  • demo.osc.earth, develop-demo.osc.earth, api.osc.earth unaffected

Do not use /osa/version as a check: the worker proxies /version to a backend endpoint that does not exist, so it 404s on every host today.

Closes #437, #439.

github-actions Bot and others added 10 commits September 21, 2026 22:09
…p-after-v0.8.12

chore: sync develop with main after v0.8.12
…438)

Moves the OSA chat widget's API endpoint off the two account-scoped
*.workers.dev hostnames and onto stable product-owned names:
widget.osc.earth/osa (production) and develop-widget.osc.earth/osa (dev).
Closes #437.

widget.osc.earth is a generic host reserved for widgets, and /osa is this
widget's path under it, so a later widget can take its own path without
consuming a subdomain. That rules out custom_domain = true, which maps one
whole hostname to one worker and cannot carry a path, so this is an
ordinary zone route.

Cloudflare delivers the FULL path to a path-mounted route, prefix
included, and every route matcher here is anchored and counts segments.
stripMountPrefix() removes the prefix once at the top of fetch(), gated on
the request host so the still-live workers.dev hostname and wrangler dev
keep seeing raw paths.

DNS was provisioned for both names as proxied AAAA records to 100::, and
dev verified end to end over real public DNS. Production attaches when
develop reaches main; sync-worker-cors.yml owns that deploy.

Review found two critical defects, both fixed here: the prefix strip was
host-blind, so a community whose id is "osa" was silently swallowed on
the workers.dev host; and the demo page's new dependency on the widget
script was unguarded, so a failed script load threw uncaught and
suppressed the page's own error UI. A pre-existing CI gate that never
checked the frontend job's result is fixed too.

Worker routing tests go from none to 93, covering host gating, query
strings, the admin metrics routes and the path actually forwarded to the
backend.
The Trap 2 note in wrangler.toml said zone access was not a concern here,
reasoning that CLOUDFLARE_API_TOKEN already provisions custom domains on
osc.earth. That reasoning does not transfer: Pages custom domains, zone
DNS and Zone:Workers Routes:Edit are three separate grants, and the token
holds the first two but not the third.

The first sync-cors run after #438 merged proved it. Records what
actually happened, including that the script upload still succeeds so the
code goes live, and that pre-registering a route by hand does not make
the job pass, since wrangler fails reconciling a route that already
matches.

Documentation only. The permission gap itself is tracked as #439.
CI can now register Workers Routes; the dev deploy attaches both the
workers.dev name and develop-widget.osc.earth/osa/*.

The fix was not a missing permission. Workers Routes is a ZONE
permission, so it does not sit beside the account-level ones like Workers
Scripts or D1, and the token already had it. It was scoped to a specific
zone that did not include osc.earth. The permission row and the
zone-resource scope are separate settings, and the API returns the same
"No access to the specified resource" for either.

Also keeps the two details that made the failure easy to misread: the
script upload succeeds while only route reconciliation fails, so a red
job does not mean a stale worker; and pre-registering the route by hand
does not help, because wrangler fails reconciling a route that already
matches.

Closes #439.
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://develop-demo.osc.earth
Branch develop
Commit e24647f

This preview will be updated automatically when you push new commits.

neuromechanist and others added 2 commits September 22, 2026 08:07
Addresses every finding from the two release reviews of #442.

Pins the deploy wrangler to an exact version and runs it through bun: a
floating global install could re-flip workers_dev to false, which already
took the workers.dev hostname down once during #437 with clean output.

Adds a test enforcing that MOUNTED_HOSTS and the [[routes]] patterns
agree. One drift direction is completely silent: a host in the set with
no route means Cloudflare never invokes the worker, so no log can catch
it. Mutation-verified both ways.

Enables Workers Logs, without which the 404 fall-through log added in
#438 was visible only during a live wrangler tail and could not explain
an outage after the fact.

Adds a 15-minute probe of both mounted hosts, the legacy workers.dev
name, and the host gate itself. Nothing watched these; the status
dashboard bypasses the worker entirely and stays green through a route
outage.

Repairs release.yml, dead since February 2026 because tag-release.yml
pushes tags under the default GITHUB_TOKEN, which starts no workflow
runs. Published notes have been missing the widget SRI section since.

Documents what a release cannot roll back: the tag and the PyPI upload
are immediate and permanent.
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Worker Deployment Required

Worker changes detected. After merging to main or develop, the workflow will automatically deploy the worker.

Manual deployment (if needed):

cd workers/osa-worker
wrangler deploy --env dev  # for develop branch
wrangler deploy            # for main branch

@neuromechanist
neuromechanist merged commit 35b1368 into main Sep 22, 2026
28 checks passed

This branch was previously deployed

1 inactive deployment
testpypi — f0c516ba Deployed Sep 22, 2026 by neuromechanist via Publish to TestPyPI #77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widget calls the worker by its workers.dev name, which is now pinned in nemar.org's CSP

1 participant