Repository navigation
native-review: run the desktop journey on a headless macOS VM - #2
Closed
jedwards27 wants to merge 13 commits into
Closed
jedwards27 wants to merge 13 commits into
jedwards27 wants to merge 13 commits into
Conversation
Make tools/native-review work on a Docker-less, headless macOS workstation and script the hand fixes that were needed to get there. - bin/setup-macos-vm: idempotent setup of native Postgres, Redis and MinIO on the harness ports (MinIO built with go install, bucket created with a SigV4 curl), a prefetched sherpa-onnx archive, the isolated relay, and the Local Network prompt. - scripts/start-isolated-test-relay.sh: BUZZ_HARNESS_NATIVE_SERVICES=1 runs the relay against those services instead of docker compose. - review_native.py: SHERPA_ONNX_ARCHIVE_DIR / SHERPA_ONNX_LIB_DIR reach host builds (never the reviewed app); doctor requires ffmpeg; the review window is moved onto the main display and the run waits for WebKit's accessibility tree before the first locator. - ios_review.py: PUB_HOSTED_URL passes through the env allowlist. - Swift driver: place_window and web_ready commands, press-system-alert-button, and answering first-run macOS privacy prompts (decline microphone/camera, allow Local Network) when the app cannot take focus. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
The compositor can report the app window before its accessibility window exists, so place_window failed with "no accessibility window to place" on a fresh VM. Retry that one error until the window appears or the wait times out; every other placement error still fails the run at once. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
The reviewed page publishes its semantic snapshot with navigator.sendBeacon, which cannot set request headers, but the probe server only accepted a token in an X-Buzz-Native-Review-Token header and never told the page the token. Every beacon got a 401, the harness saw no semantic nodes, and any step that located or asserted by id failed even though the UI had rendered. Put the ephemeral token in the probe URL's query (compared in constant time). The header is still accepted. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
The harness validates a semantic snapshot as a whole and rejects it if any node leaves the viewport. A single visually hidden 1px element at -1px (the sidebar has one) made every snapshot after the loading screen fail with a 400, so the harness kept seeing the stale loading gate and never reached the seeded channel. Clip each node's frame to the viewport and skip nodes with no visible part. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
On a fresh macOS VM the reviewed app triggers a microphone prompt at launch that freezes its web view until someone answers it, so the window stayed blank and the run timed out waiting for web content accessibility. Ask the driver to answer a pending privacy prompt (decline microphone/camera, allow Local Network) on every poll while the window comes up, and bound the web_ready accessibility query so a frozen app cannot stall the driver. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
The reviewed app asks for the microphone at launch; on a fresh VM the prompt freezes its web view until answered, and a driver blocked on that frozen view cannot answer it in time. Have setup trigger the prompt with a one-second ffmpeg capture and decline it once, next to the Local Network prompt. The script is renamed answer-first-run-prompts and the flag is now --skip-prompts. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
Brings in six commits from main so the push passes the branch-skew check; no conflicts and no change to the native-review work. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
…cement Review follow-ups for the headless macOS VM path. Prompt auto-answer: replace the substring match with answer-privacy-prompt. It acts only on a window owned by the macOS system prompt agent, that is a system alert (not a sheet or document window), whose text names the prompt kind and an app that is one of this run's own processes, with exactly one matching button. Anything else is left alone and the reason is logged. Setup script: refuse to run outside a VM unless --allow-non-vm; mark the state dir and the database as the harness's own; identify each service by pidfile and refuse to reuse an open port that is not ours. The relay script runs check-harness-database (data directory, marker file, database marker) before DROP SCHEMA in native-services mode. Window placement: move the accessibility window that matches the window the harness reports, read the frame back, fail the run if it is not wholly on the main display, and record before/after in the receipt. Also fix the stale relay-script comment and teardown message, and a typo. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
A trigger child blocked on an unanswered privacy prompt can ignore SIGTERM, so answer-first-run-prompts waited on it forever. Escalate to SIGKILL, report a driver that could not run instead of exiting silently, and log the prompt text that was actually answered. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
…eview A privacy prompt names the process macOS holds responsible for the requester, not necessarily an ancestor. When a review is started detached (nohup, a remote exec that returns) the launcher is no longer in the parent chain, so the driver left the review's own microphone prompt alone and the app's web view froze. Count the driver's responsible process as one of the review's own. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
The fixtures named the launcher process of one particular workstation environment. Use a generic name; the tests only need some process that the review owns. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
setup-macos-vm downloads the sherpa-onnx archive from GitHub releases by default. SHERPA_ONNX_DOWNLOAD_BASE now points the same path layout at a caching mirror, and the script logs the curl line, HTTP status and size. The bzip2 validation and SHERPA_ONNX_ARCHIVE_DIR are unchanged. Co-authored-by: Orbit Helper <9743d67196e296c93cc2958036615907e2e0b39128484b59b392cbb380edbb8b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Jude Edwards <judeedwards@squareup.com>
* tmp-base: (23 commits) refactor(mobile): remove unused CommunityListNotifier.addCommunity (block#9896) fix(mobile): keep Light/Dark/System on each device (block#9894) Cache recently opened mobile thread replies (block#9844) fix(mobile): align the New menu with desktop (block#9883) fix(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (block#9877) Remember collapsed sidebar sections on mobile (block#9879) Add inline emoji shortcode suggestions on mobile (block#9882) fix(mobile): reply to a thread's head in its open page (block#9889) fix(mobile): offer linked identity import when only other backups exist (block#9053) feat(mobile): enroll Android devices for push (block#9811) fix(mobile): keep "+" reactions working when a new message rebuilds the row (block#9831) Request sentence capitalization in the mobile composer (block#9881) Offer image and animated avatars for human profiles (block#9724) feat(mobile): add people and agents to a DM (block#9153) test(ios): check the navigation glass state often instead of once a second (block#9786) feat(mobile): add screen breadcrumbs to diagnostic reports (block#9823) fix(mobile): keep error names in send, upload and invite failure text (block#9855) ci(mobile): run the Mobile Swift Native lane only for native changes (block#9847) Revert "perf(db): stop per-id planning of wide #e reads (block#9591)" (block#9848) feat(mobile): count networking events for diagnostics (block#9810) ... Signed-off-by: Jude Edwards <judeedwards@squareup.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
This makes block/buzz's native review harness (
tools/native-review) run end to end on a headless macOS workstation (ec2-macos, no Docker), and scripts the hand fixes that were needed to get there. After it, one setup script plusreview-native run tools/native-review/desktop/composer-keyboard.yamlpasses all 8 steps on a fresh workstation and writes a receipt and a video.The latest revision answers a review of the first version: the macOS prompt auto-answer is now limited to the system's own privacy prompt for this run, the setup script no longer trusts whatever is listening on a port (and will not reset a database it did not create), and the window move is checked instead of assumed.
The problem
On a fresh ec2-macos workstation the harness could not get past step 3 (
reach_seeded_channel). Five separate things were in the way, and only the first two were environment gaps; the rest were harness bugs that a UI journey never hit on a developer Mac.bin/setup-macos-vmruns them natively;BUZZ_HARNESS_NATIVE_SERVICES=1inscripts/start-isolated-test-relay.shskipsdocker composesherpa-onnx-sysbuild fail withUnknownIssuer; pub.dev is blocked for iOSSHERPA_ONNX_ARCHIVE_DIRnow reaches host builds (never the reviewed app);PUB_HOSTED_URLpasses throughios_review.py's allowlistnavigator.sendBeacon, which cannot set headers-1px, and the server rejects a whole snapshot if any node leaves the viewportAlso fixed: the review window opened on a secondary display (where WebKit exposes no accessibility tree), and the accessibility window can appear a moment after the compositor's.
What changed after review
answer-privacy-promptreplaces it. It presses a button only when all of these hold: the window is owned by the macOS system prompt agent (com.apple.UserNotificationCenter, executable under/System/Library/CoreServices/UserNotificationCenter.app); it is a system alert (AXWindowwith subroleAXSystemDialog, not a sheet or document window); its text parses as a microphone, camera or Local Network prompt; the app it names is one of this run's own processes (the driver's ancestry, the process macOS holds responsible for the driver, the app under review, or a trigger child passed with--expect); and exactly one button has the expected title. Otherwise it does nothing and logs why. Tests cover each ownership check (wrong owner, wrong path,..traversal, sheet, another app's prompt, missing or duplicate button), not only the text matcher.DROP SCHEMA public CASCADEcould hit whatever ownslocalhost:5471.setup-macos-vmwrites a marker file in its state dir, starts each service with a pidfile there, and refuses to reuse a port that is open but whose listener is not that pid. It comments thebuzzdatabase as the harness database.bin/check-harness-database(data directory equals the state dir's own, marker file present, database marker present; fails closed) runs in setup and in the relay script before the schema reset, and the relay script refuses native mode withoutBUZZ_HARNESS_STATE_DIR. The 3030 relay is only reused if it is the harness's tmux session.sysctl -n kern.hv_vmm_presentis 1 (on the workstation:1,hw.modelVirtualMac2,1), unless--allow-non-vmis passed.provenance.initial_window.placement.Found while re-proving, and fixed in this revision:
answer-first-run-promptscould wait forever on a trigger child blocked behind an unanswered prompt (it ignores SIGTERM; now escalates to SIGKILL), and a review started detached (the launcher no longer in the parent chain) left its own microphone prompt alone and froze, because the prompt names the process macOS holds responsible, not necessarily an ancestor. The driver now counts that responsible process as the run's own. Both were caught by the stricter identification, which is how it should fail: closed.Why it matters
Native review is how an agent proves a desktop change in the real app, with a receipt and a video a reviewer can check. Until this, that only worked on a developer's own Mac; on a workstation it failed with an error that pointed at the wrong thing while the real causes were a frozen app and a probe that silently rejected every update. Severity: medium. Nothing here affects the shipped app (the only product-side file is a test-only probe module), but the native review gate could not run on a workstation without it. The review follow-ups matter because a harness that presses buttons on any dialog, or resets a database on a port it did not start, is a risk to whatever else is on the machine.
Proof
All runs on one fresh ec2-macos workstation (a virtual machine, macOS 26.6.2, arm64), now deleted. The base has no setup script, so the services and isolated relay were started from this PR's
setup-macos-vm --skip-prompts, then the checkout was moved to the base. The microphone permission was reset before each run.87433cd96)041c5ebff)SHERPA_ONNX_ARCHIVE_DIRnever reachestauri buildand the sherpa download fails behind the proxy. Run B (same base, archive supplied through the machine's cargo config, no repo change): FAILED at step 3,reach_seeded_channel:postcondition not met within 15000ms: {'exists': {'id': 'message-composer'}}status: failed,dirty: false(each run has its own receipt, report, log and screenshots)status: passed,dirty: false, head041c5ebff, cleanuppassed, video and share video writtenmoved: true,verified: true; beforex -1, y 30, 1442x792, afterx 0, y 69, 1440x792on a 1440x900 main displayBefore (run B, step 3): the app is up but its web content never exposes
message-composer.After: step 3 reaches the seeded channel.
After: step 5, with the draft typed into the composer.
The safety checks, on the real workstation (output in the evidence notes): re-running setup with its own services passes the database check; running setup with a different state dir while
:5471belongs to the first refuses with "already in use by something this script did not start"; the relay script in native mode with the wrong state dir refuses before anyDROP SCHEMA("server on :5471 runs from ..., not the harness data dir"), and with no state dir refuses outright; the database kept its 91 tables.Allow path, for real: a small program that sends mDNS and connects to a LAN address raised the genuine macOS prompt
Allow "<launcher process>" to find devices on local networks?, andanswer-privacy-prompt --expect <trigger>pressedAllowon it ({"ok":true,"answered":true,"button":"Allow", ...}). That was a manual trigger, not part of the journey:dns-sd, which setup uses as its Local Network trigger, did not raise it on this workstation, and by the final run the answer was already remembered, so the journey itself never showed one. The Decline path ran for real inside the proof: setup found the genuine microphone prompt and pressedDon't Allow.How tested
041c5ebffad90ef3026317ce698c450fef8d1f77, checked out clean (dirty: false). The PR head is now6c31ad993, one test-only commit later: it renames a process name in the Swift prompt fixtures (DriverSupportTests.swift) so no environment-specific name is committed; no other file differs. The workstation was deleted before that commit, so the passing run is against041c5ebff.tools/native-review/bin/setup-macos-vm(exit 0), thenreview-native run tools/native-review/desktop/composer-keyboard.yaml, started detached.a207f23e4failed at step 3 with "timed out after 30s waiting for web content accessibility": run detached, the driver (correctly, under the old rule) left the launcher's microphone prompt alone. That is the bug fixed by the responsible-process change in041c5ebff; the receipt for it is not part of the proof.tools/native-review/tests, now including real-script tests of the VM guard, the database check and the relay script's reset guard against stubpsql/sysctl), Swift 18 pass (swift test), plus the pre-push lanes (desktop typecheck, biome, desktop tests, rust tests).setup-macos-vmdownloads the archive from GitHub releases by default;SHERPA_ONNX_DOWNLOAD_BASEpoints the same path layout at a caching mirror, and the script logs the curl line, HTTP status and size. Proven on a fresh workstation through a mirror: HTTP 200, 19,551,872 bytes,bzip2 -tOK,sherpa-onnx-sysand the desktop build compiled from it, and the journey passed 8/8 (run on6c31ad993plus this change, so its receipt saysdirty: true).review-ios); the responsible-process lookup is a private libSystem symbol, resolved at run time and covered only by the on-workstation run, not a unit test.Decisions
fetchwith a header, becausesendBeaconsurvives page teardown and the token is ephemeral and loopback-only.origin/maininto the old stack head and refresh the base by merge (thebranch-skewhook compares against currentmain); the old branch is not rebased or touched. Baseorbit/native-review-baseis87433cd96.For reviewers
tools/native-review/swift/Sources/BuzzNativeDriverSupport/DriverSupport.swift(decidePrivacyPrompt),bin/check-harness-database,bin/setup-macos-vm, thenreview_native.py(wait_for_interactive_window,semantic_probe_server) andmain.swift(placeWindowOnMainDisplay,answerPrivacyPrompt,responsiblePid).tools/native-review/bin/setup-macos-vm, then. ~/.buzz-native-review/env.sh && tools/native-review/bin/review-native run tools/native-review/desktop/composer-keyboard.yaml. Accessibility and Screen Recording must be granted to the invoking process.bin/test-native-review, andnode --import ./test-loader.mjs --experimental-strip-types --test src/testing/nativeReviewSemanticProbe.test.mjsindesktop/.tccutil reset) for a deterministic first run? Existing answers are left alone.🤖 Generated with Claude Code