fix(learning): cloud fallback when local reflection gate is off (#1453)

This commit is contained in:
Steven Enamakel
2026-05-09 20:09:29 -07:00
committed by GitHub
parent c4fc70c376
commit fbed3b21f0
2 changed files with 16 additions and 6 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ version = 4
[[package]]
name = "OpenHuman"
version = "0.53.22"
version = "0.53.23"
dependencies = [
"anyhow",
"async-trait",
@@ -4551,7 +4551,7 @@ dependencies = [
[[package]]
name = "openhuman"
version = "0.53.22"
version = "0.53.23"
dependencies = [
"aes-gcm",
"anyhow",
+14 -4
View File
@@ -156,12 +156,22 @@ impl ReflectionHook {
match self.config.reflection_source {
ReflectionSource::Local => {
// Gate: local reflection requires the per-feature flag.
// When off, no-op silently rather than erroring the turn.
// TODO: wire a cloud fallback here when use_local_for_learning is false.
// When off, fall back to a cloud provider if one is configured;
// otherwise no-op silently rather than erroring the turn.
if !self.full_config.local_ai.use_local_for_learning() {
if let Some(provider) = self.provider.as_ref() {
tracing::info!(
"[learning::reflection] local_ai.usage.learning_reflection not enabled — \
falling back to cloud provider"
);
return provider
.simple_chat(prompt, "hint:reasoning", 0.3)
.await
.map_err(|e| anyhow::anyhow!("cloud reflection fallback failed: {e}"));
}
tracing::info!(
"[learning::reflection] local_ai.usage.learning_reflection not enabled \
skipping local reflection (no cloud fallback configured for this subsystem)"
"[learning::reflection] local_ai.usage.learning_reflection not enabled \
and no cloud provider configured — skipping reflection"
);
return Ok(String::new());
}