Skip to content

[miniflare] Report tail event forwarding failures between dev sessions - #14993

Merged
petebacondarwin merged 1 commit into
mainfrom
fix/miniflare-report-tail-forward-failures
Aug 11, 2026
Merged

petebacondarwin merged 1 commit into
mainfrom
fix/miniflare-report-tail-forward-failures

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Found while investigating the Windows fixtures/dev-registry flake (#14989 has the wider write-up). Independent of that flake and of #14989 — this stands on its own.

ExternalServiceProxy.tail() forwards tail events to a tail consumer running in another local dev session. It did:

try {
  const serializedEvents = JSON.parse(/* ... */);
  return this._fetcher.tail(serializedEvents);
} catch (e) {
  console.warn(`[dev-registry] Failed to forward tail events to ...`);
}

returning the promise from inside the try means the catch only ever guarded the synchronous JSON work. The rejection that a departed peer actually produces settled after tail() had already returned, so it escaped as an unhandled rejection and the warning never fired.

Verified: with a registered peer whose debug port has gone away, the pre-change code produces no diagnostic at all. awaiting the call routes the rejection into the existing catch.

Tests

Added reports a failure to forward tail events to a departed peer, which establishes tail forwarding between two sessions, disposes the peer so the registry entry outlives its debug port, and asserts the warning is emitted. It fails on main (times out — the warning never arrives) and passes with the change. Ran 3x in isolation plus the full miniflare suite (1012 passed) to check it isn't order-dependent.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this makes a previously-silent local dev failure visible; there is no API or documented behaviour change.

A picture of a cute animal (not mandatory, but encouraged)

Note

This is a contribution from an AI agent: opencode, claude-opus-5.


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d655dd8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
miniflare Patch
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Aug 3, 2026
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team August 3, 2026 14:30
@workers-devprod

workers-devprod commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@ask-bonk

ask-bonk Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The change is correct and self-contained. The fix properly converts the tail() method to async and awaits the RPC call so the rejection is caught. Since tail() is a tail handler (fire-and-forget from workerd's perspective), swallowing the error into a warning is the intended behavior and doesn't break any caller. The test is well-designed and the double-dispose pattern is safe.

LGTM

github run

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14993

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@14993

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14993

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14993

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14993

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14993

miniflare

npm i https://pkg.pr.new/miniflare@14993

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@14993

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14993

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14993

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14993

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14993

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14993

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14993

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14993

wrangler

npm i https://pkg.pr.new/wrangler@14993

commit: d655dd8

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙂

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

`tail()` returned the forwarding RPC's promise from inside a `try`/`catch`, so
the rejection a departed peer produces landed outside the `try` and escaped as
an unhandled rejection. The `catch` only ever guarded the synchronous `JSON`
work, so a peer going away produced no diagnostic at all.

Await the call so the rejection is caught and reported.
@petebacondarwin
petebacondarwin force-pushed the fix/miniflare-report-tail-forward-failures branch from 98ae808 to d655dd8 Compare August 4, 2026 15:25
@dario-piotrowicz
dario-piotrowicz removed the request for review from jamesopstad August 6, 2026 11:04
@petebacondarwin
petebacondarwin merged commit c7aede7 into main Aug 11, 2026
56 checks passed
@petebacondarwin
petebacondarwin deleted the fix/miniflare-report-tail-forward-failures branch August 11, 2026 15:31
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-flake Applied to PRs addressing CI flakiness package:miniflare Relating to Miniflare

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants