For Stakeholders
Why this exists
Every PR that touches the clinic web or mobile app already gets a live preview environment via the existing Sandbox workflow. The gap this PR closes: seeing what actually changed in that preview still required a human to go deploy it and click around. This adds an automated step that does that for reviewers — an AI agent visits the changed screens in the PR's own sandbox and posts screenshots directly on the PR, refreshed on every push.
Impact
- Where it lands: entirely inside the engineering review process. It
touches no production system, no clinic data, and no customer-facing surface. The blast radius of this change is the CI pipeline only.
- Expected benefit: faster, more confident PR reviews for anything that
changes clinic-web or clinic-mobile — reviewers see the rendered result without a manual sandbox session.
- Cost control: the PR description states the AI agent only runs after
a cheap, deterministic check confirms the diff actually touches UI code; backend-only PRs incur no AI cost. This repo's diff doesn't contain that gate logic to verify directly (see below), but the wiring in this repo is consistent with that design — the new step is unconditional in the workflow YAML, so all gating is delegated to the host-side tool.
Risk profile
- Low blast radius, by construction. The step is wrapped in
|| true
(.github/workflows/sandbox.yml:208) — if the screenshot tool fails for any reason, it cannot fail the CI job or block a deploy. Worst case is a missing or stale comment, not a broken pipeline.
- Scope boundary to be aware of. The actual implementation — the gate,
the agent prompt, and the comment-posting logic — lives outside this repository, on infrastructure this PR doesn't touch (per the author, this follows an established convention where host-owned sandbox tooling stays out of the app repo). That means this repo's review and this documentation can fully vouch for the 12-line workflow change, but the actual screenshot/publish behavior is attested by the PR description, not independently verified here.
- Mobile is intentionally incomplete. Mobile screenshot support ships
disabled by default. The reason is a real, verifiable gap in clinic-mobile (hardcoded API host, no override for pointing a build at an arbitrary sandbox — packages/clinic-mobile/src/utils/variables.js:13), not an oversight in this PR. Enabling it later requires that separate fix first.
What to watch after this ships
Whether the promised "no AI spend on non-UI PRs" gate holds up in practice is the one claim in this PR that can't be checked by reading this repository — it's worth confirming post-merge (e.g. via whatever cost/usage visibility exists for the AI agent runs) rather than taking it purely on faith.