You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/10/22 17:57:15 UTC
(maka) branch rust-preview updated: fix(agent): share public model descriptions across connections
This is an automated email from the ASF dual-hosted git repository.
M4n5ter pushed a commit to branch rust-preview
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/rust-preview by this push:
new d1fffd04e4 fix(agent): share public model descriptions across connections
new 128030ce26 Merge remote-tracking branch 'origin/rust-preview' into fix/catalog-shared-exact-model-ids-20261023
d1fffd04e4 is described below
commit d1fffd04e404bf2415645dbcc459d42d79c88a4f
Author: M4n5ter <m4...@gmail.com>
AuthorDate: Fri Oct 23 01:54:10 2026 +0800
fix(agent): share public model descriptions across connections
---
plugins/agent/providers/src/catalog.rs | 38 +++++++++++++++---
plugins/agent/providers/src/catalog/tests.rs | 58 +++++++++++++++++++++++++++-
2 files changed, 90 insertions(+), 6 deletions(-)
diff --git a/plugins/agent/providers/src/catalog.rs b/plugins/agent/providers/src/catalog.rs
index cd7459f9ef..2ec6ae529a 100644
--- a/plugins/agent/providers/src/catalog.rs
+++ b/plugins/agent/providers/src/catalog.rs
@@ -17,8 +17,9 @@
* under the License.
*/
-//! Immutable, route-specific public model facts. Network and publication belong
-//! to the product owner; account observations and user policy remain separate.
+//! Immutable public model facts with route-specific execution controls. Network
+//! and publication belong to the product owner; account observations and user
+//! policy remain separate.
use maka_agent_facts::configuration::{ModelInfo, validation};
use serde_json::Value;
@@ -86,6 +87,7 @@ impl Catalog {
#[derive(Debug)]
pub struct Snapshot {
models: Models,
+ descriptions: BTreeMap<String, ModelInfo>,
}
impl Snapshot {
@@ -122,7 +124,10 @@ impl Snapshot {
);
}
}
- Ok(Self { models })
+ Ok(Self {
+ models,
+ descriptions: BTreeMap::new(),
+ })
}
/// Each present source must be a complete valid JSON payload. Cache/fallback
@@ -140,6 +145,21 @@ impl Snapshot {
.map(openrouter::parse)
.transpose()?
.unwrap_or_default();
+ snapshot.descriptions = router
+ .iter()
+ .map(|model| {
+ (
+ model.id.clone(),
+ ModelInfo {
+ id: model.id.clone(),
+ display_name: model.display_name.clone(),
+ description: model.description.clone(),
+ knowledge_cutoff: model.knowledge_cutoff.clone(),
+ ..Default::default()
+ },
+ )
+ })
+ .collect();
let descriptions = merge::shared_descriptions(&entries, &router);
for mut entry in entries {
if entry.provider != "openrouter"
@@ -163,8 +183,13 @@ impl Snapshot {
Ok(snapshot)
}
+ /// An unknown route may borrow prose through an exact public ID. Its
+ /// execution controls, limits and availability remain unknown.
pub fn get(&self, provider: &str, exact_model_id: &str) -> Option<&ModelInfo> {
- self.models.get(provider)?.get(exact_model_id)
+ self.models
+ .get(provider)
+ .and_then(|models| models.get(exact_model_id))
+ .or_else(|| self.descriptions.get(exact_model_id))
}
/// Restore the one public observation captured at admission. A captured
@@ -185,7 +210,10 @@ impl Snapshot {
.or_default()
.insert(record.id.clone(), record);
}
- Ok(Self { models })
+ Ok(Self {
+ models,
+ descriptions: BTreeMap::new(),
+ })
}
/// Only missing account facts are filled. An account's own effort list also
diff --git a/plugins/agent/providers/src/catalog/tests.rs b/plugins/agent/providers/src/catalog/tests.rs
index 44e81002e2..4f04c6c046 100644
--- a/plugins/agent/providers/src/catalog/tests.rs
+++ b/plugins/agent/providers/src/catalog/tests.rs
@@ -105,7 +105,63 @@ fn new_public_model_keeps_each_routes_own_controls_and_limits() {
assert_eq!(gateway.capabilities.unwrap().function_calling, Some(true));
assert_eq!(gateway.structured_output, Some(true));
assert_eq!(snapshot.get("openrouter", "brand-new-native"), None);
- assert_eq!(snapshot.get("deepseek", "vendor/new-model:free"), None);
+ assert_eq!(
+ snapshot.get("deepseek", "vendor/new-model:free"),
+ Some(&ModelInfo {
+ id: "vendor/new-model:free".into(),
+ display_name: Some("Gateway name".into()),
+ description: Some("Shared model description".into()),
+ knowledge_cutoff: Some("2026-01".into()),
+ ..Default::default()
+ })
+ );
+}
+
+#[test]
+fn compatible_connections_share_exact_public_ids_without_borrowing_route_controls() {
+ let router = json!({"data":[{
+ "id":"vendor/new-model","name":"Public name","description":"Public description",
+ "knowledge_cutoff":"2026-01","canonical_slug":"some-other-id",
+ "context_length":131072,"supported_parameters":["tools","reasoning"],
+ "reasoning":{"mandatory":true,"supported_efforts":["high"],"default_effort":"high"}
+ }]});
+ let snapshot = Snapshot::from_sources(None, Some(&router)).unwrap();
+ let public = ModelInfo {
+ id: "vendor/new-model".into(),
+ display_name: Some("Public name".into()),
+ description: Some("Public description".into()),
+ knowledge_cutoff: Some("2026-01".into()),
+ ..Default::default()
+ };
+ assert_eq!(
+ snapshot.get("openai-compatible", "vendor/new-model"),
+ Some(&public)
+ );
+ assert_eq!(snapshot.get("openai-compatible", "new-model"), None);
+ assert_eq!(snapshot.get("openai-compatible", "some-other-id"), None);
+ let reported = ModelInfo {
+ display_name: Some("Account name".into()),
+ context_window: Some(8192),
+ thinking_levels: Some(vec![]),
+ capabilities: Some(ModelCapabilities {
+ reasoning: Some(false),
+ function_calling: Some(false),
+ ..Default::default()
+ }),
+ ..ModelInfo::new("vendor/new-model")
+ };
+ let expected = ModelInfo {
+ description: Some("Public description".into()),
+ knowledge_cutoff: Some("2026-01".into()),
+ ..reported.clone()
+ };
+ assert_eq!(
+ snapshot.resolve("openai-compatible", reported.clone()),
+ expected
+ );
+ let captured =
+ Snapshot::for_model("openai-compatible", "vendor/new-model", Some(public)).unwrap();
+ assert_eq!(captured.resolve("openai-compatible", reported), expected);
}
#[test]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org