fix: screenshot Bearer auth + Node 24 preflight - #23
Merged
Conversation
REQ-004: land the real screenshot Bearer + Node 24 preflight fix on matthewhand/OpenMausBot main without swallowing upstream. Success: a focused PR against current main, CI green, squash-mergeable. Diff should be the Bearer/Node24 fix only (small file count), not 687 files. Watch-screen and ComputerPanel screenshot clients used a raw/unauthenticated fetch. Route them through the same header helper as store api() so a stored LAN token becomes Authorization: Bearer. Boot the harness only on Node 24+. Extracted from cursor/screenshot-bearer-node24-19c5 (PR #19) onto current origin/main. Does not include that branch's later upstream merge. Co-authored-by: mhand <matthewhand@users.noreply.github.com>
Use try/catch for browser globals and Headers for request init so the Bearer helper typechecks without Record assertions. Co-authored-by: mhand <matthewhand@users.noreply.github.com>
Current main still polls both /api/bots/:id/computer/screenshot and /api/local-computer/screenshot. Keep the lanAuthRequestInit contract against those paths (PR #19's later /api/bots/:id/local-computer path is from an upstream merge that is not on this tree). Co-authored-by: mhand <matthewhand@users.noreply.github.com>
There was a problem hiding this comment.
The PR successfully adds Node.js version gating and centralized LAN authentication support. All implementations are correct and follow the existing patterns in the codebase.
Key additions:
- Node version preflight check: Validates Node >= 24 before server startup to prevent confusing runtime errors
- LAN authentication module: Provides a shared authentication layer for bearer token management across the React app
- Consistent auth integration: Updates all fetch calls in ComputerPanel, LocalComputerSection, and store.tsx to use the new lanAuthRequestInit helper
The code is production-ready with no blocking issues identified.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
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.
REQ-004: land the real screenshot Bearer + Node 24 preflight fix on matthewhand/OpenMausBot main without swallowing upstream. Success: a focused PR against current main, CI green, squash-mergeable. Diff should be the Bearer/Node24 fix only (small file count), not 687 files.
What changed
Cherry-picked the unique Bearer / screenshot / Node 24 work from
cursor/screenshot-bearer-node24-19c5(PR #19) onto currentorigin/main. Does not include #19's later upstream merge.Screenshot / API Bearer — ComputerPanel’s local
api()(livePOST /api/local-computer/screenshotandPOST /api/bots/:id/computer/screenshotpolls), storeapi(), and LocalComputerSection leftover fetches now sharelanAuthRequestInit(). WhenombAuthTokenis set they sendAuthorization: Bearer …; when it is not, they send no Authorization (loopback / auth-off unchanged). Does not implement server-side LAN bind, CORS, or the Add opt-in LAN auth with Bearer and EventSource token #16 threat model.Node 24 preflight —
server/index.tscallsassertSupportedNode()before listening. Node<24exits 1 with a readablerequires Node >= 24message instead of the ~85 misleading vitest failures.Diff vs
main: 8 files, +289 / −11. Squash-merge ready.Why
#18 predicted that #11’s raw screenshot
fetch()plus #16’s LAN Bearer would 401 “Watch screen” over LAN. On today’smainthe same hole is ComputerPanel’s unauthenticated screenshot client.engines.node: >=24was install-warning only.PR #19 claimed to be this targeted fix but its branch later merged a large upstream sync (
cursor/sync-upstream-9dfe/ 687 files / ~123k additions). Do not squash-merge #19. This PR is the extracted unique work only.How it was verified
On Node 24.20.0:
pnpm typecheckpnpm vitest run src/lib/lan-auth.test.ts server/node-preflight.test.ts— 19 passed (Bearer presence/absence + screenshot POST contract; Node 22 rejected; Node 24+ accepted;enginesstays in sync)/exec-daemon/node(v22.14.0) exits 1 withrequires Node >= 24; Node 24.20 serves/api/health({"app":"openmausbot",...})pnpm test: 102 files / 995 passed + broker, updater, packaged-server smokepnpm check:electronGitHub CI on this PR: all 6 checks green (typecheck+test on macOS/Ubuntu/Windows, Linux package smoke, iOS/Swift, Amazon Q).
Investigation notes:
3c13caf(Bearer + Node 24),fb45485(typecheck/anti-slop), plus a later test-path tweak after the upstream merge./api/bots/:id/local-computer/screenshot) is not on current main. This PR keeps the contract against the URLs that actually exist here:/api/local-computer/screenshotand/api/bots/:id/computer/screenshot.lanAuthRequestInit/assertSupportedNodeabsent). fix: screenshot Bearer auth + Node 24 preflight (targeted, not a rebase) #19 was left open with a do-not-merge comment rather than closed, because the extracted work is not onmainuntil this PR lands.Screenshots (UI changes)
No visual UI change. Header attachment is covered by tests, not pixels.
Checklist
pnpm typecheckandpnpm testpass locallydist-server/edits (it's build output)shell: true/ cmd.exe string-buildingOut of scope
Matthew: please squash-merge this PR. This agent cannot perform the squash-merge. After merge, Windows2 can pull on 10.0.0.32.