Skip to content

refactor(routing): rename hint:reasoning-quick → hint:chat#1801

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:fix/hint-chat-translate-to-reasoning-quick-v1
May 15, 2026
Merged

refactor(routing): rename hint:reasoning-quick → hint:chat#1801
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:fix/hint-chat-translate-to-reasoning-quick-v1

Conversation

@senamakel
Copy link
Copy Markdown
Member

@senamakel senamakel commented May 15, 2026

Summary

Follow-up to #1761 — renames the orchestrator's hint slot from reasoning-quick to chat. Same end-to-end behavior; same backend model (reasoning-quick-v1 / Kimi K2.6 Turbo via backend#760).

  • agent/agents/orchestrator/agent.toml: hint = "chat".
  • agent/agents/loader.rs: loader test asserts h == "chat".
  • providers/router.rs: openhuman_tier_to_hint("reasoning-quick-v1") = Some("chat") for custom model_routes round-trip.
  • routing/provider.rs:resolve_remote_model: Some("chat") => MODEL_REASONING_QUICK_V1.
  • routing/policy.rs: rustdoc documents hint:chat as Heavy (always remote).
  • routing/provider_tests.rs: new regression regression_chat_hint_routes_remote_as_reasoning_quick_v1.
  • config/schema/types.rs: docstring on MODEL_REASONING_QUICK_V1 references hint:chat.

Problem

hint:reasoning-quick (introduced in #1761) lets the backend model id leak into the hint namespace. The orchestrator's actual job is front-line conversational TTFT, which is named better by chat. Hints should describe the workload, not the backend tier — the same way hint:reasoning doesn't say hint:deepseek-v4-pro.

Solution

Rename the single hint slot. Backend mapping (hint:chatreasoning-quick-v1) lives entirely client-side in routing::provider::resolve_remote_model, exactly where the other hint-to-model translations live. No backend changes needed — the constant MODEL_REASONING_QUICK_V1 and the backend model id are unchanged.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • N/A: pure rename — diff is narrow and the new regression test exercises every changed line. Diff coverage ≥ 80% — changed lines (Vitest + cargo-llvm-cov merged via diff-cover) meet the gate enforced by .github/workflows/coverage.yml.
  • N/A: no user-visible feature added/removed/renamed — internal hint slot. Coverage matrix updated — added/removed/renamed feature rows in docs/TEST-COVERAGE-MATRIX.md reflect this change
  • N/A: no matrix feature IDs touched. All affected feature IDs from the matrix are listed in the PR description under ## Related
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • N/A: internal hint rename — not a release-cut smoke surface. Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md)
  • N/A: no linked issue. Linked issue closed via Closes #NNN in the ## Related section

Impact

  • Runtime: desktop only. Behavior identical to feat(orchestrator): use reasoning-quick-v1 for low-latency chat #1761 — orchestrator turns still resolve to reasoning-quick-v1 on the backend. Only the hint string in agent.toml and the route-table key change.
  • Custom providers: users with model_routes need a chat entry instead of reasoning-quick. Without one, the request falls through to the default provider model (same fallback as any other unmapped hint).

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/hint-chat-translate-to-reasoning-quick-v1
  • Commit SHA: b54ee2b

Validation Run

  • N/A: no `app/` changes. `pnpm --filter openhuman-app format:check`
  • N/A: no `app/` changes. `pnpm typecheck`
  • Focused tests: `cargo test --lib regression_chat_hint_routes_remote_as_reasoning_quick_v1` and `cargo test --lib orchestrator_has_chat_hint_and_named_tools` both pass.
  • Rust fmt/check (if changed): `cargo check --manifest-path Cargo.toml` clean.
  • N/A: no `app/src-tauri` changes. Tauri fmt/check (if changed):

Validation Blocked

  • `command:` N/A
  • `error:` N/A
  • `impact:` N/A

Behavior Changes

Parity Contract

Duplicate / Superseded PR Handling

@senamakel senamakel requested a review from a team May 15, 2026 09:18
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new MODEL_REASONING_QUICK_V1 constant and wires it through the routing system, maps the chat hint to this backend tier, configures the orchestrator to use chat hint by default, and adds regression test coverage to validate the routing behavior.

Changes

Reasoning-quick model tier integration

Layer / File(s) Summary
Model tier constant and documentation
src/openhuman/config/schema/types.rs
Defines MODEL_REASONING_QUICK_V1 constant with value "reasoning-quick-v1" and expands documentation to clarify the low-latency tier's backend mapping (supportsThinking: false) and when the orchestrator defers to slower reasoning-v1 for deeper reasoning needs.
Tier-to-hint and remote model resolution
src/openhuman/providers/router.rs, src/openhuman/routing/provider.rs
openhuman_tier_to_hint maps reasoning-quick-v1 tier to chat hint; resolve_remote_model adds a hint:chat match arm that normalizes to backend MODEL_REASONING_QUICK_V1.
Orchestrator agent hint configuration
src/openhuman/agent/agents/orchestrator/agent.toml
Updates orchestrator [model] section to set hint = "chat" (from "reasoning-quick"), with documentation explaining that this routes to the fast chat tier while allowing subagents to opt into heavier reasoning-v1 behavior.
Test and policy documentation updates
src/openhuman/agent/agents/loader.rs, src/openhuman/routing/policy.rs, src/openhuman/routing/provider_tests.rs
Adds regression test regression_chat_hint_routes_remote_as_reasoning_quick_v1 to verify hint:chat routes remote with reasoning-quick-v1 backend; updates loader test expectation to ModelSpec::Hint("chat"); clarifies policy docs that hint:chat and hint:reasoning classify as TaskCategory::Heavy with explicit remote-routing requirement for hint:chat due to local TTFT constraints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • tinyhumansai/openhuman#1761: Extends the reasoning-quick-v1 hint/tier wiring by updating the orchestrator to use hint: chat and updating router/provider normalization to route it to MODEL_REASONING_QUICK_V1.

Poem

A new tier hops in, chat as its name,
No deep thinking here—just speed and flame,
Through hints and routers it finds its way,
To reason quick by the light of day. 🐰⚡

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'refactor(routing): rename hint:reasoning-quick → hint:chat' describes a rename operation, but the PR objectives reveal the actual purpose is to translate hint:chat to the backend model id reasoning-quick-v1 client-side—the opposite direction of what the title suggests. The title is misleading. Revise the title to accurately reflect the core change: 'fix(routing): translate hint:chat to reasoning-quick-v1 client-side' or similar, clarifying that hint:chat is mapped to the backend model id reasoning-quick-v1.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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


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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/openhuman/routing/provider.rs (1)

90-105: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add explicit trace/debug log for remote model normalization.

Line 90-105 adds new hint:chat normalization but does not emit a direct normalization log. Add one debug/trace event with requested hint/category/resolved model to make routing regressions grepable.

🧭 Suggested patch
     fn resolve_remote_model(&self, requested_model: &str, category: TaskCategory) -> String {
         if category != TaskCategory::Heavy {
             return self.remote_fallback_model.clone();
         }

-        // Keep remote model naming aligned with backend modelRegistry.
-        match requested_model.strip_prefix("hint:") {
+        // Keep remote model naming aligned with backend modelRegistry.
+        let resolved = match requested_model.strip_prefix("hint:") {
             Some("reasoning") => MODEL_REASONING_V1.to_string(),
             // Orchestrator's low-TTFT chat tier — Kimi K2.6 Turbo on the
             // backend's `reasoning-quick-v1`. Backend support added in
             // tinyhumansai/backend#760.
             Some("chat") => MODEL_REASONING_QUICK_V1.to_string(),
             Some("agentic") => MODEL_AGENTIC_V1.to_string(),
             Some("coding") => MODEL_CODING_V1.to_string(),
             _ => requested_model.to_string(),
-        }
+        };
+        tracing::debug!(
+            requested_model,
+            category = category.as_str(),
+            resolved_model = resolved.as_str(),
+            "[routing] normalized remote model"
+        );
+        resolved
     }

As per coding guidelines, “In Rust, use log / tracing at debug or trace level for development-oriented diagnostics on new/changed flows, including logs at … branch decisions …”.

🤖 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/routing/provider.rs` around lines 90 - 105, The
resolve_remote_model function currently normalizes hint-prefixed models but
lacks an observable log; add a tracing debug/trace call inside
resolve_remote_model that logs the input requested_model, the TaskCategory
(category), and the final resolved model string (the value returned or
remote_fallback_model) so routing changes are grepable — place the log right
before each return (or once before the final return) and use the existing
tracing/log crate at debug/trace level; reference resolve_remote_model,
requested_model, category, remote_fallback_model, and the constants like
MODEL_REASONING_QUICK_V1 in the log message.
🧹 Nitpick comments (1)
src/openhuman/providers/router.rs (1)

9-13: ⚡ Quick win

Use the canonical model constant in tier mapping.

Line 12 hardcodes "reasoning-quick-v1"; prefer MODEL_REASONING_QUICK_V1 to prevent drift between routing layers.

♻️ Suggested patch
+use crate::openhuman::config::MODEL_REASONING_QUICK_V1;
+
 fn openhuman_tier_to_hint(model: &str) -> Option<&'static str> {
     match model {
         "reasoning-v1" => Some("reasoning"),
-        "reasoning-quick-v1" => Some("chat"),
+        MODEL_REASONING_QUICK_V1 => Some("chat"),
         "agentic-v1" => Some("agentic"),
         "coding-v1" => Some("coding"),
         "summarization-v1" => Some("summarization"),
🤖 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/providers/router.rs` around lines 9 - 13, The match in
openhuman_tier_to_hint uses a hardcoded "reasoning-quick-v1"; replace that
literal with the canonical constant MODEL_REASONING_QUICK_V1 in the match arm
inside the openhuman_tier_to_hint function, and ensure the constant is in scope
(import or fully qualify it) so the mapping uses the single source-of-truth
symbol instead of a string literal.
🤖 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.

Outside diff comments:
In `@src/openhuman/routing/provider.rs`:
- Around line 90-105: The resolve_remote_model function currently normalizes
hint-prefixed models but lacks an observable log; add a tracing debug/trace call
inside resolve_remote_model that logs the input requested_model, the
TaskCategory (category), and the final resolved model string (the value returned
or remote_fallback_model) so routing changes are grepable — place the log right
before each return (or once before the final return) and use the existing
tracing/log crate at debug/trace level; reference resolve_remote_model,
requested_model, category, remote_fallback_model, and the constants like
MODEL_REASONING_QUICK_V1 in the log message.

---

Nitpick comments:
In `@src/openhuman/providers/router.rs`:
- Around line 9-13: The match in openhuman_tier_to_hint uses a hardcoded
"reasoning-quick-v1"; replace that literal with the canonical constant
MODEL_REASONING_QUICK_V1 in the match arm inside the openhuman_tier_to_hint
function, and ensure the constant is in scope (import or fully qualify it) so
the mapping uses the single source-of-truth symbol instead of a string literal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4c6b6a54-f946-4e78-94d5-f52e1a657d93

📥 Commits

Reviewing files that changed from the base of the PR and between 04a548f and 2be851c.

📒 Files selected for processing (8)
  • src/openhuman/agent/agents/loader.rs
  • src/openhuman/agent/agents/orchestrator/agent.toml
  • src/openhuman/config/mod.rs
  • src/openhuman/config/schema/types.rs
  • src/openhuman/providers/router.rs
  • src/openhuman/routing/policy.rs
  • src/openhuman/routing/provider.rs
  • src/openhuman/routing/provider_tests.rs

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 15, 2026
…trator

Builds on tinyhumansai#1761 (which introduced the `reasoning-quick-v1` tier and
wired it up as `hint:reasoning-quick`). Renames the hint slot to
`hint:chat` because the orchestrator's actual job — front-line
conversational TTFT — is described better by "chat" than by the
backend model id leaking into the hint namespace.

Same end-to-end behavior as tinyhumansai#1761:
  hint:chat ↔ reasoning-quick-v1 (Kimi K2.6 Turbo on Fireworks).

- `agent/agents/orchestrator/agent.toml`: `hint = "chat"`.
- `agent/agents/loader.rs`: test asserts `h == "chat"`.
- `providers/router.rs`: `openhuman_tier_to_hint("reasoning-quick-v1")`
  now returns `Some("chat")` so custom `model_routes` round-trip.
- `routing/provider.rs:resolve_remote_model`: `Some("chat") =>
  MODEL_REASONING_QUICK_V1` instead of `Some("reasoning-quick")`.
- `routing/policy.rs`: rustdoc documents `hint:chat` as Heavy
  (always remote — local model can't meet the TTFT budget).
- `routing/provider_tests.rs`: new regression
  `regression_chat_hint_routes_remote_as_reasoning_quick_v1`.
- `config/schema/types.rs`: docstring on `MODEL_REASONING_QUICK_V1`
  references `hint:chat`.

Tests: `regression_chat_hint_routes_remote_as_reasoning_quick_v1`,
`orchestrator_has_chat_hint_and_named_tools` — both pass.
@senamakel senamakel force-pushed the fix/hint-chat-translate-to-reasoning-quick-v1 branch from 2be851c to b54ee2b Compare May 15, 2026 09:43
@senamakel senamakel changed the title fix(routing): translate hint:chat → reasoning-quick-v1 client-side refactor(routing): rename hint:reasoning-quick → hint:chat May 15, 2026
@senamakel
Copy link
Copy Markdown
Member Author

Note on red CI checks:

  • Rust Core Tests + Quality and Rust Core Coverage are both failing on openhuman::composio::auth_retry::tests::retries_once_only_even_when_second_call_still_errors (asserts retry count == 2, actual == 4). I reproduced the failure locally with this PR's composio source replaced by upstream main's — i.e. it's a pre-existing breakage on main unrelated to the routing/hint rename in this PR. The Test workflow has also been failing on the last several main commits (e.g. Update README.md #1792, feat(tools): integrate Seltz as a direct-API search tool #1717).
  • E2E (Windows / Appium Chromium) looks like the usual Windows E2E flake — not touched by this diff (no app/ or src-tauri/ changes).

This PR only touches src/openhuman/{agent/agents/{loader.rs,orchestrator/agent.toml},config/schema/types.rs,providers/router.rs,routing/{policy.rs,provider.rs,provider_tests.rs}} — a hint-string rename plus a new regression test. pnpm test:rust --test routing is green locally.

@senamakel senamakel merged commit 8dda038 into tinyhumansai:main May 15, 2026
23 of 30 checks passed
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