Skip to content

connector-wake alerts: skip Durable Object retirement close errors - #50149

Merged
Jinwoo-H merged 2 commits into
mainfrom
wake-alerts-skip-do-retirement-closes
Nov 26, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
wake-alerts-skip-do-retirement-closes

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Every few hours Cloudflare retires the Durable Objects behind the connector wake service. Each open socket on a retired object gets a close event, and Cloudflare reports that event as an exception even though the desktop reconnects in about a second. Those reports were tripping the wake cloudflare-errors alert. The wake alert now leaves those socket-event exceptions out and still counts every other error.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​22 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13

What Changed

  • relay-edge/src/alerts-cloudflare.ts: the Durable Object GraphQL query also groups by the documented type dimension (hibernation / http / jsrpc). cloudflareErrors takes an optional { skipHibernationErrors }. When it is set, a failing hibernation invocation still counts as an invocation but not as an error.
  • connector-wake/src/alerts.ts: the wake alerts pass skipHibernationErrors: true. The relay edge does not pass it, so its alert is unchanged.
  • One unit test with both kinds of error: a retirement-shaped burst of failing hibernation events stays quiet, and object jsrpc/http errors still fire.

Why

Read-only checks against Cloudflare's GraphQL data for 11-24 to 11-26:

  • Every exception in the retirement waves is a Durable Object invocation with type=hibernation and status=scriptThrewException. There were 142 in 10:00 to 11:00 UTC on 11-26, 175 in 15:45 to 16:15, and 159 in the 18:00 hour.
  • The live tail shows these are close events (code 1006) that end in "this Durable Object instance is no longer active". The runtime throws this, not our handler.
  • Durable Object http/jsrpc errors and Worker fetch errors show up separately (Worker errors were 41 in 15:45 to 16:15 and 294 in the 11-25 17:00 hour). They keep counting.

Trade-off: the dataset has no event subtype, close code or message. So an exception thrown by our own webSocketMessage/webSocketClose/webSocketError is left out too. Those handlers are three short functions, and the wake rules that read Analytics Engine (wake-errors, reconnect-surge, no-socket-share) still catch the effect on users. Raising the threshold instead would also hide real Worker errors.

Linked Issue

N/A (internal alert tuning).

Visual Proof

N/A: alerts Worker only, no UI.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • vitest run test/alerts.test.ts in cloud/apps/connector-wake: 33 passed. The new test fails when skipHibernationErrors is false.

  • tsc --noEmit in connector-wake passes. relay-edge shows no errors in its own files.

  • Ran the GraphQL query with the new type dimension against production data to confirm the field and its values.

Performance

None, because this adds one dimension to a GraphQL query the alerts cron already sends every 5 minutes, which returns a handful more groups.

Risk

Level: Low

Only the wake alerts Worker changes behaviour, and only for the cloudflare-errors rule. The worst case is that a bug in the wake socket handlers no longer pages through this rule. Revert with a plain revert. Deploying needs the usual orca-cloud pin bump; alerts.jsonc needs no change.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Cloudflare Durable Object queries now include each invocation group’s type and filter groups by configured namespace IDs. The tally can exclude hibernation requests from error counts while retaining them in invocation totals. connector-wake enables this option. Tests verify that hibernation exceptions are excluded and that jsrpc exceptions and http internal errors count toward alerts.

Merge Risk: Minimal · up to 3476f

The connector-wake Cloudflare error alert now excludes failing hibernation Durable Object invocations from its error count while still counting them as invocations. The earlier concern about the query's 200-group cap is addressed by filtering to the configured namespaces on the Cloudflare side. Other Durable Object errors, Worker errors, and the relay-edge alert behave as before. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the connector-wake alerts and the Durable Object retirement close errors being skipped. The change excludes hibernation scriptThrewException counts from the cloudflare-errors alert, wh…
Description check Passed The description follows the template well. It has the ELI5, What Changed, Why, Testing, Performance, Risk, and Checklist sections, and it explains the trade-off clearly. The Linked Issue section says …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the connector-wake alerts and the Durable Object retirement close errors being skipped. The change excludes hibernation scriptThrewException counts from the cloudflare-errors alert, which matches the title's subject. The title is specific and short, though 'retirement close errors' is slightly narrower than the change, which also adds a type dimension to the GraphQL query and an option in relay-edge.

Full details: Description check

Explanation

The description follows the template well. It has the ELI5, What Changed, Why, Testing, Performance, Risk, and Checklist sections, and it explains the trade-off clearly. The Linked Issue section says N/A (internal alert tuning), which the template does not allow for outside contributors, but the author may be a maintainer. The Visual Proof section gives a reason for N/A. The Risk level is set to Low. The AI Disclosure section is empty, and the Review section has no content. The Performance section finishes the required sentence. The Testing section lists the required items. Most required information is present.

Resolution

Optionally fill in the empty AI Disclosure and Review sections, and confirm the Linked Issue exemption applies to this author.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4dbbb49a-7375-4e6b-95ca-245555e516b6
Commits

Reviewing files that changed from the base of the PR and between 21208f3 and 3476f6f.

Files selected for processing: 2

  • cloud/apps/connector-wake/test/alerts.test.ts
  • cloud/apps/relay-edge/src/alerts-cloudflare.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ccab4154-a14e-4146-909e-7e2ea2027fee
Commits

Reviewing files that changed from the base of the PR and between 5d299f8 and 21208f3.

Files selected for processing: 3

  • cloud/apps/connector-wake/src/alerts.ts
  • cloud/apps/connector-wake/test/alerts.test.ts
  • cloud/apps/relay-edge/src/alerts-cloudflare.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@Jinwoo-H
Jinwoo-H merged commit 8e71ae8 into main Nov 26, 2026
30 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.

1 participant