Skip to content

feat: add Redis Sentinel and TLS support in TrueForge - #765

Merged
ramantehlan merged 21 commits into
mainfrom
feat/redis-connection-options
Sep 22, 2026
Merged

ramantehlan merged 21 commits into
mainfrom
feat/redis-connection-options

Conversation

@thesujai

@thesujai thesujai commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

feat: add Redis Sentinel and TLS support in TrueForge

Closes AGE-2071

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

High Risk
Changes how every peered replica connects to Redis (TLS, Sentinel, transport rules) and how executor peering/subscribe behaves, which can break multi-replica cancel/streaming if misconfigured.

Overview
Adds Redis Sentinel and TLS for distributed mode, replacing the single REDIS_URL knob with a resolved REDIS_CONNECTION transport (URL, REDIS_HOST + auth/DB, or Sentinel) that fail-fast when env vars conflict. Controller/migrate can boot without Redis at config load; the server still requires a transport when it connects.

Runtime wiring connects standalone or Sentinel (with TLS socket options, connect/ping timeouts, and Sentinel connect rebuild/retry), uses a duplicate subscriber for standalone but the shared client for Sentinel pub/sub, and dedupes Redis clients on shutdown. Request-reply peering keeps heartbeats running through transient subscriber errors so reconnect can re-subscribe.

The Helm chart (0.2.3) expands externalRedis (enabled, url/host/sentinel/tls/auth) and maps it to the new REDIS_* env vars, with template validation for mutually exclusive modes. Docs, .env.example, and a buildRedisStandaloneUrl unit test accompany the change.

Reviewed by Cursor Bugbot for commit 4b04f86. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4b04f86

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

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge Minor
@truefoundry/trueforge-core Minor

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread charts/trueforge/templates/_helpers.tpl
Comment thread charts/trueforge/templates/_helpers.tpl
@thesujai
thesujai force-pushed the feat/redis-connection-options branch from 49bd3b1 to 55f843d Compare September 22, 2026 06:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/runtime/redis.ts
Comment thread packages/trueforge/.env.example Outdated
Comment thread packages/trueforge/src/config.ts
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
ramantehlan and others added 5 commits September 22, 2026 17:52
- redis.enabled now conflicts with any external Redis signal (url/host/
  sentinel), not just externalRedis.enabled, so a configured external
  Redis can no longer be silently shadowed by the bundled one.
- Fail when tls.enabled is set with a redis:// url: node-redis throws a
  TypeError at client creation on the scheme mismatch, which would
  otherwise surface as a crash loop.
- Fail when auth or a non-zero db accompany a url without Sentinel: the
  app prefers the url and silently drops them, connecting
  unauthenticated.
- Normalize tls.enabled / sentinel.enabled through toString so quoted
  "true" values enable the feature instead of silently rendering
  "false".

Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
…nto feat/redis-connection-options

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/config.ts Outdated
Comment thread packages/trueforge/src/main.ts
thesujai and others added 3 commits September 22, 2026 18:33
- pass tls.serverName through fromStringOrValueFrom like the other TLS
  fields so a valueFrom ref renders correctly
- bump chart version: 0.2.2 is already pinned by the umbrella chart

Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
@ramantehlan
ramantehlan enabled auto-merge (squash) September 22, 2026 13:16

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/runtime/redis.ts
Comment thread charts/trueforge/Chart.yaml
Comment thread packages/trueforge/src/config.ts
Comment thread charts/trueforge/templates/_helpers.tpl Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge/src/runtime/redis.ts Outdated
Comment thread packages/trueforge-core/src/request-reply/redisClient.ts Outdated
thesujai and others added 2 commits September 22, 2026 19:40
Collapse host/url into standalone URL mode, rename RedisPeerClient to RedisClient, require externalRedis.enabled in Helm, and tidy TLS typing.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bec846a. Configure here.

Comment thread packages/trueforge/src/config.ts Outdated
Bare addresses like ::1 produced invalid redis:// URLs after host mode was collapsed to a URL.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread packages/trueforge/src/config.ts Outdated
Comment thread packages/trueforge/src/config.ts
Comment thread packages/trueforge/src/config.ts
Comment thread packages/trueforge/src/main.ts Outdated

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

Keeping it approved, I will check the helpers.tpl separately

ramantehlan and others added 5 commits September 22, 2026 20:08
TLS is applied through node-redis socket options (REDIS_TLS_*), not the
url scheme, and host mode builds a redis:// url itself. Failing on
redis:// + tls.enabled rejected a working config and contradicted the
host path, which allows the same combination.

Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
The app reads REDIS_TLS_REJECT_UNAUTHORIZED (default true) but the chart
never emitted it, so a Redis with a self-signed cert and no obtainable
CA could only be reached through server.extraEnv.

Key presence is tested rather than piping through default, which would
turn an explicit false back into true. Also records the tls/sentinel
fields that accept valueFrom in the README.

Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
@ramantehlan
ramantehlan merged commit cf55de9 into main Sep 22, 2026
11 checks passed
@ramantehlan
ramantehlan deleted the feat/redis-connection-options branch September 22, 2026 14:52
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.

4 participants