Skip to content

fix: end the one-time phone's pre-outcome waits at the room's deadline - #916

Merged
nedtwigg merged 2 commits into
mainfrom
fix/issue-914
Oct 2, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
fix/issue-914

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

OneTimeClient.connectOnce computed the room's hard deadline (expiry * 1000 + ONE_TIME_EXPIRY_GRACE_MS) but only handed it to the session core's exchange and exchangeControl. The waits before those — generateNoiseKeyPair, createNoiseInitiator, writeMessage, and the rendezvous socket's open — run through #race, which a failure or close() could interrupt but no timer could. A socket that stayed CONNECTING therefore left the page on its code screen indefinitely, instead of showing ONE_TIME_LINK_EXPIRED_MESSAGE as docs/specs/one-time.md's failure table promises.

connectOnce now arms one timer at the hard deadline that calls #fail(ONE_TIME_LINK_EXPIRED_MESSAGE), which wakes #race and the core's waiters alike. It is cleared once an ok outcome is read (from there DIRECT_ONLY_DEADLINE_MS bounds the direct-path wait, so the "between an ok outcome and the switch" copy is unchanged) and in #teardown, so close() still leaves nothing armed.

The new case in one-time-client.test.ts opens a socket that never opens, advances the test clock to the hard deadline, and expects the expired copy, a normally closed socket, and no armed timers. Before the change it hung until the 5 s test timeout; it passes now, along with the rest of one-time-client.test.ts and one-time-e2e.test.ts. The phone-client section of one-time.md gains the rule, and its word budget is ratcheted for it.

Closes #914 — automated triage

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: f086d51
Status:⚡️  Build in progress...

View logs

@nedtwigg
nedtwigg merged commit 1854d48 into main Oct 2, 2026
7 of 8 checks passed
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.

One-time phone client: WebCrypto and the socket's open have no deadline

2 participants