Skip to content

Commit a035190

Browse files
Shawclaude
andcommitted
fix: dedupe rename-collapsed ELIZA_ env-var fallbacks across runtime + tests
The 2f1b81f milady→eliza rename collapsed every backward-compat fallback chain like `MILADY_X || ELIZA_X` into `ELIZA_X || ELIZA_X`, plus a few self-referential const declarations and duplicate window- global type entries. None of the dups were caught by typecheck on the original push because turbo had cached the affected packages. Source/runtime fixes (51 files): - resolveStateDir(), resolveConfigWritePath(), defaultRepoRoot(), stateDirBase(): collapse duplicate `process.env.X || process.env.X` - paths.ts STATE_DIR_OVERRIDE_KEYS / CONFIG_PATH_OVERRIDE_KEYS: `["X", "X"]` → `["X"]` - workspace.ts EXPLICIT_*_DIR_KEYS: same array dedupe - eliza-globals.ts: removed duplicate `__ELIZA_API_BASE__` / `__ELIZA_API_TOKEN__` window type entries (TS2300 blocker) - character-catalog.ts: removed self-referential `export const DEFAULT_ELIZA_CHARACTER_ASSET = DEFAULT_ELIZA_CHARACTER_ASSET` - server.ts: unified two identical `ELIZA_CONFIG_PATH` const reads - dozens of `X ?? X`, `X || X`, `(X ?? X) !== "0"`, `X === "1" || X === "1"`, `hasValue(X) || hasValue(X)`, and duplicate `process.env.X = ...` writes across agent/api, agent/runtime, agent/services, agent/providers, app-core/platforms/electrobun, app-core/api, app-core/services, app-core/runtime, app-core/cli, app-core/benchmark, app-core/scripts, app-lifeops/lifeops, app-steward, scenario-runner, vault, confidant, typescript, vite/vitest configs Test fixes (3 files): - packages/app-core/test/app/memory-relationships.real.e2e.test.ts - packages/app-core/test/app/qa-checklist.real.e2e.test.ts - packages/skills/test/provenance.test.ts Each had a duplicate `let prevElizaState: string | undefined;` plus a set+delete sequence that clobbered the just-set env var, leaving tests effectively running without any state-dir override (root cause of the curated-skills 404s on CI). What this does NOT fix (separate concerns): - drizzle-orm dual-resolution typecheck error in packages/app-core/src/services/auth-store.ts (pre-existing, two bun copies @0.45.2+5ca896fe6dab5078 vs +618017aa13271bc5 from different peer-dep contexts; not a rebrand regression) - electrobun lint warnings in src/preload.js + a few test files (pre-existing, exposed only because the rebrand busted turbo cache) - submodules cloud, plugin-local-ai (uncommitted local content unrelated to this work) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f9ff66e commit a035190

51 files changed

Lines changed: 56 additions & 195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/app-lifeops/src/activity-profile/activity-tracker-service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ export class ActivityTrackerService extends Service {
6464
}
6565

6666
private async startCollector(): Promise<void> {
67-
if (
68-
process.env.ELIZA_DISABLE_ACTIVITY_TRACKER === "1" ||
69-
process.env.ELIZA_DISABLE_ACTIVITY_TRACKER === "1"
70-
) {
67+
if (process.env.ELIZA_DISABLE_ACTIVITY_TRACKER === "1") {
7168
this.mode = "disabled-config";
7269
logger.info(
7370
"[activity-tracker] Collector disabled by configuration; reports will use seeded data only.",

apps/app-lifeops/src/lifeops/calendly-client.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ export class CalendlyError extends Error {
4343
const REQUEST_TIMEOUT_MS = 12_000;
4444

4545
function getCalendlyBaseUrl(): string {
46-
return (
47-
process.env.ELIZA_MOCK_CALENDLY_BASE ??
48-
process.env.ELIZA_MOCK_CALENDLY_BASE ??
49-
"https://api.calendly.com"
50-
);
46+
return process.env.ELIZA_MOCK_CALENDLY_BASE ?? "https://api.calendly.com";
5147
}
5248

5349
export function readCalendlyCredentialsFromEnv(

apps/app-lifeops/src/lifeops/google-fetch.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ const TIMEOUT_MS = 10_000;
1010
* Used in tests to point all Google API traffic at a Mockoon environment.
1111
*/
1212
export function rewriteGoogleUrlForMock(url: string): string {
13-
const mockBase =
14-
process.env.ELIZA_MOCK_GOOGLE_BASE ?? process.env.ELIZA_MOCK_GOOGLE_BASE;
13+
const mockBase = process.env.ELIZA_MOCK_GOOGLE_BASE;
1514
if (!mockBase) return url;
1615
const mockUrl = new URL(mockBase);
1716
if (

apps/app-lifeops/src/lifeops/schedule-state.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,17 +290,13 @@ function normalizeDurationMinutes(
290290

291291
export function resolveScheduleDeviceIdentity(): ResolvedScheduleDeviceIdentity {
292292
const envDeviceId =
293-
process.env.ELIZA_DEVICE_ID?.trim() ??
294-
process.env.ELIZA_DEVICE_ID?.trim() ??
295-
process.env.HOSTNAME?.trim();
293+
process.env.ELIZA_DEVICE_ID?.trim() ?? process.env.HOSTNAME?.trim();
296294
const deviceId =
297295
envDeviceId && envDeviceId.length > 0
298296
? envDeviceId
299297
: `${process.platform}-${crypto.createHash("sha1").update(process.cwd()).digest("hex").slice(0, 8)}`;
300298
const envDeviceKind =
301-
process.env.ELIZA_DEVICE_KIND?.trim().toLowerCase() ??
302-
process.env.ELIZA_DEVICE_KIND?.trim().toLowerCase() ??
303-
"";
299+
process.env.ELIZA_DEVICE_KIND?.trim().toLowerCase() ?? "";
304300
if (
305301
envDeviceKind === "iphone" ||
306302
envDeviceKind === "ipad" ||

apps/app-lifeops/src/lifeops/twilio.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@ export function readTwilioCredentialsFromEnv(
9292
}
9393

9494
function getTwilioBaseUrl(): string {
95-
return (
96-
process.env.ELIZA_MOCK_TWILIO_BASE ??
97-
process.env.ELIZA_MOCK_TWILIO_BASE ??
98-
"https://api.twilio.com"
99-
);
95+
return process.env.ELIZA_MOCK_TWILIO_BASE ?? "https://api.twilio.com";
10096
}
10197

10298
/** Maximum number of retries for transient (5xx / network) failures. */

apps/app-lifeops/src/lifeops/whatsapp-client.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ export class WhatsAppError extends Error {
4141

4242
const DEFAULT_API_VERSION = "v21.0";
4343
function getWhatsAppBaseUrl(): string {
44-
return (
45-
process.env.ELIZA_MOCK_WHATSAPP_BASE ??
46-
process.env.ELIZA_MOCK_WHATSAPP_BASE ??
47-
"https://graph.facebook.com"
48-
);
44+
return process.env.ELIZA_MOCK_WHATSAPP_BASE ?? "https://graph.facebook.com";
4945
}
5046

5147
export function readWhatsAppCredentialsFromEnv(

apps/app-lifeops/src/lifeops/x-poster.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ export interface XPostResult {
2424
}
2525

2626
function getXBaseUrl(): string {
27-
return (
28-
process.env.ELIZA_MOCK_X_BASE ??
29-
process.env.ELIZA_MOCK_X_BASE ??
30-
"https://api.twitter.com"
31-
);
27+
return process.env.ELIZA_MOCK_X_BASE ?? "https://api.twitter.com";
3228
}
3329

3430
function getXPostUrl(): string {

apps/app-lifeops/src/lifeops/x-reader.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import crypto from "node:crypto";
22
import { logger } from "@elizaos/core";
33

44
function getXBaseUrl(): string {
5-
return (
6-
process.env.ELIZA_MOCK_X_BASE ??
7-
process.env.ELIZA_MOCK_X_BASE ??
8-
"https://api.twitter.com"
9-
);
5+
return process.env.ELIZA_MOCK_X_BASE ?? "https://api.twitter.com";
106
}
117

128
/**

apps/app-steward/src/actions/transfer-token.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ function isStewardConfigured(): boolean {
8181
const url = process.env.STEWARD_API_URL?.trim();
8282
const agentId =
8383
process.env.STEWARD_AGENT_ID?.trim() ||
84-
process.env.ELIZA_STEWARD_AGENT_ID?.trim() ||
8584
process.env.ELIZA_STEWARD_AGENT_ID?.trim();
8685
return Boolean(url && agentId);
8786
}

apps/app-steward/src/api/wallet-routes.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ export async function handleWalletRoutes(
409409
const agentId =
410410
process.env.STEWARD_AGENT_ID?.trim() ||
411411
process.env.ELIZA_STEWARD_AGENT_ID?.trim() ||
412-
process.env.ELIZA_STEWARD_AGENT_ID?.trim() ||
413412
null;
414413

415414
if (!agentId) {

0 commit comments

Comments
 (0)