Skip to content

live stream: a stream a dropped route left open and silent is dialed again once a ping is overdue, so missed messages show in about 13 s instead of 44 s - #479

Merged
SiddDevZ merged 7 commits into
DuskBotAI:devfrom
Yabuku-xD:phone-chat-sync
Dec 3, 2026

Conversation

@Yabuku-xD

@Yabuku-xD Yabuku-xD commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What and why

On the phone, messages sent while the route to the computer dropped showed up 40+ seconds after the route came back. A relay or tunnel that loses the computer can leave the phone's live stream open with nothing coming through. The stream looked connected, so it waited out the 40 s stale limit (LIVE_EVENTS_STALE_MS) before it dialed again.

Once a ping is 18 s overdue (the server pings every 15 s), the stream now asks the place once whether it answers. It uses the background read that never wakes a Cloud, which now gives up after 5 s. When the place answers, the stream dials again at once and resumes from its cursor. The check does not run:

  • on a healthy stream, which hears a ping at least every 15 s;
  • when a Cloud is asleep or gone;
  • while the page is hidden.

A place that does not answer is left to the existing stale check.

How it was checked

  • src/lib/live-events.test.ts: 5 new cases.

    • A silent stream whose place answers is dialed again at 18 s.
    • When the place does not answer, the stream waits for the stale limit.
    • A stream that keeps pinging is never checked.
    • An asleep Cloud and a hidden page are never checked.
    • A closed stream stops watching.

    The first two fail without the change.

  • End to end: the phone page and the desktop page, each in headless Chrome, against one control-dusk fixture. The phone's /api calls went through a proxy that adds 300 ms and can cut the stream (reset, or accept and never answer). With the stream cut while 8 replies arrived, a page-side log showed the old stream never erroring. Results:

    before after
    missed messages on screen, after the route is back 43.3-44.3 s 12.9 s

    The same run had no blank transcript frames and no rows that unmounted and came back. A desktop message still reaches an open phone chat in 20-90 ms.

  • pnpm typecheck and pnpm lint pass. 361 test files under src/lib, src/mobile/connection, src/mobile/transport and the source guards pass (3,761 tests).

  • pnpm typecheck, pnpm lint and pnpm test pass (typecheck and lint pass; the whole pnpm test was not run locally)

  • New behaviour has a test

  • No secrets, personal data or local paths in the diff or screenshots

Not covered: the real relay and a real phone. The browser page used the same-origin transport with added delay. The phone app's transport patches fetch and EventSource, so the health read takes the same route as its stream there.

This branch also carries the commits of #483: the fix for two tests red on dev (the find_tool ranking and the guest skill card), the flaky-test retry list for tests that failed at random in CI on Dec 1, and the link chaos fix, so this PR's CI can pass. They drop out of the diff once #483 merges.

…again once a ping is overdue and the place answers

A relay or tunnel that lost the computer can leave the phone's stream open with nothing coming through. The stream
waited out the 40 s stale limit before dialing again, so messages sent meanwhile showed 41-44 s after the route came
back. Once a ping is 18 s overdue (the server pings every 15 s), the stream asks the place once, with the background
read that never wakes a Cloud and gives up after 5 s, and dials again at once when it answers. A healthy stream never
asks; an asleep Cloud or a hidden page is left to the existing checks.

Phone page against a fixture with 300 ms per request, stream cut while 8 replies arrive: missed messages show
43.3-44.3 s after the route is back before, 12.9 s after.
… and the guest skill card test stages four kinds of work

bacb532 left two tests red on dev. Its new skill_manage description dropped the word reusable, so find_tool ranked
skills_list first for "save this procedure as a reusable skill"; the description says reusable SKILL.md again (a skill
is recurring work, which that change keeps). Its duplicate check turns away a create that covers an existing skill, and
the guest skill card test staged four skills with one description, the same as an earlier test's: each now has its own
kind of work.

(cherry picked from commit 78889fc)
…list's two retries

Fifteen tests failed in CI on Dec 1 in runs of main, a release and PRs DuskBotAI#477-DuskBotAI#483 whose changes do not reach them, a
different set each run, and pass locally. Each entry names the runs it failed in. vps-routing's 'reuses the existing
VPS with $settings' failed too (PR DuskBotAI#477, run 46623618361) but is left out: its name is made per case, and the list
matches names written in the file.

(cherry picked from commit 54f5c51)
…s 60 servers link from their own addresses

Every link chaos run since the per-address limit on new links (adc99d7, Nov 14) was cancelled at CI's 60-minute
limit, on main pushes, the weekly run and every PR that touches the link service: the scenarios finished in about five
minutes and printed their table, but a socket or timer a scenario left open held the process. The run now exits once its
results are written. The storm's 60 servers set up their links over one connection, so the node's front gave them one
address, which the limit refused after 30 (Too many new links from here); each now uses its own connection, as 60
machines would. Locally, --quick passes all 12 scenarios and exits in 5.6 minutes.

(cherry picked from commit 83ab615)
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.

(cherry picked from commit c47197f)
Yabuku-xD added a commit to Yabuku-xD/duskbot that referenced this pull request Dec 1, 2026
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.
Yabuku-xD added a commit to Yabuku-xD/duskbot that referenced this pull request Dec 1, 2026
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.

(cherry picked from commit c47197f)
Yabuku-xD added a commit to Yabuku-xD/duskbot that referenced this pull request Dec 1, 2026
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.

(cherry picked from commit c47197f)
Yabuku-xD added a commit to Yabuku-xD/duskbot that referenced this pull request Dec 1, 2026
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.

(cherry picked from commit c47197f)
Yabuku-xD added a commit to Yabuku-xD/duskbot that referenced this pull request Dec 1, 2026
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.

(cherry picked from commit c47197f)
Yabuku-xD added a commit to Yabuku-xD/duskbot that referenced this pull request Dec 1, 2026
…y list's retries

chat-mcp-tools' shutdown verdict, memory-order and the encrypted workspace restore failed in PR DuskBotAI#479's run 46740020170,
whose change does not reach them, and pass locally.

(cherry picked from commit c47197f)
…os job installs no packages

The job runs `node apps/link-service/chaos/run.mjs` straight after checkout, so the undici import failed
with ERR_MODULE_NOT_FOUND before any scenario ran.
…ds nothing for 8 s, as the app does

src/lib/live-events.ts gives up on a dial that sends nothing in LIVE_EVENTS_OPEN_MS (8 s) and dials again. The probe
dropped a quiet stream only after it had sent something, so one silent dial after node-5xx's 502s held it down until
the relay closed it, about 90 s, and failed the scenario in CI on five of seven runs.
@SiddDevZ
SiddDevZ merged commit cc49d3a into DuskBotAI:dev Dec 3, 2026
33 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.

2 participants