Skip to content

Ship the browser UI in the pip wheel (CSP + wheel check) - #60

Merged
AhmiDarrow merged 1 commit into
masterfrom
fix/pip-webui
Nov 15, 2026
Merged

AhmiDarrow merged 1 commit into
masterfrom
fix/pip-webui

Conversation

@AhmiDarrow

Copy link
Copy Markdown
Owner

Problem

pip install remedy-ai then remedy serve showed WebUI assets not bundled. The wheel packs only src/remedy; remedy-runtime looks for REMEDY_WEBUI_DIR, a desktop/dist near cwd or its binary, or a webui/ui folder next to the binary. A pip install has none of these.

Fix (bundle the static build; wheel 2.4 MB -> 5.1 MB)

  • scripts/stage_wheel_webui.py [--build] builds desktop/ and stages dist (no source maps) into src/remedy/webui/dist (gitignored, still packed by uv_build), with a remedy-webui.json manifest (version + per-file sha256).
  • remedy serve passes it to the runtime as REMEDY_BUNDLED_WEBUI_DIR. This is the lowest-priority candidate, so REMEDY_WEBUI_DIR and a live desktop/dist still win.
  • Served UI hardening: a CSP that mirrors the desktop CSP minus the Tauri-only sources. Inline scripts are allowed by sha256 only, computed from the served index.html, never unsafe-inline. It also sets frame-ancestors 'none' and object-src 'none'. Other headers: nosniff, X-Frame-Options: DENY, and Referrer-Policy: no-referrer, so a one-time ?bootstrap= link can't leak via Referer.
  • scripts/check_wheel.py fails a wheel that lacks the UI, has a stale or tampered UI, includes source maps, or is over 12 MB. CI runs it on every push. --release also requires runtime pins for the wheel's version.
  • Desktop Release: the release job uploads its runtime SHA256SUMS. A new pypi-wheel job builds the frontend, stages it, pins from those sums, and in publish runs re-verifies the published assets (and cmps the pins). It then builds, runs check_wheel --release, and uploads remedy-pypi-dist.

Tests

  • Go: bundled fallback, explicit dir wins, CSP hashes only inline scripts, security headers on index/SPA/assets/static.
  • Python tests/test_wheel_webui.py: staging, the wheel check (missing/stale/tampered UI, release pins), and the serve handoff.

Local check

Wheel installed in a clean venv, remedy serve run from /tmp, headless Chrome. The full UI loads with no CSP violations or console errors and no Tauri globals. Chat round-trips through a mock OpenAI-compatible echo model.

…erved UI

remedy serve on a pip install showed 'WebUI assets not bundled': the wheel only
packed src/remedy, and remedy-runtime looks for desktop/dist or a webui folder
next to its binary, neither of which a pip install has.

- scripts/stage_wheel_webui.py builds desktop/ and stages dist (no source maps)
  into src/remedy/webui/dist (gitignored) with a hashed manifest.
- remedy serve passes it as REMEDY_BUNDLED_WEBUI_DIR, the last place the runtime
  looks, so REMEDY_WEBUI_DIR and a live desktop/dist still win.
- Served UI gets a CSP mirroring the desktop one (inline scripts by sha256
  only, frame-ancestors none), nosniff, X-Frame-Options DENY and
  Referrer-Policy no-referrer so a one-time link never leaks via Referer.
- scripts/check_wheel.py refuses a wheel without the UI (CI, every push) and,
  with --release, without runtime pins for its version.
- Desktop Release gains a pypi-wheel job that builds the wheel from the tagged
  commit with the UI and the run's own runtime hashes.
@github-actions

Copy link
Copy Markdown

Self-improve bot

  • Pass 1 path/secrets: failure
  • Pass 2 behavior scan: success
  • From fork: false

This bot does not merge. Owner (CODEOWNERS) must review.
Clients only receive this after a signed release.

@AhmiDarrow
AhmiDarrow merged commit de5564c into master Nov 15, 2026
16 of 17 checks passed
@AhmiDarrow
AhmiDarrow deleted the fix/pip-webui branch November 16, 2026 01:33
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.

1 participant