Skip to content

Rename Rhesis Default model to Rhesis - #2385

Merged
harry-rhesis merged 5 commits into
mainfrom
chore/rename-rhesis-model
Aug 15, 2026
Merged

Rename Rhesis Default model to Rhesis#2385
harry-rhesis merged 5 commits into
mainfrom
chore/rename-rhesis-model

Conversation

@harry-rhesis

Copy link
Copy Markdown
Contributor

Purpose

The Rhesis-hosted default model was named "Rhesis Default" with model_name "default", which reads oddly in the UI now that other Rhesis-hosted models exist (Polyphemus). It's being renamed to "Rhesis" with model_name "rhesis-managed" to read more cleanly, matching the updated design.

What Changed

  • Renamed the onboarded model display names: "Rhesis Default" → "Rhesis", "Rhesis Default Embedding" → "Rhesis Embedding"
  • Changed model_name from "default" to "rhesis-managed" for both, so the composite id becomes rhesis/rhesis-managed (was rhesis/rhesis-default)
  • Updated all backend defaults (ModelSettings), SDK defaults (sdk/src/rhesis/sdk/models/defaults.py), the explorer embedding fallback lookup, chatbot app defaults, Helm chart values, and .env.example to the new composite id
  • Added Alembic migration b7e3a1c9d2f6 to rename existing org rows in the model table (with a downgrade path back to the old names)
  • Updated docstrings/comments referencing the old name
  • Updated backend and SDK tests to match

Additional Context

  • Kubernetes external-secrets keys (e.g. dev-rhesis-default-polyphemus-url) are left as-is — those are GCP Secret Manager key names for Polyphemus, unrelated to this model's identifier, and changing them needs coordinated infra work.
  • Historical Alembic migrations and CHANGELOG entries that reference the old name are untouched, as historical records.

Testing

  • Ran uv run pytest ../../tests/backend/services/test_organization.py ../../tests/backend/app/test_settings.py ../../tests/backend/routes/test_explorer.py ../../tests/backend/services/explorer/ from apps/backend — 358 passed, 1 skipped (pre-existing skip)
  • Ran uv run pytest ../tests/sdk/models/test_model_factory.py ../tests/sdk/connector/test_serializer_integration.py from sdk — 64 passed
  • Applied the new migration to the local dev database (uv run alembic upgrade head) and confirmed all 131 org rows updated: Rhesis/rhesis-managed and Rhesis Embedding/rhesis-managed, with no leftover "Rhesis Default" rows

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

Improvement: Tighten the embedding fallback and migration predicates.

  1. get_default_embedding_model() now prefers a more generic name ("Rhesis Embedding")—consider ensuring it can’t accidentally select a user-created model with the same name.
  2. Alembic migration matches only on name + is_protected; consider additionally matching on expected model_name/provider/model_type so upgrade/downgrade are safer against unexpected duplicates.

.filter(
models.Model.organization_id == org_uuid,
models.Model.name == "Rhesis Default Embedding",
models.Model.name == "Rhesis Embedding",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Improvement: get_default_embedding_model() now prefers the org model named "Rhesis Embedding".

If a user creates a non-protected embedding model with the same name, this will pick that one first (.first()), which seems like an easy footgun now that the name is more generic.

Fix: Consider adding models.Model.is_protected.is_(True) (and/or joining provider_type == "rhesis") to the by_name query as well, so the fallback is guaranteed to pick the system model.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Confirmed fix: adding is_protected.is_(True) to the org-name fallback avoids collisions with user-created models named "Rhesis Embedding". Thanks!

model_name = 'default',
description = 'Default Rhesis language model.'
WHERE name = 'Rhesis'
AND is_protected = TRUE

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Improvement: The migration renames rows purely by name + is_protected = TRUE.

If an org ever ends up with multiple protected Rhesis models called "Rhesis" (or "Rhesis Embedding") from prior partial runs/manual fixes, the downgrade() would flip all matching rows back to model_name='default'.

Fix: Consider tightening the WHERE clauses to also include provider (join on provider_type_id → type_value = 'rhesis') and the expected model_type, or at least match on the old/new model_name values too (e.g. upgrade WHERE model_name='default', downgrade WHERE model_name='rhesis-managed').

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Much safer with the provider_type_id (= rhesis) predicate added. Optional extra hardening: also constrain by the expected model_name (upgrade model_name='default', downgrade model_name='rhesis-managed') and/or model_type, so a future additional protected Rhesis model named "Rhesis" doesn’t get flipped on downgrade.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving as-is for now — name + is_protected + provider=rhesis already uniquely identifies these rows given the current data model (one protected rhesis-provider model per org per type today). Adding a model_name guard would only matter for a hypothetical future protected model also named "Rhesis" with a different `model_name", so not worth the extra complexity right now. Thanks for flagging it though.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Makes sense — with provider=rhesis + is_protected (and given the current “one protected rhesis model per org per type” invariant), the migration scope is already pretty tight.

If you keep it as-is, one small suggestion would be to add a brief comment in the migration noting that assumption, so future us knows why we didn’t also guard on model_name/model_type. Otherwise I’m good with this.

@peqy

peqy Bot commented Aug 6, 2026

Copy link
Copy Markdown

Update after 13c866d:

  • get_default_embedding_model() now filters is_protected, so it won’t accidentally pick a user-created model named “Rhesis Embedding”.
  • ✅ Migration WHERE clauses are tightened to the rhesis provider.

Remaining (non-blocking) hardening suggestion: in the Alembic migration, also constrain upgrade/downgrade by the expected model_name (upgrade model_name='default', downgrade model_name='rhesis-managed') and/or model_type, so a future additional protected Rhesis model with the same display name doesn’t get flipped during downgrade.

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

Critical: apps/backend/.../services/organization.py has invalid Python syntax (model_name=\"rhesis\"). This will break the backend.

Improvement: Avoid editing existing Alembic migration files (e.g. 41a9355b3991_...) after they may have been applied; prefer a new migration for the Polyphemus description tweak.

Found 2 issues (1 critical, 1 improvement).

model_name="default",
name="Rhesis Default",
description="Default Rhesis language model.",
model_name=\"rhesis\",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Critical: This is invalid Python syntax: model_name=\"rhesis\" (the backslashes are literal).

Fix: change to model_name="rhesis" (no backslashes) in both the language + embedding model creation calls.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Confirmed fixed in latest commits: model_name="rhesis" is now valid model_name="rhesis" in both default model creation calls. Thanks!

@@ -0,0 +1,142 @@
"""rename_rhesis_default_model_to_rhesis

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Improvement: This migration now also tweaks the Polyphemus description (and this MR also edits an existing migration 41a9355b3991_...).

If 41a9355b3991 has already shipped/applied anywhere, modifying it can make migrations non-reproducible (DBs that already ran it won’t get the new description).

Fix: Prefer a new migration (or keep the Polyphemus description change only in this new migration) and leave older migration files immutable. At minimum, please confirm 41a9355b3991 isn’t in a released chain yet.

@@ -89,7 +89,7 @@ def upgrade() -> None:
model_name="default",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Improvement: Avoid editing existing Alembic revisions after they may have been applied.

If 41a9355b3991 is already in production history, changing this string won’t update existing DBs and can make the migration chain non-reproducible.

Fix: revert this edit and (if the copy needs changing) do it in a new migration or via the new b7e3a1c9d2f6 migration only.

Display name changes from "Rhesis Default"/"Rhesis Default Embedding"
to "Rhesis"/"Rhesis Embedding", and model_name from "default" to
"rhesis-managed" (composite id becomes rhesis/rhesis-managed).
Includes a data migration for existing org rows.

Signed-off-by: Harry Cruz <harry@rhesis.ai>
Require is_protected in the embedding-model by-name lookup so a
user-created model can't shadow the system default. Add a
provider_type join to the rename migration's WHERE clauses so
upgrade/downgrade only ever touch rhesis-provider protected rows.

Signed-off-by: Harry Cruz <harry@rhesis.ai>
Change model_name from "rhesis-managed" to "rhesis" so the composite
id is rhesis/rhesis. Remove "No API key required/needed" from
Polyphemus and Rhesis model descriptions and connection test messages.
Update the Alembic migration to apply both changes to existing rows.

Signed-off-by: Harry Cruz <harry@rhesis.ai>
…ion down_revision

The sed-based rename left escaped backslashes in model_name
assignments causing a SyntaxError. Also update the migration's
down_revision to 491519fd3010 (current main head).

Signed-off-by: Harry Cruz <harry@rhesis.ai>
@harry-rhesis
harry-rhesis force-pushed the chore/rename-rhesis-model branch from 7d73ec5 to 0bce09c Compare August 15, 2026 13:15
Signed-off-by: Harry Cruz <harry@rhesis.ai>
@harry-rhesis
harry-rhesis merged commit 8700ed2 into main Aug 15, 2026
19 checks passed
@harry-rhesis
harry-rhesis deleted the chore/rename-rhesis-model branch August 15, 2026 13:25

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

Update on latest commits:

  • organization.py syntax issue is fixed (model_name="rhesis" now valid in both default model creations).

Improvement: Avoid editing existing Alembic revisions (41a9355b3991_...). Even for copy changes, it can make the migration chain non-reproducible and won’t update DBs that already applied it.

Fix: revert the edit to 41a9355b3991_... and rely on the new b7e3a1c9d2f6 migration (or a new migration) for the Polyphemus description update.

Improvement: In b7e3a1c9d2f6_..., the header says Revises: e90c29496562 but down_revision is 491519fd3010.

Fix: update the docstring header to match the actual down_revision (or vice versa) to avoid confusion.

Improvement: There’s still a seeded default value "rhesis/rhesis-default" in f3a4b5c6d7e8_add_parameters_to_chatbot_request_mapping.py (chatbot example project parameter schema).

Fix: update that default to "rhesis/rhesis" so new DBs don’t keep pointing at the old model id.

Found 3 issues (0 critical, 3 improvements).

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