Skip to content

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

feat(config): retire managed tier slugs and bump schema to 13

Steven Enamakelf7290d2df2e4
diff --git a/crates/openhuman-core/src/config/migrations/mod.rs b/crates/openhuman-core/src/config/migrations/mod.rs
index 86df1b4ac5..f622bb7727 100644
--- a/crates/openhuman-core/src/config/migrations/mod.rs
+++ b/crates/openhuman-core/src/config/migrations/mod.rs
@@ -32,12 +32,13 @@ mod reconcile_orphaned_providers;
mod remove_write_auto_approve;
mod repair_http_request_limits;
mod retire_chat_v1_model;
+mod retire_managed_tier_slugs;
mod retire_local_whisper_stt;
mod retire_subconscious_medulla;
mod unify_ai_provider_settings;
/// Current target schema version. Bumped alongside every new migration.
-pub const CURRENT_SCHEMA_VERSION: u32 = 12;
+pub const CURRENT_SCHEMA_VERSION: u32 = 13;
/// Give a brand-new [`Config`] the managed `openhuman` cloud-provider entry.
///
@@ -634,6 +635,41 @@ pub async fn run_pending(config: &mut Config) {
}
}
}
+
+ // 12 -> 13: retire the managed tier slugs (`chat-v1`, `agentic-v1`, …).
+ // The managed backend serves OpenRouter model ids only, so every persisted
+ // tier slug — `default_model`, orchestrator/team/delegate pins, model
+ // routes — is rewritten to the managed default model. Guard on `== 12` so
+ // an earlier failed step isn't skipped.
+ if config.schema_version == 12 {
+ let snapshot = config.clone();
+ match retire_managed_tier_slugs::run(config) {
+ Ok(stats) => {
+ let previous_version = config.schema_version;
+ config.schema_version = 13;
+ if let Err(err) = config.save().await {
+ *config = snapshot;
+ log::warn!(
+ "[migrations] retire_managed_tier_slugs ran but config.save failed: \
+ {err:#} — rolled in-memory schema_version back to {previous_version}, \
+ will retry on next launch"
+ );
+ return;
+ }
+ log::info!(
+ "[migrations] schema_version bumped to 13 (retire_managed_tier_slugs \
+ rewritten={})",
+ stats.rewritten
+ );
+ }
+ Err(err) => {
+ log::warn!(
+ "[migrations] retire_managed_tier_slugs failed: {err:#} — \
+ will retry on next launch"
+ );
+ }
+ }
+ }
}
#[cfg(test)]
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 28cfd06155..4f38caa3ab 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,5 +1,10 @@
//! Migration 7 → 8: retire the stale OpenHuman reasoning-tier `default_model`
-//! defaults, rewriting them to the canonical `chat-v1` tier.
+//! 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, the subconscious cloud tick,
@@ -25,7 +30,7 @@
//! - 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.
-use crate::config::{Config, MODEL_CHAT_V1, MODEL_REASONING_QUICK_V1, MODEL_REASONING_V1};
+use crate::config::{Config, MODEL_MANAGED_DEFAULT};
/// Counters returned by [`run`] for diagnostics.
#[derive(Debug, Default, Clone)]
@@ -45,16 +50,16 @@ pub fn run(config: &mut Config) -> anyhow::Result<MigrationStats> {
// `" 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 == MODEL_REASONING_V1 || trimmed == MODEL_REASONING_QUICK_V1
+ trimmed == "reasoning-v1" || trimmed == "reasoning-quick-v1"
});
if is_stale_reasoning_tier {
log::info!(
"[migrations][normalize-default-model] stale default_model {:?} rewritten to \
- '{MODEL_CHAT_V1}'",
+ '{MODEL_MANAGED_DEFAULT}'",
config.default_model
);
- config.default_model = Some(MODEL_CHAT_V1.to_string());
+ config.default_model = Some(MODEL_MANAGED_DEFAULT.to_string());
stats.default_model_normalized = true;
} else {
log::debug!(
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
index f984fdba08..9373ab7a2b 100644
--- a/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs
+++ b/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs
@@ -7,9 +7,9 @@
//! (or an older build) could have written one is rewritten:
//!
//! - `default_model` — any tier slug becomes [`MODEL_MANAGED_DEFAULT`].
-//! - `agent.orchestrator.model`, `agent.team_models.{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)
+//! - `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.
@@ -53,20 +53,22 @@ pub fn run(config: &mut Config) -> anyhow::Result<MigrationStats> {
rewrite_opt("default_model", &mut config.default_model, &mut stats);
rewrite_opt(
- "agent.orchestrator.model",
- &mut config.agent.orchestrator.model,
- &mut stats,
- );
- rewrite_opt(
- "agent.team_models.lead_model",
- &mut config.agent.team_models.lead_model,
- &mut stats,
- );
- rewrite_opt(
- "agent.team_models.agent_model",
- &mut config.agent.team_models.agent_model,
+ "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);
}
diff --git a/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs_tests.rs b/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs_tests.rs
index 02cd9ea5cb..230a72dc7a 100644
--- a/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs_tests.rs
+++ b/crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs_tests.rs
@@ -1,15 +1,12 @@
use super::*;
-use crate::config::schema::{DelegateAgentConfig, ModelRouteConfig};
+use crate::config::schema::{DelegateAgentConfig, ModelRouteConfig, TeamModelConfig};
fn delegate(model: &str) -> DelegateAgentConfig {
DelegateAgentConfig {
model: model.to_string(),
system_prompt: None,
temperature: None,
- max_tokens: None,
- allowed_tools: Vec::new(),
- max_iterations: None,
- timeout_secs: None,
+ max_depth: 3,
}
}
@@ -17,9 +14,14 @@ fn delegate(model: &str) -> DelegateAgentConfig {
fn rewrites_every_tier_slug_to_the_managed_default() {
let mut config = Config::default();
config.default_model = Some("chat-v1".to_string());
- config.agent.orchestrator.model = Some("reasoning-v1".to_string());
- config.agent.team_models.lead_model = Some("agentic-v1".to_string());
- config.agent.team_models.agent_model = Some("burst-v1".to_string());
+ config.orchestrator.model = Some("reasoning-v1".to_string());
+ config.teams.insert(
+ "research".to_string(),
+ TeamModelConfig {
+ lead_model: Some("agentic-v1".to_string()),
+ agent_model: Some("burst-v1".to_string()),
+ },
+ );
config
.agents
.insert("coder".to_string(), delegate("coding-v1"));
@@ -33,15 +35,15 @@ fn rewrites_every_tier_slug_to_the_managed_default() {
assert_eq!(stats.rewritten, 6);
assert_eq!(config.default_model.as_deref(), Some(MODEL_MANAGED_DEFAULT));
assert_eq!(
- config.agent.orchestrator.model.as_deref(),
+ config.orchestrator.model.as_deref(),
Some(MODEL_MANAGED_DEFAULT)
);
assert_eq!(
- config.agent.team_models.lead_model.as_deref(),
+ config.teams["research"].lead_model.as_deref(),
Some(MODEL_MANAGED_DEFAULT)
);
assert_eq!(
- config.agent.team_models.agent_model.as_deref(),
+ config.teams["research"].agent_model.as_deref(),
Some(MODEL_MANAGED_DEFAULT)
);
assert_eq!(config.agents["coder"].model, MODEL_MANAGED_DEFAULT);
@@ -54,8 +56,7 @@ fn rewrites_every_tier_slug_to_the_managed_default() {
fn leaves_concrete_ids_hints_and_empty_values_alone() {
let mut config = Config::default();
config.default_model = Some("openrouter/deepseek/deepseek-v4-pro".to_string());
- config.agent.orchestrator.model = Some("hint:reasoning".to_string());
- config.agent.team_models.lead_model = None;
+ config.orchestrator.model = Some("hint:reasoning".to_string());
config
.agents
.insert("byok".to_string(), delegate("gpt-4o"));
@@ -67,10 +68,7 @@ fn leaves_concrete_ids_hints_and_empty_values_alone() {
config.default_model.as_deref(),
Some("openrouter/deepseek/deepseek-v4-pro")
);
- assert_eq!(
- config.agent.orchestrator.model.as_deref(),
- Some("hint:reasoning")
- );
+ assert_eq!(config.orchestrator.model.as_deref(), Some("hint:reasoning"));
assert_eq!(config.agents["byok"].model, "gpt-4o");
}