René's URL Explorer Experiment


Title: fix(redis): size cold-connection waits to survive a dead handshake by waleedlatif1 · Pull Request #7764 · simstudioai/sim · GitHub

Open Graph Title: fix(redis): size cold-connection waits to survive a dead handshake by waleedlatif1 · Pull Request #7764 · simstudioai/sim

X Title: fix(redis): size cold-connection waits to survive a dead handshake by waleedlatif1 · Pull Request #7764 · simstudioai/sim

Description: Summary Every readiness wait for a cold Redis connection was sized to a single deadline, so it expired while the first attempt was still being diagnosed — a configured retry could never be what rescued it Adds coldConnectionBudgetMs beside the pinned client (lib/core/config/redis-budget.ts): a dead attempt is charged at the larger of what governs it — connectTimeout for a connect that never completes (destroyed outright), or the handshake's command deadlines plus disconnectTimeout, because after the ready check times out ioredis half-closes the socket and a wedged peer never answers with a FIN. Then the client's first reconnect delay, then a healthy attempt. Authenticated URLs cost one command deadline (a timed-out AUTH is fatal), unauthenticated two (CLIENT SETNAME/SETINFO settle before INFO starts); the budget takes the larger so it holds for either without parsing the URL Execution-signal subscriber: readiness budget was the same constant as its commandTimeout (5s/5s). The command deadline stays at 5s — it also bounds the live SUBSCRIBE, and an initial subscribe that rejects fails the run — and the budget is derived in the constructor from the exact options the client is built with: 13.5s Each waiter gets its own deadline. Waiters race the shared readiness signal against a per-waiter timer; the last to leave detaches the listeners, and a signal that settles clears itself. Before this branch the memoized promise shared one timer, so a late joiner inherited only the remainder Shared client warm-up: budget was 10s against a 5s deadline — exactly the moment ioredis first tears a stalled socket down. Now 14.3s, derived from the client's own connect and disconnect deadlines and a pure sharedReconnectDelayMs that retryStrategy uses too The signal subscriber is connected on intent. Constructing the hub is what connects, so executeWorkflowCore — the one path every execution shares — constructs it as its first statement, synchronously and never throwing, and the handshake overlaps the reads and preprocessing ahead of the subscribe. Only tasks that execute a workflow ever subscribe, and they are a minority of runs (over a week, 71% never do; one document-processing task is 61% alone), so neither the Trigger.dev init hook nor the Next server opens it eagerly Verified against the installed ioredis With a server that stalls only the first handshake and never sends a FIN, exact production options: unauthenticated, the socket closes at 12.0s (10s of command deadlines + 2s half-close) and a healthy connection #2 is ready at 12.5s; authenticated, at 7.0s / 7.5s. Today's subscriber budget (5000) fails at 5.0s on connection #1, matching the production failure; the derived 13.5s budget recovers both shapes. What this is and is not Not a strict improvement, stated precisely. In the failure shape observed in production — shared client healthy, subscriber handshake dead — a run now fails at ~13.5s instead of ~5s, and the same wait applies when Redis is simply unreachable. During a total outage the awaited warm-up costs 14.3s before the run starts and then either the shared client's 5s admission deadline or the 13.5s subscribe fails it: roughly 19–28s of worker hold versus ~15s before this PR. That is the whole regression surface, in exchange for recovering from every transient stall. The guarantee is one dead attempt from a fresh or previously-ready client; a wait that begins while the client is already deep in a reconnect loop faces larger delays this does not model. A widened wait also widens the window in which a short execution timeout pre-empts it and reports itself instead of the Redis failure. On the healthy path nothing waits longer: the subscriber's ~40ms handshake now overlaps preprocessing instead of running inside run() before the engine starts, and the 71% of runs that never subscribe never open that connection. Pub/Sub is at-most-once, so the run-fails-if-it-cannot-subscribe stance is kept deliberately — this change makes that subscription recoverable, it does not make it optional. Type of Change Bug fix Testing New tests: the budget helper (command deadlines plus half-close, the connect deadline when larger, the healthy-attempt allowance); the shared client's pure reconnect delay; the warm-up outlasts one dead attempt and still gives up past its budget; the subscriber waits exactly the budget derived from its own options; a subscribe joining another in-flight wait keeps its own full budget; waiter accounting stays exact when one waiter times out before the signal settles; connecting ahead of a subscription never throws on a misconfigured URL; executeWorkflowCore connects synchronously before its first await. Each verified to fail under a targeted sabotage on its intended assertion (dropping the half-close term, a shared timer, never detaching, the connect moved after the first await). Shared test infra changed (redis-config.mock.ts), so the full suite was run on the rebased tree: 50,151 tests pass in apps/sim, 381 in apps/realtime, 222 in packages/utils, 50 in packages/testing. bun run type-check clean in apps/sim, packages/utils, and packages/testing. bun run lint, docs-manifest:check, block-registry check, and all 46 audits in check:audits pass. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Every readiness wait for a cold Redis connection was sized to a single deadline, so it expired while the first attempt was still being diagnosed — a configured retry could never be what re...

X Description: Summary Every readiness wait for a cold Redis connection was sized to a single deadline, so it expired while the first attempt was still being diagnosed — a configured retry could never be what re...

Opengraph URL: https://github.com/simstudioai/sim/pull/7764

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b02387f0-187d-4e2d-d8c8-27e8b4e42f5d
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD2C8:2E7595:4FA03D:721C1B:6AFB3C0F
html-safe-nonce27737d082476352a770fd45891914b26d68cd636f34f741352cc689ea723bd1b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkM4OjJFNzU5NTo0RkEwM0Q6NzIxQzFCOjZBRkIzQzBGIiwidmlzaXRvcl9pZCI6IjE3NTE0NDgzNjE4NTc5MjQxMTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaccb35806f12879ff3b0ad68bcbb13639fae15b8f0a074da7dcbab38222fc12f6e
hovercard-subject-tagpull_request:4503027757
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/7764/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary Every readiness wait for a cold Redis connection was sized to a single deadline, so it expired while the first attempt was still being diagnosed — a configured retry could never be what re...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2169b0dfbef67ed6b128074a5ed45bb7d5d1859783b10178b09a7765ad5f3693
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3b4fc8df5ef1c6757e733a23e6b81b6725021823
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/7764/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F7764%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F7764%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/7764/files
Reloadhttps://github.com/simstudioai/sim/pull/7764/files
Reloadhttps://github.com/simstudioai/sim/pull/7764/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests199 (199)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/redis-cold-connection-budgethttps://github.com/simstudioai/sim/tree/fix/redis-cold-connection-budget
Conversation 46 https://github.com/simstudioai/sim/pull/7764
Commits 10 https://github.com/simstudioai/sim/pull/7764/commits
Checks 33 https://github.com/simstudioai/sim/pull/7764/checks
Files changed https://github.com/simstudioai/sim/pull/7764/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7764/files
fix(redis): size cold-connection waits to survive a dead handshake https://github.com/simstudioai/sim/pull/7764/files#top
Show all changes 10 commits https://github.com/simstudioai/sim/pull/7764/files
7e6d7a7 fix(redis): size cold-connection waits to survive a dead handshake waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/7e6d7a7f3e42a486dc7768fb46a2a7bc86db32ab
f18d245 fix(redis): keep the subscriber's live command deadline at 5s waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/f18d24589e7991899c504b70939109ac7d2b407d
3e60fcb improvement(redis): warm the signal subscriber on intent, not at work… waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/3e60fcb4ba83be783151813b3e56b5e018c0a49f
c64d1c2 chore(instrumentation): import the warm-ups through the path alias waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/c64d1c278f07509f1dc2d0ba72a23e3e6cdce8f5
acf01a9 fix(redis): give every readiness waiter its own deadline and correct … waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/acf01a92c0034007b0cf4f5385af938833c817b5
4221bf6 fix(redis): leave the readiness wait exactly once per waiter waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/4221bf6610f745c0fe34e116036d8dca8c5cb27f
84116a8 test(redis): assert the fresh subscribe by channel, not by call count waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/84116a8d5727af9ccb80c5de1da9013078225082
7730723 test(redis): prove waiter accounting by the teardown a timed-out wait… waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/7730723c241535787dd9f7d39c88c1becab1fc28
39e039a test(execution-core): type the warm-up test's fixtures instead of cas… waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/39e039a2c17dd596b37676392854e2abd7be1b4f
b91b90a fix(redis): connect the signal subscriber on intent and complete the … waleedlatif1 Sep 11, 2026 https://github.com/simstudioai/sim/pull/7764/commits/b91b90a898c9c11d3a6eb3c4e6cfd9ac76bff9ae
Clear filters https://github.com/simstudioai/sim/pull/7764/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7764/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7764/files
instrumentation-node.ts https://github.com/simstudioai/sim/pull/7764/files#diff-88ddb7dc8f80cef82717337adcd5362e9ebe41a1042731cb76bdc3ef232d1250
redis-budget.test.ts https://github.com/simstudioai/sim/pull/7764/files#diff-2811986d1f5f046d20dabf7cc5ef827da910864210f574fc2fd5ad6dcd5be9fe
redis-budget.ts https://github.com/simstudioai/sim/pull/7764/files#diff-c00e3aec1a4a15c64f2a91576d0b8aac159621952040d7628839496139338e9c
redis.test.ts https://github.com/simstudioai/sim/pull/7764/files#diff-c6ad185c1c43eadf2b2ccc55086d0ee0bb12266114edc693d20f1bf9b94da3b5
redis.ts https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
execution-signal.test.ts https://github.com/simstudioai/sim/pull/7764/files#diff-63ae037a003727a473fc942222801aa64073e5f7491c83517b186e0e9c14bc71
execution-signal.ts https://github.com/simstudioai/sim/pull/7764/files#diff-a276c3f27ce352f686780c4f2d2f75170e2b97cddf8e69ec1fc6a86d7cdf0775
execution-core.test.ts https://github.com/simstudioai/sim/pull/7764/files#diff-40c3467de29e00eaa8563d025139feccb3d119364e628433260c1b6c70d89704
execution-core.ts https://github.com/simstudioai/sim/pull/7764/files#diff-2a32d546272efa06e3cbe2ccce1cf4e69c74ff37fe98253bcb2742ffed5bae4b
trigger.config.ts https://github.com/simstudioai/sim/pull/7764/files#diff-3e89ed60c3946e67cfc357495159a4bf5e261ea848b2fa28ddb351aa9e7a877c
redis-config.mock.test.ts https://github.com/simstudioai/sim/pull/7764/files#diff-365d8360b92de987cad7ce10ccd3c96d6eb9b661ddd94d50e0468646c4604f31
redis-config.mock.ts https://github.com/simstudioai/sim/pull/7764/files#diff-5c638bdef5e048b6f8fbff640cf0dc366a6c1d7452ca8dd4dd3ba5566a3427ca
apps/sim/instrumentation-node.tshttps://github.com/simstudioai/sim/pull/7764/files#diff-88ddb7dc8f80cef82717337adcd5362e9ebe41a1042731cb76bdc3ef232d1250
View file https://github.com/simstudioai/sim/blob/b91b90a898c9c11d3a6eb3c4e6cfd9ac76bff9ae/apps/sim/instrumentation-node.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7764/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/7764/files#diff-88ddb7dc8f80cef82717337adcd5362e9ebe41a1042731cb76bdc3ef232d1250
apps/sim/lib/core/config/redis-budget.test.tshttps://github.com/simstudioai/sim/pull/7764/files#diff-2811986d1f5f046d20dabf7cc5ef827da910864210f574fc2fd5ad6dcd5be9fe
View file https://github.com/simstudioai/sim/blob/b91b90a898c9c11d3a6eb3c4e6cfd9ac76bff9ae/apps/sim/lib/core/config/redis-budget.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7764/{{ revealButtonHref }}
apps/sim/lib/core/config/redis-budget.tshttps://github.com/simstudioai/sim/pull/7764/files#diff-c00e3aec1a4a15c64f2a91576d0b8aac159621952040d7628839496139338e9c
View file https://github.com/simstudioai/sim/blob/b91b90a898c9c11d3a6eb3c4e6cfd9ac76bff9ae/apps/sim/lib/core/config/redis-budget.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7764/{{ revealButtonHref }}
apps/sim/lib/core/config/redis.test.tshttps://github.com/simstudioai/sim/pull/7764/files#diff-c6ad185c1c43eadf2b2ccc55086d0ee0bb12266114edc693d20f1bf9b94da3b5
View file https://github.com/simstudioai/sim/blob/b91b90a898c9c11d3a6eb3c4e6cfd9ac76bff9ae/apps/sim/lib/core/config/redis.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7764/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/7764/files#diff-c6ad185c1c43eadf2b2ccc55086d0ee0bb12266114edc693d20f1bf9b94da3b5
https://github.com/simstudioai/sim/pull/7764/files#diff-c6ad185c1c43eadf2b2ccc55086d0ee0bb12266114edc693d20f1bf9b94da3b5
https://github.com/simstudioai/sim/pull/7764/files#diff-c6ad185c1c43eadf2b2ccc55086d0ee0bb12266114edc693d20f1bf9b94da3b5
https://github.com/simstudioai/sim/pull/7764/files#diff-c6ad185c1c43eadf2b2ccc55086d0ee0bb12266114edc693d20f1bf9b94da3b5
apps/sim/lib/core/config/redis.tshttps://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
View file https://github.com/simstudioai/sim/blob/b91b90a898c9c11d3a6eb3c4e6cfd9ac76bff9ae/apps/sim/lib/core/config/redis.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7764/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
https://github.com/simstudioai/sim/pull/7764/files#diff-af191f255d57cc29ed5bf97c929967b6b922d94d754a7d73abcbf88594b4dc7d
Please reload this pagehttps://github.com/simstudioai/sim/pull/7764/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7764/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.