Skip to content

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

refactor(inference): update context window resolution logic

Steven Enamakel583f0f65e701
diff --git a/crates/openhuman-core/src/inference/context_window_tests.rs b/crates/openhuman-core/src/inference/context_window_tests.rs
index a4acd53859..09c0403727 100644
--- a/crates/openhuman-core/src/inference/context_window_tests.rs
+++ b/crates/openhuman-core/src/inference/context_window_tests.rs
@@ -130,7 +130,7 @@ async fn deepseek_v41_flash_uses_provider_window_not_static_128k() {
// The static tables guess 128k for any `deepseek` id ...
assert_eq!(
- crate::inference::model_context::static_context_window_for_model(V41_FLASH),
+ crate::inference::context_window::project_context_window_for_model(V41_FLASH, None).window,
Some(128_000)
);
// ... but the provider says ~1M, and the provider wins.
@@ -181,7 +181,7 @@ async fn config_override_wins_over_provider() {
assert_eq!(resolved.window, Some(64_000));
assert_eq!(resolved.source, WindowSource::ConfigOverride);
assert_eq!(fetcher.call_count(), 0, "an override skips discovery");
- assert_eq!(remembered_window("openrouter", model), None);
+ assert_eq!(resolver().remembered_window("openrouter", model), None);
assert_eq!(
crate::inference::model_context::context_window_for_route(
&format!("openrouter:{model}"),
diff --git a/crates/openhuman-core/src/inference/model_context.rs b/crates/openhuman-core/src/inference/model_context.rs
index ad6b5c9358..b3b05497db 100644
--- a/crates/openhuman-core/src/inference/model_context.rs
+++ b/crates/openhuman-core/src/inference/model_context.rs
@@ -18,20 +18,6 @@ pub(crate) fn context_window_for_route(
crate::inference::context_window::project_context_window("chat", provider, model, config).window
}
-/// Projects static owner hints for a model without a provider route.
-pub(crate) fn static_context_window_for_model(model: &str) -> Option<u64> {
- crate::inference::context_window::project_context_window_for_model(model, None).window
-}
-
-/// Context-aware counterpart for a dispatch with its own provider registry.
-pub(crate) fn static_context_window_for_model_in(
- extensions: Option<&crate::core::slots::Extensions>,
- model: &str,
-) -> Option<u64> {
- crate::inference::context_window::project_context_window_for_model(model, Some(extensions))
- .window
-}
-
/// Whether the model resolved for a chat hint/agent/profile accepts image input
/// according to the **user-configured** vision flag in `config.model_registry`.
///