Skip to content
This repository was archived by the owner on May 26, 2026. It is now read-only.

fix: preserve self-hosted model endpoints on model changes - #668

Open
geilwerk wants to merge 2 commits into
letta-ai:mainfrom
geilwerk:fix/preserve-self-hosted-model-endpoints
Open

geilwerk wants to merge 2 commits into
letta-ai:mainfrom
geilwerk:fix/preserve-self-hosted-model-endpoints

Conversation

@geilwerk

@geilwerk geilwerk commented Apr 2, 2026

Copy link
Copy Markdown

Summary

  • preserve self-hosted LLM endpoints when switching models
  • preserve self-hosted embedding endpoints during model changes
  • add regression coverage for Ollama/self-hosted and cloud-only updates

Context

Self-hosted Letta deployments can store custom model and embedding endpoints such as Ollama. Updating the model with a minimal payload was causing those saved endpoints to be dropped, which broke agents using Docker plus Ollama setups.

Testing

  • npm run test:run -- src/tools/letta-api.test.ts

Copilot AI review requested due to automatic review settings April 2, 2026 21:53

Copilot AI 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.

Pull request overview

Fixes a regression where updating an agent’s model with a minimal payload on self-hosted Letta servers could drop persisted custom LLM/embedding endpoints (e.g., Ollama), breaking agents configured with custom endpoints.

Changes:

  • Adds self-hosted-aware preservation logic to keep llm_config.model_endpoint and embedding_config.embedding_endpoint intact when switching models.
  • Refactors base URL handling to be read dynamically from process.env.LETTA_BASE_URL (instead of a module-level constant).
  • Adds Vitest regression coverage for self-hosted endpoint preservation and cloud minimal-update behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/tools/letta-api.ts Preserves self-hosted LLM/embedding endpoint configs during model updates; introduces helper functions for handle parsing and preservation decisions.
src/tools/letta-api.test.ts Adds regression tests covering self-hosted Ollama preservation and cloud minimal update payloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/letta-api.ts
Comment thread src/tools/letta-api.test.ts
@geilwerk

geilwerk commented Apr 2, 2026

Copy link
Copy Markdown
Author

Addressing the review feedback is pushed.

Changes in the follow-up:

  • restored the minimal cloud update path to avoid the extra retrieve round-trip
  • added coverage for the self-hosted provider-mismatch case

Validation:

  • npm run test:run -- src/tools/letta-api.test.ts
  • npm run build

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants