Repository navigation
feat(service): the Mac's held read is woken by Neon Realtime rather than its poll - #3302
Closed
charleslpan wants to merge 3 commits into
Closed
charleslpan wants to merge 3 commits into
charleslpan wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
luke-agent
Bot
changed the base branch from
main
to
luke/neon-realtime-service-wake
October 17, 2026 01:52
luke-agent
Bot
force-pushed
the
luke/neon-realtime-service-wake
branch
from
October 18, 2026 19:40
6c9622d to
f835f49
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-mac-held-wake
branch
from
October 18, 2026 19:47
21eed83 to
ce702b9
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-service-wake
branch
from
October 18, 2026 21:40
f835f49 to
2180711
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-mac-held-wake
branch
from
October 18, 2026 21:41
ce702b9 to
71115fa
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-service-wake
branch
from
October 19, 2026 18:52
2180711 to
e46eaf4
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-mac-held-wake
branch
from
October 19, 2026 18:52
71115fa to
a9eb70b
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-service-wake
branch
from
October 20, 2026 01:36
e46eaf4 to
b3338fd
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-mac-held-wake
branch
from
October 20, 2026 01:36
a9eb70b to
d4dd702
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-service-wake
branch
from
October 20, 2026 02:06
b3338fd to
a768591
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-mac-held-wake
branch
from
October 20, 2026 02:07
d4dd702 to
210bd8a
Compare
luke-agent
Bot
force-pushed
the
luke/neon-realtime-mac-held-wake
branch
from
October 20, 2026 02:20
73c774a to
7198241
Compare
…han its poll Released desktops keep holding GET /api/mac-commands until the version gate cuts them off. Between looks the read now waits on Realtime's word that the account's unclaimed commands changed (`lookedUntil` over `macCommandsWaitingLiveStatement`, which names ids alone and no clock window), and on its own 500 ms poll only where the deployment has no Realtime. Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
…no polling fallback Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
…unctions Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
luke-agent
Bot
force-pushed
the
luke/neon-realtime-mac-held-wake
branch
from
October 20, 2026 02:32
7198241 to
7656c9c
Compare
Contributor
This branch was successfully deployed
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.
Stacked on #3266 (
luke/neon-realtime-service-wake). Released desktops keep holdingGET /api/mac-commandsuntil the version gate cuts them off, so this PR makes that held read wait on Realtime too. Desktops on #3285 don't use this route.Change
macCommandsFornow waits throughlookedUntilfrom feat(service): the service's held reads and waits on a row are woken by Neon Realtime #3266, in place ofEffect.repeat(Schedule.spaced(POLL))+timeoutOption(HOLD). Between looks it waits for Neon Realtime to report that the account's unclaimed commands changed. The heartbeat on arrival, the 20 s hold, and the claim at the end are unchanged.macCommandsWaitingLiveStatement(userId)inmac-command-store.ts:SELECT id FROM mac_command WHERE user_id = $1 AND claimed_at IS NULL. It selects ids only, never the command text, and has no clock window. The read's own look still checksCLAIM_WINDOW. It mirrors feat(service): the Mac's commands are sealed for following over Neon Realtime, claimed by id #3274'smacCommandsLiveStatement, which the Mac subscribes to and which also carries what to run. It's kept separate so that the conflict with feat(service): the Mac's commands are sealed for following over Neon Realtime, claimed by id #3274 stays to adjacent additions.Tests
mac-command-store.test.ts(PGlite): the wake statement returns the account's unclaimed commands by id only, drops one once it's claimed, and reads nothing of another account's.mac-commands-app.test.ts: with a scriptedLiveWake, a held read answers a command queued while it's held as soon as the watch says the rows changed, with noTestClockadvance. It also watches only the account's own statement. Without the change the test times out, because the read waits out its poll.pnpm check:affectedpasses exceptapps/desktop/src/main/app-menu.test.ts, which is known to fail in the sandbox.Made with Luke
Summary by cubic
Makes the Mac's held
GET /api/mac-commandsread wake on Neon Realtime instead of its 500 ms poll, so queued commands are answered as soon as they're queued.macCommandsFornow waits on Realtime between looks through the newmacCommandsWaitingLiveStatement, which selects the account's unclaimed command ids only. It falls back to the poll only where the deployment has no Realtime. The heartbeat, 20 s hold, and final claim are unchanged.Written for commit 21eed83. Summary will update on new commits.