Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

report Prime Inference model specification gaps

Sebastian Müller2b2a6b618445
diff --git a/.changes/prime-inference-null-specs-warning.md b/.changes/prime-inference-null-specs-warning.md
new file mode 100644
index 0000000000..354659532b
--- /dev/null
+++ b/.changes/prime-inference-null-specs-warning.md
@@ -0,0 +1 @@
+- Prime Inference models dropped from the model catalog because the server sent no specs for them are now named in a log warning.
diff --git a/.github/workflows/prime-inference-specs.yml b/.github/workflows/prime-inference-specs.yml
new file mode 100644
index 0000000000..e3a609b6ad
--- /dev/null
+++ b/.github/workflows/prime-inference-specs.yml
@@ -0,0 +1,24 @@
+# Daily report of Prime Inference models whose /models entry lacks specs
+# (prime-agent drops them from its catalog). A separate workflow that no
+# branch protection requires: it fails red on upstream data, which must not
+# block continuous, nightly, or release runs.
+name: Prime Inference specs
+
+on:
+ schedule:
+ - cron: '0 9 * * *'
+ timezone: America/Los_Angeles
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+jobs:
+ check:
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ persist-credentials: false
+ - run: python3 scripts/prime_inference_specs.py
diff --git a/crates/pa-models/src/prime_inference.rs b/crates/pa-models/src/prime_inference.rs
index 88746cf8a6..87084a3fda 100644
--- a/crates/pa-models/src/prime_inference.rs
+++ b/crates/pa-models/src/prime_inference.rs
@@ -265,10 +265,16 @@ pub fn parse_prime_inference_model_catalog(
};
let mut entries = Vec::with_capacity(items.len());
let mut seen: std::collections::BTreeSet<String> = std::collections::BTreeSet::new();
+ let mut null_specs: Vec<&str> = Vec::new();
for item in items {
- let wire: WireItem = match serde_json::from_value(item.clone()) {
- Ok(wire) => wire,
- Err(_) => continue,
+ let Ok(wire) = serde_json::from_value::<WireItem>(item.clone()) else {
+ if let (Some(serde_json::Value::Null), Some(id)) = (
+ item.get("specs"),
+ item.get("id").and_then(serde_json::Value::as_str),
+ ) {
+ null_specs.push(id);
+ }
+ continue;
};
if wire.id.is_empty() || wire.id.chars().count() > 1_024 {
continue;
@@ -363,6 +369,12 @@ pub fn parse_prime_inference_model_catalog(
}
entries.push(entry);
}
+ if !null_specs.is_empty() {
+ tracing::warn!(
+ models = ?null_specs,
+ "dropped Prime Inference models whose /models entry has null specs"
+ );
+ }
if entries.is_empty() && !allow_empty {
return Err("Prime Inference model catalog is empty".into());
}
@@ -742,6 +754,16 @@ mod tests {
assert!(parse_prime_inference_model_catalog(&json!({}), false).is_err());
}
+ #[test]
+ fn parse_drops_entries_with_null_specs() {
+ let mut null_specs = wire_entry("openai/gpt-5.6", 1.0, 2.0);
+ null_specs["specs"] = Value::Null;
+ let value = json!({"data": [wire_entry("z-ai/glm-5.3", 1.0, 2.0), null_specs]});
+ let entries = parse_prime_inference_model_catalog(&value, false).expect("entries");
+ let ids: Vec<&str> = entries.iter().map(|entry| entry.id.as_str()).collect();
+ assert_eq!(ids, vec!["z-ai/glm-5.3"]);
+ }
+
#[test]
fn build_gates_on_coverage() {
let compiled = transports::prime_inference_offline_entries();
diff --git a/scripts/prime_inference_specs.py b/scripts/prime_inference_specs.py
new file mode 100644
index 0000000000..d05956c0ad
--- /dev/null
+++ b/scripts/prime_inference_specs.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+"""Report Prime Inference models whose public /models entry lacks specs.
+
+prime-agent drops every Prime Inference model whose `specs` object is null
+(crates/pa-models/src/prime_inference.rs), so such a model never appears in
+the model selector. This check lists those models, and models whose specs
+miss or null a field the client reads, so the list can go to the inference team.
+
+Prints a markdown table (also appended to $GITHUB_STEP_SUMMARY when set) and
+one `::error::` annotation per flagged model, and exits 1 if any model is
+flagged. Run by .github/workflows/prime-inference-specs.yml; the name avoids
+the check_*.py prefix, which ci.yml runs as lifecycle checks on every PR.
+
+Usage:
+ python3 scripts/prime_inference_specs.py
+"""
+
+import json
+import os
+import sys
+import urllib.request
+
+MODELS_URL = "https://api.pinference.ai/api/v1/models"
+SPEC_FIELDS = ("context_window", "max_output_tokens", "supports_reasoning", "modalities")
+
+
+def main() -> int:
+ # The endpoint's edge rejects urllib's default User-Agent with 403.
+ request = urllib.request.Request(MODELS_URL, headers={"User-Agent": "prime-agent-ci"})
+ with urllib.request.urlopen(request) as response:
+ models = json.load(response)["data"]
+ flagged = {}
+ for model in models:
+ specs = model.get("specs")
+ spec_nulls = [] if specs is None else [f"specs.{field}" for field in SPEC_FIELDS if specs.get(field) is None]
+ if specs is None or spec_nulls:
+ flagged[model["id"]] = [key for key, value in model.items() if value is None] + spec_nulls
+ if flagged:
+ rows = [f"| `{model_id}` | {', '.join(fields)} |" for model_id, fields in flagged.items()]
+ report = "\n".join([
+ f"{len(flagged)} of {len(models)} Prime Inference models lack specs:",
+ "",
+ "| model id | null fields |",
+ "| --- | --- |",
+ *rows,
+ ])
+ else:
+ report = f"all {len(models)} Prime Inference models have specs"
+ print(report)
+ step_summary = os.environ.get("GITHUB_STEP_SUMMARY")
+ if step_summary:
+ with open(step_summary, "a", encoding="utf-8") as f:
+ f.write(report + "\n")
+ for model_id in flagged:
+ print(f"::error::Prime Inference model {model_id} lacks specs in {MODELS_URL}")
+ return 1 if flagged else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())