Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(agent-proxy): read TASKS_REDIS_URL for the task-run stream (#65596)

Charles Vien7aa4695c62e9
diff --git a/services/agent-proxy/.dev.vars.example b/services/agent-proxy/.dev.vars.example
index f05d7daaf5e8..1c16d369e361 100644
--- a/services/agent-proxy/.dev.vars.example
+++ b/services/agent-proxy/.dev.vars.example
@@ -10,11 +10,11 @@
# Redis
# ---------------------------------------------------------------------------
-# Redis connection URL. Required in production (NODE_ENV=production).
+# Task-run stream Redis connection URL. Required in production (NODE_ENV=production).
# In non-production NODE_ENV the service falls back to a local Redis instance
# when this is unset.
# nosemgrep: trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport
-REDIS_URL=redis://localhost:6379
+TASKS_REDIS_URL=redis://localhost:6379
# ---------------------------------------------------------------------------
# JWT / Auth
diff --git a/services/agent-proxy/README.md b/services/agent-proxy/README.md
index 79c34c12a03d..aaab12e617a0 100644
--- a/services/agent-proxy/README.md
+++ b/services/agent-proxy/README.md
@@ -33,7 +33,7 @@ newest available entry.
| Variable | Required | Default | Description |
| --------------------------------- | ---------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `REDIS_URL` | yes (prod) | `localhost:6379` | Redis connection URL (unencrypted local Redis by default; use a TLS URL in production) |
+| `TASKS_REDIS_URL` | yes (prod) | `localhost:6379` | Redis connection URL (unencrypted local Redis by default; use a TLS URL in production) |
| `SANDBOX_JWT_PUBLIC_KEY` | yes | — | RS256 public key PEM (`\n` literals in env vars are normalized to real newlines before use) |
| `AGENT_PROXY_DJANGO_CALLBACK_URL` | yes (prod) | — | Base URL of the Django service for side-effect callbacks (Temporal heartbeat, awaiting-input push), e.g. `http://web:8000` |
| `AGENT_PROXY_CALLBACK_SECRET` | no | `''` | Shared secret sent as `X-Agent-Proxy-Secret` on the Django callback; Django enforces it when the same value is set on both sides, so a sandbox cannot call the callback directly |
@@ -96,7 +96,7 @@ TASKS_AGENT_PROXY_CORS_ORIGINS=http://localhost:8010
AGENT_PROXY_DJANGO_CALLBACK_URL=http://localhost:8000 # heartbeat + awaiting-input callbacks; omit to skip them
```
-`REDIS_URL` is optional locally — it defaults to `localhost:6379`, the
+`TASKS_REDIS_URL` is optional locally — it defaults to `localhost:6379`, the
same instance Django uses (the `redis7` host maps to localhost).
### 3. Start
diff --git a/services/agent-proxy/src/lib/config.ts b/services/agent-proxy/src/lib/config.ts
index 56479075a9a2..73e748c41f86 100644
--- a/services/agent-proxy/src/lib/config.ts
+++ b/services/agent-proxy/src/lib/config.ts
@@ -1,7 +1,7 @@
// Environment variable loading and validation for the agent-proxy service.
//
// Required vars (must be present in production / NODE_ENV=production):
-// REDIS_URL
+// TASKS_REDIS_URL
// SANDBOX_JWT_PUBLIC_KEY
// AGENT_PROXY_DJANGO_CALLBACK_URL
//
@@ -81,7 +81,8 @@ export function loadConfig(): Config {
const isProd = getEnv('NODE_ENV') === 'production'
// nosemgrep: trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport
- const redisUrl = getEnv('REDIS_URL') ?? (isProd ? requireEnv('REDIS_URL', true) : 'redis://localhost:6379')
+ const localRedisFallbackUrl = 'redis://localhost:6379'
+ const redisUrl = getEnv('TASKS_REDIS_URL') ?? (isProd ? requireEnv('TASKS_REDIS_URL', true) : localRedisFallbackUrl)
// Primary key (required) plus an optional secondary trusted during a key rotation overlap.
const sandboxJwtPublicKeysPem = [
diff --git a/services/agent-proxy/src/lib/env.ts b/services/agent-proxy/src/lib/env.ts
index 6287761f8a3e..8bb89611a376 100644
--- a/services/agent-proxy/src/lib/env.ts
+++ b/services/agent-proxy/src/lib/env.ts
@@ -6,7 +6,7 @@
// at runtime.
export type KnownEnvKey =
- | 'REDIS_URL'
+ | 'TASKS_REDIS_URL'
| 'SANDBOX_JWT_PUBLIC_KEY'
| 'SANDBOX_JWT_PUBLIC_KEY_SECONDARY'
| 'TASKS_AGENT_PROXY_CORS_ORIGINS'