Skip to content

fix(inference): map abstract tier models to provider-native defaults for custom cloud slugs#2146

Merged
senamakel merged 11 commits into
tinyhumansai:mainfrom
emixor:main
May 20, 2026
Merged

fix(inference): map abstract tier models to provider-native defaults for custom cloud slugs#2146
senamakel merged 11 commits into
tinyhumansai:mainfrom
emixor:main

Conversation

@emixor
Copy link
Copy Markdown
Contributor

@emixor emixor commented May 18, 2026

Summary

  • Fixes issue fix(providers): reasoning-v1 model name sent to DeepSeek API which rejects it (regression) #2079 where abstract OpenHuman model tiers (for example, reasoning-v1) could be forwarded directly to custom cloud providers.
  • Adds abstract-tier detection in the provider factory.
  • For non-OpenhumanJwt providers, remaps abstract tiers to cloud_providers[].default_model when available.
  • Returns an actionable configuration error when no concrete default model is configured.
  • Adds regression tests covering both successful remap and failure scenarios.

Problem

Custom providers such as DeepSeek require provider-native model IDs (for example, deepseek-v4-pro). Sending OpenHuman tier aliases upstream caused model-not-found errors.

Solution

In make_cloud_provider_by_slug, detect abstract tier names and:

  • Remap them to the provider default_model for non-OpenhumanJwt providers, or
  • Fail fast with a clear configuration error if no concrete default model is configured.

Added regression tests in factory_test.rs to lock in both behaviors.

Impact

  • Rust inference/provider selection only
  • No UI/Tauri surface changes
  • Improves compatibility and error clarity for custom cloud routing

Related

Summary by CodeRabbit

  • New Features

    • Remaps abstract-tier model identifiers to provider-specific default models for custom cloud providers when available.
  • Bug Fixes

    • Fails with a clear error if no suitable concrete default exists for an abstract-tier model, avoiding invalid provider creation.
  • Tests

    • Added tests covering abstract-tier model handling for custom providers (success and failure cases).
  • Chores

    • Updated expected vendor component SHA/submodule pointer.

Review Change Stack

@emixor emixor requested a review from a team May 18, 2026 19:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

📝 Walkthrough

Walkthrough

Detects and remaps abstract tier model identifiers (e.g., reasoning-v1) to concrete provider defaults during cloud provider construction. Adds validation that concrete defaults exist; fails with an actionable error otherwise. Includes test coverage for both success and failure paths. Updates tauri-cef submodule reference.

Changes

Abstract Tier Model Detection and Remapping

Layer / File(s) Summary
Abstract tier detection helper and model remapping logic
src/openhuman/inference/provider/factory.rs
Introduces is_abstract_tier_model() helper to classify tier-style model strings and updates make_cloud_provider_by_slug() to remap abstract tier models to the provider's concrete default_model when auth_style is not OpenhumanJwt, with failure when no concrete default exists.
Test coverage for abstract tier remapping
src/openhuman/inference/provider/factory_test.rs
Adds unit tests verifying that abstract tier inputs remap to the provider's default_model when configured, and fail with an "abstract tier" error message when default_model is None.

Vendored Submodule Update

Layer / File(s) Summary
Update tauri-cef submodule reference
.github/tauri-cef-expected-sha, app/src-tauri/vendor/tauri-cef
Advances the vendored tauri-cef submodule pointer to a new commit and updates the expected SHA file accordingly.

Sequence Diagram(s)

(No sequence diagrams generated — changes are localized to provider resolution logic and tests; the control flow is straightforward and adequately represented in the hidden flowchart.)

Possibly related PRs

  • tinyhumansai/openhuman#2080: Both PRs address OpenHuman tier/alias identifiers (e.g., reasoning-v1) by ensuring they're remapped to a provider/router default_model when there's no usable concrete mapping.

Suggested labels

bug

Suggested reviewers

  • graycyrus
  • senamakel

Poem

🐰 I sniffed an abstract tier today,
I hopped to map it out the proper way,
From reasoning-v1 it found a home,
Or raised an error if none was known,
Hooray — no more strange names away! ✨

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive The submodule update in app/src-tauri/vendor/tauri-cef appears unrelated to abstract tier model mapping and may represent a separate dependency update with unclear scope. Clarify the purpose of the tauri-cef submodule version update and confirm it is not an accidental inclusion or related to issue #2079.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main change: mapping abstract tier models to provider defaults for custom cloud slugs, which is the core fix for issue #2079.
Linked Issues check ✅ Passed The PR successfully implements all objectives from #2079: detects abstract tiers, remaps them to provider defaults for non-OpenhumanJwt providers, fails with clear errors when no default is configured, and adds regression tests.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/openhuman/inference/provider/factory.rs (1)

35-40: 💤 Low value

Consider using existing model tier constants instead of hardcoded strings.

The codebase already defines constants like MODEL_REASONING_V1, MODEL_REASONING_QUICK_V1, etc. in crate::openhuman::config (used at lines 225-228). Using those here would eliminate duplication and prevent drift if tier names change.

♻️ Suggested refactor
+use crate::openhuman::config::{
+    MODEL_REASONING_V1, MODEL_REASONING_QUICK_V1, MODEL_AGENTIC_V1, MODEL_CODING_V1,
+};
+
 fn is_abstract_tier_model(model: &str) -> bool {
-    matches!(
-        model.trim(),
-        "reasoning-v1" | "reasoning-quick-v1" | "agentic-v1" | "coding-v1" | "summarization-v1"
-    )
+    let trimmed = model.trim();
+    trimmed == MODEL_REASONING_V1
+        || trimmed == MODEL_REASONING_QUICK_V1
+        || trimmed == MODEL_AGENTIC_V1
+        || trimmed == MODEL_CODING_V1
+        || trimmed == "summarization-v1"  // Add a constant if one exists
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openhuman/inference/provider/factory.rs` around lines 35 - 40, Replace
the hardcoded model name strings in is_abstract_tier_model with the existing
constants from crate::openhuman::config (e.g., MODEL_REASONING_V1,
MODEL_REASONING_QUICK_V1, MODEL_AGENTIC_V1, MODEL_CODING_V1,
MODEL_SUMMARIZATION_V1): import or bring those constants into scope and use them
in the matches! call (keep model.trim() as before) so the function compares
against the canonical constants instead of literal strings to avoid duplication
and drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/openhuman/inference/provider/factory.rs`:
- Around line 35-40: Replace the hardcoded model name strings in
is_abstract_tier_model with the existing constants from crate::openhuman::config
(e.g., MODEL_REASONING_V1, MODEL_REASONING_QUICK_V1, MODEL_AGENTIC_V1,
MODEL_CODING_V1, MODEL_SUMMARIZATION_V1): import or bring those constants into
scope and use them in the matches! call (keep model.trim() as before) so the
function compares against the canonical constants instead of literal strings to
avoid duplication and drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a0ca2408-66d5-4142-b954-972343185886

📥 Commits

Reviewing files that changed from the base of the PR and between 0b053c5 and 6e8ea32.

📒 Files selected for processing (2)
  • src/openhuman/inference/provider/factory.rs
  • src/openhuman/inference/provider/factory_test.rs

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 18, 2026
senamakel added 2 commits May 19, 2026 19:57
Addresses @coderabbitai nitpick on factory.rs:35-40 — use
crate::openhuman::config::MODEL_* constants instead of duplicated literals
so abstract-tier detection follows tier renames automatically.

Also fixes the new failing-default test: Box<dyn Provider> doesn't
implement Debug, so `.expect_err(..)` failed to compile. Replace with an
explicit match so the test builds (was breaking the Rust Core Tests CI
job on this PR).
senamakel added 3 commits May 19, 2026 21:12
# Conflicts:
#	src/openhuman/inference/provider/factory_test.rs
Bumps vendored tauri-cef submodule from 4cabccfa8 to c90c8a330
(latest on feat/cef). Picks up:

- fix(cef): popup blank-page reload guard skip
- fix(cef): move blank reload guard onto UI thread
- AppImage fixes (glibc, NSS libs, ld-linux bundling)

cargo check passes on both core and tauri shell.
@coderabbitai coderabbitai Bot added the working A PR that is being worked on by the team. label May 20, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/src-tauri/vendor/tauri-cef`:
- Line 1: Update the expected SHA file to match the new tauri-cef submodule
commit: overwrite .github/tauri-cef-expected-sha with the current submodule SHA
c90c8a330056286e7c0d05439ae3d4527fa4fafe so the "tauri-cef Pin Guard" CI check
passes; locate the submodule change in vendor/tauri-cef and update the
single-line file .github/tauri-cef-expected-sha to contain exactly that commit
hash (or consider removing the unrelated submodule bump from this PR and create
a separate PR for the tauri-cef update if you prefer cleaner history).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1af6f149-7d1c-48da-8a71-15be2fb828af

📥 Commits

Reviewing files that changed from the base of the PR and between 6e8ea32 and 0c9afd0.

📒 Files selected for processing (1)
  • app/src-tauri/vendor/tauri-cef

Comment thread app/src-tauri/vendor/tauri-cef
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 20, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
app/src-tauri/vendor/tauri-cef (1)

1-1: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin-guard blocker: submodule SHA and expected SHA are out of sync.

Line 1 updates the vendored submodule SHA, but CI shows .github/tauri-cef-expected-sha still expects a different value. Please sync the expected SHA file to this commit (c90c8a330056286e7c0d05439ae3d4527fa4fafe) so Pin Guard passes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src-tauri/vendor/tauri-cef` at line 1, The vendored submodule SHA in
app/src-tauri/vendor/tauri-cef was updated to commit
c90c8a330056286e7c0d05439ae3d4527fa4fafe but the CI pin-guard expects the older
value; update the .github/tauri-cef-expected-sha file to contain the new commit
SHA c90c8a330056286e7c0d05439ae3d4527fa4fafe so the expected SHA matches the
actual submodule reference and Pin Guard will pass.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@app/src-tauri/vendor/tauri-cef`:
- Line 1: The vendored submodule SHA in app/src-tauri/vendor/tauri-cef was
updated to commit c90c8a330056286e7c0d05439ae3d4527fa4fafe but the CI pin-guard
expects the older value; update the .github/tauri-cef-expected-sha file to
contain the new commit SHA c90c8a330056286e7c0d05439ae3d4527fa4fafe so the
expected SHA matches the actual submodule reference and Pin Guard will pass.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab58d03c-98a9-41ee-b265-73297213b76f

📥 Commits

Reviewing files that changed from the base of the PR and between 4534ae3 and 4071771.

📒 Files selected for processing (1)
  • app/src-tauri/vendor/tauri-cef

@senamakel senamakel merged commit 6ace4ab into tinyhumansai:main May 20, 2026
28 of 32 checks passed
mtkik pushed a commit to mtkik/openhuman-meet that referenced this pull request May 21, 2026
…for custom cloud slugs (tinyhumansai#2146)

Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
CodeGhost21 pushed a commit to CodeGhost21/openhuman that referenced this pull request May 22, 2026
…for custom cloud slugs (tinyhumansai#2146)

Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
…for custom cloud slugs (tinyhumansai#2146)

Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug working A PR that is being worked on by the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(providers): reasoning-v1 model name sent to DeepSeek API which rejects it (regression)

3 participants