Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(config): remove retired tier slug migration

Steven Enamakel15c08998327f
diff --git a/crates/openhuman-core/src/config/migrations/normalize_default_model_tier.rs b/crates/openhuman-core/src/config/migrations/normalize_default_model_tier.rs
index 4b63bef48a..097459f4c0 100644
--- a/crates/openhuman-core/src/config/migrations/normalize_default_model_tier.rs
+++ b/crates/openhuman-core/src/config/migrations/normalize_default_model_tier.rs
@@ -1,77 +1,12 @@
-//! Migration 7 → 8: retire the stale OpenHuman reasoning-tier `default_model`
-//! defaults, rewriting them to the managed default model.
-//!
-//! Historically the target was the `chat-v1` tier; that slug is itself retired
-//! by migration 12 → 13, so the rewrite lands directly on
-//! [`MODEL_MANAGED_DEFAULT`] and a workspace that skips from 7 never carries
-//! a tier slug in between.
-//!
-//! `config.default_model` selects the managed-backend tier for the implicit
-//! turns that read it (triage classification,
-//! escalation base, chat-fallback). Older builds shipped a heavier default:
-//! `reasoning-v1` was the `DEFAULT_MODEL` constant for a window in 2026, and the
-//! `reasoning-quick-v1` alias (which resolves to `chat-v1`) was the default for
-//! another window. App updates never refresh a persisted `default_model`, so
-//! those workspaces still drive background turns onto the stale tier.
-//!
-//! This migration rewrites **only** those two known stale OpenHuman tier values
-//! to `chat-v1`. It deliberately leaves every other value untouched —
-//! `default_model` round-trips arbitrary strings (custom/BYOK model ids set via
-//! `config.update_model_settings` or `OPENHUMAN_MODEL`, plus the current
-//! `chat-v1` default), and clobbering those would break the config-mutation
-//! contract (see `config_*_e2e` round-trip tests). The only substantive change
-//! is `reasoning-v1` → `chat-v1`; `reasoning-quick-v1` → `chat-v1` is slug
-//! canonicalization (same upstream model).
-//!
-//! ## Behaviour
-//!
-//! - Pure in-memory mutation of `Config`. The caller (`migrations::run_pending`)
-//! persists the result via `Config::save()` and bumps `schema_version`.
-//! - Idempotent: re-running on a non-stale value is a no-op.
-//! - Touches nothing other than `default_model`, and only for the two stale tiers.
+//! Generic schema-version progression for the retired 7 → 8 provider
+//! normalization step. Provider-specific normalization is registered by the
+//! host and runs independently of schema-version gates.
-use crate::config::{Config, MODEL_MANAGED_DEFAULT};
+use crate::config::Config;
-/// Counters returned by [`run`] for diagnostics.
#[derive(Debug, Default, Clone)]
-pub struct MigrationStats {
- /// `true` when a stale reasoning-tier `default_model` was rewritten to `chat-v1`.
- pub default_model_normalized: bool,
-}
-
-/// Retire a stale reasoning-tier `default_model` to `chat-v1` in place.
-///
-/// Synchronous — pure config mutation, no I/O. Caller persists via
-/// `Config::save()` once `schema_version` is also bumped.
-pub fn run(config: &mut Config) -> anyhow::Result<MigrationStats> {
- let mut stats = MigrationStats::default();
-
- // Only the two known stale OpenHuman tiers are rewritten. Trim so a padded
- // `" reasoning-v1 "` is still caught, but never touch arbitrary/custom values.
- let is_stale_reasoning_tier = config.default_model.as_deref().is_some_and(|model| {
- let trimmed = model.trim();
- trimmed == "reasoning-v1" || trimmed == "reasoning-quick-v1"
- });
+pub struct MigrationStats;
- if is_stale_reasoning_tier {
- log::info!(
- "[migrations][normalize-default-model] stale default_model {:?} rewritten to \
- '{MODEL_MANAGED_DEFAULT}'",
- config.default_model
- );
- config.default_model = Some(MODEL_MANAGED_DEFAULT.to_string());
- stats.default_model_normalized = true;
- } else {
- log::debug!(
- "[migrations][normalize-default-model] default_model {:?} is not a stale reasoning \
- tier — leaving unchanged",
- config.default_model
- );
- }
-
- Ok(stats)
+pub fn run(_config: &mut Config) -> anyhow::Result<MigrationStats> {
+ Ok(MigrationStats)
}
-
-#[cfg(test)]
-#[path = "normalize_default_model_tier_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs b/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs
deleted file mode 100644
index a14cbe9f9c..0000000000
--- a/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs
+++ /dev/null
@@ -1,97 +0,0 @@
-//! Migration 12 → 13: retire the managed tier slugs (`chat-v1`, `agentic-v1`,
-//! `reasoning-v1`, …) in favour of concrete OpenRouter model ids.
-//!
-//! The managed backend no longer serves tier endpoints; every managed workload
-//! runs on the pinned default model or [`MODEL_MANAGED_DEFAULT`]. A persisted
-//! tier slug would reach the backend verbatim and 400, so every place a user
-//! (or an older build) could have written one is rewritten:
-//!
-//! - `default_model` — any tier slug becomes [`MODEL_MANAGED_DEFAULT`].
-//! - `orchestrator.model`, every `teams.<name>.{lead,agent}_model` and each
-//! `agents.<id>.model` delegate pin — tier slugs become the managed default
-//! too; a slug that was pinning a *role* (`reasoning-v1` on a lead)
-//! loses nothing, since on the managed backend every role now runs the same
-//! model.
-//! - `model_routes[].model` — the same rewrite; the `hint` key is untouched.
-//!
-//! Concrete ids (`openrouter/...`, BYOK model names) and `hint:*` markers are
-//! left exactly as they are: `hint:*` is still translated at dispatch, and a
-//! concrete id is the user's own choice.
-//!
-//! Pure in-memory mutation; the caller persists and bumps `schema_version`.
-//! Idempotent: a config with no tier slug is a no-op.
-
-use crate::config::{is_legacy_tier_model, Config, MODEL_MANAGED_DEFAULT};
-
-/// Counters returned by [`run`] for diagnostics.
-#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
-pub struct MigrationStats {
- /// Number of fields rewritten from a tier slug to the managed default.
- pub rewritten: usize,
-}
-
-fn rewrite(field: &str, value: &mut String, stats: &mut MigrationStats) {
- if is_legacy_tier_model(value) {
- log::info!(
- "[migrations][retire-managed-tiers] {field}: {:?} -> {MODEL_MANAGED_DEFAULT:?}",
- value
- );
- *value = MODEL_MANAGED_DEFAULT.to_string();
- stats.rewritten += 1;
- }
-}
-
-fn rewrite_opt(field: &str, value: &mut Option<String>, stats: &mut MigrationStats) {
- if let Some(inner) = value.as_mut() {
- rewrite(field, inner, stats);
- }
-}
-
-/// Rewrite every retired tier slug in `config` to the managed default model.
-pub fn run(config: &mut Config) -> anyhow::Result<MigrationStats> {
- let mut stats = MigrationStats::default();
-
- rewrite_opt("default_model", &mut config.default_model, &mut stats);
- rewrite_opt(
- "orchestrator.model",
- &mut config.orchestrator.model,
- &mut stats,
- );
- for (name, team) in config.teams.iter_mut() {
- rewrite_opt(
- &format!("teams.{name}.lead_model"),
- &mut team.lead_model,
- &mut stats,
- );
- rewrite_opt(
- &format!("teams.{name}.agent_model"),
- &mut team.agent_model,
- &mut stats,
- );
- }
- for (id, delegate) in config.agents.iter_mut() {
- rewrite(
- &format!("agents.{id}.model"),
- &mut delegate.model,
- &mut stats,
- );
- }
- for route in config.model_routes.iter_mut() {
- rewrite(
- &format!("model_routes[{}].model", route.hint),
- &mut route.model,
- &mut stats,
- );
- }
-
- log::debug!(
- "[migrations][retire-managed-tiers] rewritten={} default_model={:?}",
- stats.rewritten,
- config.default_model
- );
- Ok(stats)
-}
-
-#[cfg(test)]
-#[path = "retire_managed_tier_slugs_tests.rs"]
-mod tests;