Skip to content

fix: load Data's provider key when Zo injects its own token - #11

Merged
EthanThatOneKid merged 1 commit into
mainfrom
letta-cutover
Sep 25, 2026
Merged

EthanThatOneKid merged 1 commit into
mainfrom
letta-cutover

Conversation

@EthanThatOneKid

Copy link
Copy Markdown
Contributor

Why

The live data-http answered Provider is not configured: openrouter on its first real question after the cutover (#10).

What happened

loadZoSecrets() returns early when ZO_CLIENT_IDENTITY_TOKEN is already set, and a Zo-managed service always has it injected. So the live process never read /root/.zo_secrets, never saw DATA_OPENROUTER_API_KEY, and never aliased it to OPENROUTER_API_KEY. The local check before the merge ran with a bare environment, so it loaded the file and passed.

Fix

  • lib/zo-secrets.ts: secret parsing and selection split out of the service, with missingSecrets(secrets, env, names?) — naming keys loads them regardless of the injected token, and a value the process already carries still wins.
  • channels/http/index.ts: load the whole file only when Zo did not inject its token (unchanged behavior), and always load the provider keys by name.
  • lib/zo-secrets.test.ts: covers the injected-token case that caused this.

Verified

  • npm run typecheck, npm test — 21 passed.
  • The service started with the live environment shape (ZO_CLIENT_IDENTITY_TOKEN set, no provider key) exports the alias from the file and answered, with citations.

@wazoocomputer

wazoocomputer Bot commented Sep 25, 2026

Copy link
Copy Markdown

This pull request addresses an issue where Data was unable to load its OpenRouter API key when deployed in an environment where Zo injects its own identity token. The fix modifies how secrets are loaded, ensuring that provider-specific keys are always read, even when the Zo token is present. This is a critical fix to ensure Data's functionality in its deployment environment.

File Path Change Type Summary
.gitignore modified Adds a new entry for .letta/
AGENTS.md modified Updates documentation on Data's memory, persona, and self-hosted agent
README.md modified Updates documentation on Data's identity, how it runs, and adds a rollback section
agent/README.md modified Updates documentation on Data's identity and how its prompt is managed
channels/discord/README.md modified Clarifies how the Discord bridge interacts with Data's identity
channels/http/README.md modified Updates documentation on the data-http service, its endpoints, environment variables, and running instructions
channels/http/index.ts modified Modifies secret loading logic and adds provider key aliasing to address the core issue
lib/sync-persona.test.ts added New test file for persona synchronization logic
lib/sync-persona.ts added New utility for synchronizing persona from instructions
lib/zo-secrets.test.ts added New test file for Zo secrets parsing and loading
lib/zo-secrets.ts added New utility for parsing and managing Zo secrets
package.json modified Updates dependencies or scripts
scripts/sync-persona.ts added New script for synchronizing persona
services/README.md modified Updates services documentation
services/http-api.md modified Updates HTTP API service documentation

Reviewers, please start by examining channels/http/index.ts and lib/zo-secrets.ts to understand the core changes to secret loading.

1 similar comment
@wazoocomputer

wazoocomputer Bot commented Sep 25, 2026

Copy link
Copy Markdown

This pull request addresses an issue where Data was unable to load its OpenRouter API key when deployed in an environment where Zo injects its own identity token. The fix modifies how secrets are loaded, ensuring that provider-specific keys are always read, even when the Zo token is present. This is a critical fix to ensure Data's functionality in its deployment environment.

File Path Change Type Summary
.gitignore modified Adds a new entry for .letta/
AGENTS.md modified Updates documentation on Data's memory, persona, and self-hosted agent
README.md modified Updates documentation on Data's identity, how it runs, and adds a rollback section
agent/README.md modified Updates documentation on Data's identity and how its prompt is managed
channels/discord/README.md modified Clarifies how the Discord bridge interacts with Data's identity
channels/http/README.md modified Updates documentation on the data-http service, its endpoints, environment variables, and running instructions
channels/http/index.ts modified Modifies secret loading logic and adds provider key aliasing to address the core issue
lib/sync-persona.test.ts added New test file for persona synchronization logic
lib/sync-persona.ts added New utility for synchronizing persona from instructions
lib/zo-secrets.test.ts added New test file for Zo secrets parsing and loading
lib/zo-secrets.ts added New utility for parsing and managing Zo secrets
package.json modified Updates dependencies or scripts
scripts/sync-persona.ts added New script for synchronizing persona
services/README.md modified Updates services documentation
services/http-api.md modified Updates HTTP API service documentation

Reviewers, please start by examining channels/http/index.ts and lib/zo-secrets.ts to understand the core changes to secret loading.

The service bails out of the secret loader whenever ZO_CLIENT_IDENTITY_TOKEN is
already set, and a Zo-managed service always has it. So the live data-http never
read DATA_OPENROUTER_API_KEY, and the first turn failed with
`Provider is not configured: openrouter` — the same failure the local check
missed because it ran without that token. Loading named keys loads them either
way, and a value the process already carries still wins.
@EthanThatOneKid
EthanThatOneKid merged commit dbb7884 into main Sep 25, 2026
1 check passed
@EthanThatOneKid
EthanThatOneKid deleted the letta-cutover branch September 25, 2026 06:42
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