Skip to content

Long-poll the desktop OAuth await endpoint - #1865

Merged
RhysSullivan merged 3 commits into
mainfrom
oauth-await-longpoll
Aug 30, 2026
Merged

Long-poll the desktop OAuth await endpoint#1865
RhysSullivan merged 3 commits into
mainfrom
oauth-await-longpoll

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Desktop OAuth connects in the system browser waited on a fixed 1s poll of GET /api/oauth/await/:sessionId. The completed result was already in the in-memory store the moment the provider redirect landed, so the spinner sat on a ready answer for ~500ms average, up to 1s.

Before: the server answered each poll synchronously from the store; the client sampled on a 1s setInterval.
After: the server holds the await request open (25s per hold) and resolves it the instant the completion listener publishes for that session; deadline or client disconnect answers null (still pending). The client now runs one request at a time and reconnects 1s after each settles, so held requests never stack. Single-consumer semantics are unchanged, and waiters that time out or disconnect are removed.

Mixed versions work in both directions: an old client gets its answer within one poll of a new server; a new client against an old server behaves exactly as today.

Testing

  • New unit tests for the store long-poll: resolve-on-publish mid-wait, deadline returns pending, waiter cleanup on abort and timeout, one publish reaches exactly one of several waiters.
  • New HTTP tests in serve.test.ts: held request answers on publish, pre-published result answers immediately, disconnect drops the waiter without consuming a later result.
  • New client tests: no overlapping requests against a holding server, reconnect after a pending answer, teardown aborts the in-flight request.
  • bun run test in apps/local (94 passed) and packages/react (425 passed); repo typecheck, lint, format:check all green.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing cbe9856 Commit Preview URL

Branch Preview URL
Aug 30 2026, 02:43 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud cbe9856 Aug 30 2026, 02:44 AM

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@pkg-pr-new

pkg-pr-new Bot commented Aug 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1865

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1865

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1865

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1865

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1865

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1865

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1865

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1865

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1865

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1865

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1865

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1865

executor

npm i https://pkg.pr.new/executor@1865

commit: cbe9856

@RhysSullivan
RhysSullivan marked this pull request as ready for review August 30, 2026 02:45
@RhysSullivan
RhysSullivan merged commit 9a1fbd5 into main Aug 30, 2026
43 of 44 checks passed
@RhysSullivan RhysSullivan mentioned this pull request Aug 30, 2026
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