Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

feat(remote): expose bounded numerical process diagnostics (#561)

Krisztian Gajdar9f966be23a56
diff --git a/packages/sie_gateway/docs/architecture-guide.md b/packages/sie_gateway/docs/architecture-guide.md
index 4b820cfc0..ce9e761f3 100644
--- a/packages/sie_gateway/docs/architecture-guide.md
+++ b/packages/sie_gateway/docs/architecture-guide.md
@@ -928,3 +928,23 @@ A pool spec may also carry `pinned_models` (a per-pool set of always-loaded mode
Creating a usable custom pool has two supported shapes. For a dynamic logical pool over base capacity, call `POST /v1/pools` with the logical name and GPU requirements and omit `queue_pool`; it defaults to `default`, so no additional Helm worker group is required. Pool `name` is user/dynamic. Non-default `queue_pool` is infra/admin: it must name a Helm-rendered `queuePool`/`SIE_POOL` backing lane declared under `queueRouting.staticQueuePools`. For a dedicated physical queue, first add that worker group to Helm values and declare the same name under `queueRouting.staticQueuePools`, then create logical pools with `queue_pool` set to that queue. Lease-owned dynamic pools expire after their TTL unless renewed with `POST /v1/pools/{name}/renew`. The gateway bounds API-created pools independently of auth: a `minimum_worker_count` whose total across the pool's machine profiles, or `gpus` requirements whose sum, exceeds `SIE_GATEWAY_POOL_MAX_MINIMUM_WORKER_COUNT` (default 4) and `ttl_seconds` above `SIE_GATEWAY_POOL_MAX_TTL_S` (default 3600) are rejected with `400 INVALID_REQUEST`, and a create beyond `SIE_GATEWAY_MAX_POOLS` live API-created pools (default 64) is rejected with `403 POOL_OPERATION_FORBIDDEN`. Pools restored from Kubernetes or applied from another replica are held to the same TTL and warm-floor caps when their lease expiry and KEDA warm floor are computed. An API-created pool's active lease keeps at most its `gpus` requirement per machine profile warm, and at most `SIE_GATEWAY_POOL_MAX_MINIMUM_WORKER_COUNT` in total, however many workers it is assigned; a stored pool's per-lane warm floor is capped so its total fits the same budget. The live-pool cap is checked by the replica serving the create against every pool it knows, so concurrent creates on different replicas can briefly exceed it. `POST /v1/pools` refuses the name `default` with `403 POOL_OPERATION_FORBIDDEN`. The `default` pool and static Helm queue pools are operator-owned and exempt. Clients target either shape with an explicit `X-SIE-POOL` header, for example `X-SIE-POOL: customer-acme`, or SDK `gpu="customer-acme/l4"`. The `default` pool is protected and cannot be deleted. Missing named pools intentionally fail closed so capped/dynamic pool isolation is not weakened by a silent fallback.
Model configs registered via the control plane (`sie-config`) may carry a top-level `pool` field. That field is model routing/config assignment: omitted or empty means `default`, and a request that omits `X-SIE-POOL` defaults to the model's assigned pool. It does not create workers, KEDA ScaledObjects, or runtime pool leases. Worker counts, machine profiles, bundles, and autoscaling lanes are still Helm-driven physical capacity; `/v1/pools` and `queueRouting.staticQueuePools` only create or renew runtime admission/capacity state, optionally backed by existing `default` capacity through `PoolSpec.queue_pool`. In the Kubernetes/Helm composition, workers filter materialized model configs by their physical `SIE_POOL`, so a model config for a dedicated queue normally uses the physical queue-pool name; gateway requests may still target a logical pool whose `queue_pool` resolves to that physical name. A default-backed logical pool should not use a non-default model-config `pool` unless a matching dedicated worker queue exists. The managed Modal composition has one governed exception: a deployment-owned diagnostic admission queue may reuse the complete `default` catalog in a separate worker app. Dispatch stays on that physical queue, but bundle-hash and immutable-revision evidence are atomically scoped to the requested model's declared catalog pool. A known catalog model with a missing scoped hash fails closed rather than enabling the empty-hash wildcard; unknown sealed compatibility remains separately bounded.
+
+### Numerical process diagnostics
+
+NATS worker heartbeats may carry `numerical_process_inventory`: an observation
+time in Unix milliseconds and a complete list of adapter children. The gateway
+validates the optional metadata separately from worker health and exposes it in
+cluster status, including workers excluded from direct dispatch by saturation.
+Missing, malformed or oversized metadata clears the previous inventory without
+discarding the heartbeat. The wire budget is 64 KiB and 256 children; unknown
+fields and duplicate positive process IDs are rejected.
+
+Sidecars probe on dedicated IPC connections independently of readiness pings
+and health publication, with a
+five-second timeout and a ten-second observation lifetime. Shutdown tombstones
+omit diagnostics. A snapshot describes the process and model configuration at
+its observation time; it is not an atomic fleet proof and does not grant routing
+or execution authority. Numerical fallback requires operator-owned numerical
+evidence as a separate prerequisite. Consumers must also verify freshness,
+membership, local identity, request contract and evidence at execution before
+enabling numerical fallback.
diff --git a/packages/sie_gateway/openapi.json b/packages/sie_gateway/openapi.json
index 25a8a3ea4..590a03f76 100644
--- a/packages/sie_gateway/openapi.json
+++ b/packages/sie_gateway/openapi.json
@@ -2587,6 +2587,112 @@
],
"type": "object"
},
+ "NumericalProcessInventory": {
+ "additionalProperties": false,
+ "properties": {
+ "children": {
+ "items": {
+ "$ref": "#/components/schemas/NumericalProcessObservation"
+ },
+ "type": "array"
+ },
+ "observed_at_unix_ms": {
+ "format": "int64",
+ "minimum": 0,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "observed_at_unix_ms",
+ "children"
+ ],
+ "type": "object"
+ },
+ "NumericalProcessObservation": {
+ "additionalProperties": false,
+ "properties": {
+ "child_index": {
+ "minimum": 0,
+ "type": "integer"
+ },
+ "snapshot": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/NumericalProfileSnapshot"
+ }
+ ]
+ },
+ "status": {
+ "$ref": "#/components/schemas/NumericalSnapshotStatus"
+ }
+ },
+ "required": [
+ "child_index",
+ "status"
+ ],
+ "type": "object"
+ },
+ "NumericalProfileObservation": {
+ "additionalProperties": false,
+ "properties": {
+ "local_identity": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "model_contract_sha256": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "model_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "model_id"
+ ],
+ "type": "object"
+ },
+ "NumericalProfileSnapshot": {
+ "additionalProperties": false,
+ "properties": {
+ "complete": {
+ "type": "boolean"
+ },
+ "profiles": {
+ "items": {
+ "$ref": "#/components/schemas/NumericalProfileObservation"
+ },
+ "type": "array"
+ },
+ "runtime_instance_id": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "complete",
+ "profiles"
+ ],
+ "type": "object"
+ },
+ "NumericalSnapshotStatus": {
+ "enum": [
+ "observed",
+ "incomplete",
+ "unavailable",
+ "invalid"
+ ],
+ "type": "string"
+ },
"OpenAIEmbeddingDataEntry": {
"properties": {
"embedding": {
@@ -3995,6 +4101,17 @@
"name": {
"type": "string"
},
+ "numerical_process_inventory": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/NumericalProcessInventory",
+ "description": "Most recent process diagnostics, including unavailable children.\nHealth and observation time must be checked independently."
+ }
+ ]
+ },
"pending_cost": {
"format": "int64",
"type": "integer"
diff --git a/packages/sie_gateway/src/discovery/nats_health.rs b/packages/sie_gateway/src/discovery/nats_health.rs
index 5d719ac06..9933ef1d9 100644
--- a/packages/sie_gateway/src/discovery/nats_health.rs
+++ b/packages/sie_gateway/src/discovery/nats_health.rs
@@ -316,6 +316,7 @@ mod tests {
memory_total_bytes: None,
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
}
}
diff --git a/packages/sie_gateway/src/handlers/config_api.rs b/packages/sie_gateway/src/handlers/config_api.rs
index 52fa7fe6a..0c16834a7 100644
--- a/packages/sie_gateway/src/handlers/config_api.rs
+++ b/packages/sie_gateway/src/handlers/config_api.rs
@@ -872,6 +872,7 @@ mod tests {
pool_name: "default".into(),
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
}
}
diff --git a/packages/sie_gateway/src/handlers/models.rs b/packages/sie_gateway/src/handlers/models.rs
index 2ad2f8f3a..07a0d251e 100644
--- a/packages/sie_gateway/src/handlers/models.rs
+++ b/packages/sie_gateway/src/handlers/models.rs
@@ -702,6 +702,7 @@ mod route_tests {
pool_name: String::new(),
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
}
}
diff --git a/packages/sie_gateway/src/handlers/proxy.rs b/packages/sie_gateway/src/handlers/proxy.rs
index 3bd9886d8..066510cbe 100644
--- a/packages/sie_gateway/src/handlers/proxy.rs
+++ b/packages/sie_gateway/src/handlers/proxy.rs
@@ -18950,6 +18950,7 @@ mod tests {
memory_total_bytes: None,
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
},
)
@@ -23105,6 +23106,7 @@ mod tests {
memory_total_bytes: None,
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
}
}
diff --git a/packages/sie_gateway/src/state/worker_registry.rs b/packages/sie_gateway/src/state/worker_registry.rs
index ae0a59362..9375dbd6d 100644
--- a/packages/sie_gateway/src/state/worker_registry.rs
+++ b/packages/sie_gateway/src/state/worker_registry.rs
@@ -208,6 +208,7 @@ impl WorkerRegistry {
bundle: "default".to_string(),
bundle_config_hash: String::new(),
supports_execution_authority_v1: false,
+ numerical_process_inventory: None,
models: Vec::new(),
queue_depth: 0,
pending_cost: 0,
@@ -238,6 +239,12 @@ impl WorkerRegistry {
};
w.bundle_config_hash = msg.bundle_config_hash.clone();
w.supports_execution_authority_v1 = msg.supports_execution_authority_v1;
+ // Replace on every heartbeat: legacy or invalid observations clear
+ // the previous process inventory rather than retaining stale IDs.
+ w.numerical_process_inventory = msg
+ .numerical_process_inventory
+ .filter(|inventory| inventory.valid())
+ .map(Arc::new);
let overflow = msg.unsupported_models.len() > MAX_UNSUPPORTED_MODELS;
if overflow && !w.unsupported_overflow {
tracing::warn!(
@@ -975,6 +982,7 @@ impl WorkerRegistry {
bundle_config_hash: w.bundle_config_hash.clone(),
unsupported_models: w.unsupported_models.to_vec(),
unsupported_models_overflow: w.unsupported_overflow,
+ numerical_process_inventory: w.numerical_process_inventory.as_deref().cloned(),
});
if w.healthy() {
@@ -1070,6 +1078,7 @@ mod tests {
memory_total_bytes: None,
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
}
}
@@ -1078,6 +1087,66 @@ mod tests {
WorkerRegistry::new(Duration::from_secs(30), None)
}
+ #[tokio::test]
+ async fn numerical_inventory_includes_saturated_workers_and_replaces_processes() {
+ let reg = registry();
+ let mut message = make_msg(true);
+ message.saturated = true;
+ message.numerical_process_inventory = serde_json::from_value(serde_json::json!({
+ "observed_at_unix_ms": 1,
+ "children": [{"child_index": 0, "status": "observed", "snapshot": {
+ "runtime_instance_id": "a".repeat(64), "complete": true, "profiles": []
+ }}]
+ }))
+ .unwrap();
+ reg.update_worker("http://w1", message.clone()).await;
+ let status = reg.get_cluster_status().await;
+ assert!(status.workers[0].healthy);
+ let inventory = status.workers[0]
+ .numerical_process_inventory
+ .as_ref()
+ .unwrap();
+ assert_eq!(
+ inventory.children[0]
+ .snapshot
+ .as_ref()
+ .unwrap()
+ .runtime_instance_id
+ .as_deref(),
+ Some("a".repeat(64).as_str())
+ );
+ assert!(!reg.workers.read().await["http://w1"].eligible_for_dispatch());
+ message
+ .numerical_process_inventory
+ .as_mut()
+ .unwrap()
+ .children[0]
+ .snapshot
+ .as_mut()
+ .unwrap()
+ .runtime_instance_id = Some("b".repeat(64));
+ reg.update_worker("http://w1", message).await;
+ let status = reg.get_cluster_status().await;
+ assert_eq!(
+ status.workers[0]
+ .numerical_process_inventory
+ .as_ref()
+ .unwrap()
+ .children[0]
+ .snapshot
+ .as_ref()
+ .unwrap()
+ .runtime_instance_id
+ .as_deref(),
+ Some("b".repeat(64).as_str())
+ );
+ // A legacy heartbeat must not keep a previous process's proof metadata.
+ reg.update_worker("http://w1", make_msg(true)).await;
+ let status = reg.get_cluster_status().await;
+ assert!(status.workers[0].healthy);
+ assert!(status.workers[0].numerical_process_inventory.is_none());
+ }
+
#[tokio::test]
async fn unavailable_lane_trigger_is_scoped_and_usable_workers_win() {
let reg = registry();
@@ -1512,6 +1581,7 @@ mod tests {
memory_total_bytes: Some(8000),
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
};
reg.update_worker("http://w1:8080", msg).await;
@@ -1549,6 +1619,7 @@ mod tests {
memory_total_bytes: None,
saturated: false,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
};
reg.update_worker("http://w1:8080", msg).await;
@@ -2221,6 +2292,7 @@ mod tests {
memory_total_bytes: None,
saturated,
terminated: false,
+ numerical_process_inventory: None,
unsupported_models: Vec::new(),
}
}
diff --git a/packages/sie_gateway/src/types/worker.rs b/packages/sie_gateway/src/types/worker.rs
index 26f4216a3..25681546f 100644
--- a/packages/sie_gateway/src/types/worker.rs
+++ b/packages/sie_gateway/src/types/worker.rs
@@ -1,4 +1,6 @@
-use serde::{Deserialize, Serialize};
+use serde::{Deserialize, Deserializer, Serialize};
+use std::collections::{HashMap, HashSet};
+use std::io::{self, Write};
use std::sync::Arc;
use std::time::Instant;
use utoipa::ToSchema;
@@ -32,6 +34,8 @@ pub struct WorkerState {
pub bundle_config_hash: String,
/// Positive support for the versioned queue and backend execution fence.
pub supports_execution_authority_v1: bool,
+ /// Diagnostic observations only; never sufficient for numerical admission.
+ pub numerical_process_inventory: Option<Arc<NumericalProcessInventory>>,
pub models: Vec<String>,
pub queue_depth: i32,
pub pending_cost: i64,
@@ -129,6 +133,10 @@ pub struct WorkerInfo {
/// bundle) while it overflows. Omitted when false.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub unsupported_models_overflow: bool,
+ /// Most recent process diagnostics, including unavailable children.
+ /// Health and observation time must be checked independently.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub numerical_process_inventory: Option<NumericalProcessInventory>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
@@ -250,6 +258,184 @@ pub struct WorkerStatusMessage {
/// covers.
#[serde(default)]
pub unsupported_models: Vec<String>,
+ /// Optional bounded diagnostics. Invalid metadata must not drop health.
+ #[serde(default, deserialize_with = "deserialize_numerical_inventory")]
+ pub numerical_process_inventory: Option<NumericalProcessInventory>,
+}
+
+/// Wire budget shared with the sidecar publisher. Never truncate a fleet.
+pub const MAX_NUMERICAL_INVENTORY_BYTES: usize = 64 * 1024;
+pub const MAX_NUMERICAL_CHILDREN: usize = 256;
+
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(deny_unknown_fields)]
+pub struct NumericalProcessInventory {
+ pub observed_at_unix_ms: u64,
+ pub children: Vec<NumericalProcessObservation>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(deny_unknown_fields)]
+pub struct NumericalProcessObservation {
+ pub child_index: usize,
+ pub status: NumericalSnapshotStatus,
+ pub snapshot: Option<NumericalProfileSnapshot>,
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum NumericalSnapshotStatus {
+ Observed,
+ Incomplete,
+ Unavailable,
+ Invalid,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(deny_unknown_fields)]
+pub struct NumericalProfileSnapshot {
+ pub runtime_instance_id: Option<String>,
+ pub complete: bool,
+ pub profiles: Vec<NumericalProfileObservation>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(deny_unknown_fields)]
+pub struct NumericalProfileObservation {
+ pub model_id: String,
+ pub model_contract_sha256: Option<String>,
+ pub local_identity: Option<String>,
+}
+
+fn sha256_digest(value: &str) -> bool {
+ value.len() == 64
+ && value
+ .bytes()
+ .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))
+}
+
+struct InventoryBudget(usize);
+
+impl Write for InventoryBudget {
+ fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
+ if bytes.len() > MAX_NUMERICAL_INVENTORY_BYTES.saturating_sub(self.0) {
+ return Err(io::Error::new(
+ io::ErrorKind::InvalidData,
+ "numerical inventory exceeds wire budget",
+ ));
+ }
+ self.0 += bytes.len();
+ Ok(bytes.len())
+ }
+
+ fn flush(&mut self) -> io::Result<()> {
+ Ok(())
+ }
+}
+
+fn fits_inventory_budget(value: &impl Serialize) -> bool {
+ serde_json::to_writer(&mut InventoryBudget(0), value).is_ok()
+}
+
+impl NumericalProcessInventory {
+ pub fn valid(&self) -> bool {
+ if self.observed_at_unix_ms == 0
+ || self.children.is_empty()
+ || self.children.len() > MAX_NUMERICAL_CHILDREN
+ || !fits_inventory_budget(self)
+ {
+ return false;
+ }
+ let mut instances = HashMap::new();
+ for (index, child) in self.children.iter().enumerate() {
+ if child.child_index != index {
+ return false;
+ }
+ let Some(snapshot) = &child.snapshot else {
+ if !matches!(
+ child.status,
+ NumericalSnapshotStatus::Unavailable | NumericalSnapshotStatus::Invalid
+ ) {
+ return false;
+ }
+ continue;
+ };
+ if child.status == NumericalSnapshotStatus::Unavailable
+ || snapshot
+ .runtime_instance_id
+ .as_deref()
+ .is_some_and(|id| !sha256_digest(id))
+ || snapshot.profiles.len() > 1024
+ {
+ return false;
+ }
+ let mut models = HashSet::new();
+ for profile in &snapshot.profiles {
+ if profile.model_id.is_empty()
+ || profile.model_id.len() > 1024
+ || !models.insert(&profile.model_id)
+ || profile
+ .model_contract_sha256
+ .as_deref()
+ .is_some_and(|id| !sha256_digest(id))
+ || profile
+ .local_identity
+ .as_deref()
+ .is_some_and(|id| !id.strip_prefix("v1:sha256:").is_some_and(sha256_digest))
+ {
+ return false;
+ }
+ }
+ let complete = snapshot.complete
+ && snapshot.runtime_instance_id.is_some()
+ && snapshot
+ .profiles
+ .iter()
+ .all(|profile| profile.model_contract_sha256.is_some());
+ if (child.status == NumericalSnapshotStatus::Observed && !complete)
+ || (child.status == NumericalSnapshotStatus::Incomplete && complete)
+ {
+ return false;
+ }
+ if let Some(instance) = &snapshot.runtime_instance_id {
+ instances
+ .entry(instance)
+ .or_insert_with(Vec::new)
+ .push(child.status);
+ }
+ }
+ // The pool marks every child sharing a process ID invalid. Preserve
+ // those diagnostics, but never accept duplicate positive observations.
+ instances.values().all(|statuses| {
+ statuses.len() == 1
+ || statuses
+ .iter()
+ .all(|status| *status == NumericalSnapshotStatus::Invalid)
+ })
+ }
+}
+
+fn deserialize_numerical_inventory<'de, D: Deserializer<'de>>(
+ deserializer: D,
+) -> Result<Option<NumericalProcessInventory>, D::Error> {
+ // MessagePack may carry non-JSON values (for example binary data). The
+ // ignored alternative consumes those fully so optional diagnostics cannot
+ // invalidate an otherwise usable health message.
+ #[derive(Deserialize)]
+ #[serde(untagged)]
+ enum InventoryWire {
+ Json(serde_json::Value),
+ Ignored(serde::de::IgnoredAny),
+ }
+ let InventoryWire::Json(value) = InventoryWire::deserialize(deserializer)? else {
+ return Ok(None);
+ };
+ if !fits_inventory_budget(&value) {
+ return Ok(None);
+ }
+ Ok(serde_json::from_value::<NumericalProcessInventory>(value)
+ .ok()
+ .filter(NumericalProcessInventory::valid))
}
#[derive(Debug, Clone, Deserialize)]
@@ -270,6 +456,116 @@ pub struct GpuStatus {
mod tests {
use super::*;
+ fn inventory() -> serde_json::Value {
+ serde_json::json!({
+ "observed_at_unix_ms": 1,
+ "children": [
+ {"child_index": 0, "status": "observed", "snapshot": {
+ "runtime_instance_id": "a".repeat(64), "complete": true,
+ "profiles": [{"model_id": "model:default", "model_contract_sha256": "b".repeat(64), "local_identity": null}]
+ }},
+ {"child_index": 1, "status": "unavailable", "snapshot": null}
+ ]
+ })
+ }
+
+ #[test]
+ fn numerical_diagnostics_preserve_missing_children_without_authority() {
+ let message: WorkerStatusMessage = serde_json::from_value(serde_json::json!({
+ "ready": true, "numerical_process_inventory": inventory()
+ }))
+ .unwrap();
+ assert!(message.ready);
+ assert!(!message.supports_execution_authority_v1);
+ let inventory = message.numerical_process_inventory.unwrap();
+ assert_eq!(inventory.children.len(), 2);
+ assert_eq!(
+ inventory.children[1].status,
+ NumericalSnapshotStatus::Unavailable
+ );
+ assert!(inventory.children[0].snapshot.as_ref().unwrap().profiles[0]
+ .local_identity
+ .is_none());
+ }
+
+ #[test]
+ fn invalid_numerical_metadata_never_discards_worker_health() {
+ let mut cases = vec![
+ serde_json::json!(null),
+ serde_json::json!("bad"),
+ inventory(),
+ ];
+ cases[2]["children"][0]["snapshot"]["runtime_instance_id"] = serde_json::json!("bad");
+ let mut unknown = inventory();
+ unknown["children"][0]["snapshot"]["caller_input"] =
+ serde_json::json!("must not be retained");
+ cases.push(unknown);
+ let mut sparse = inventory();
+ sparse["children"][1]["child_index"] = serde_json::json!(2);
+ cases.push(sparse);
+ let mut false_complete = inventory();
+ false_complete["children"][0]["snapshot"]["complete"] = serde_json::json!(false);
+ cases.push(false_complete);
+ let mut too_large = inventory();
+ too_large["padding"] = serde_json::json!("x".repeat(MAX_NUMERICAL_INVENTORY_BYTES));
+ cases.push(too_large);
+ let mut too_many = inventory();
+ too_many["children"] = serde_json::Value::Array(
+ (0..=MAX_NUMERICAL_CHILDREN)
+ .map(|index| {
+ serde_json::json!({
+ "child_index": index, "status": "unavailable", "snapshot": null
+ })
+ })
+ .collect(),
+ );
+ cases.push(too_many);
+ for inventory in cases {
+ let message: WorkerStatusMessage = serde_json::from_value(serde_json::json!({
+ "ready": true, "bundle_config_hash": "hash", "numerical_process_inventory": inventory
+ })).unwrap();
+ assert!(message.ready);
+ assert_eq!(message.bundle_config_hash, "hash");
+ assert!(message.numerical_process_inventory.is_none());
+ }
+ }
+
+ #[test]
+ fn binary_messagepack_diagnostics_do_not_discard_following_health_fields() {
+ let mut bytes = rmp_serde::to_vec_named(&serde_json::json!({
+ "numerical_process_inventory": null, "ready": true
+ }))
+ .unwrap();
+ let nil = bytes.iter().position(|byte| *byte == 0xc0).unwrap();
+ bytes.splice(nil..=nil, [0xc4, 3, 0, 1, 2]);
+ let message: WorkerStatusMessage = rmp_serde::from_slice(&bytes).unwrap();
+ assert!(message.ready);
+ assert!(message.numerical_process_inventory.is_none());
+ }
+
+ #[test]
+ fn duplicate_process_ids_are_only_retained_as_invalid_diagnostics() {
+ let mut value = inventory();
+ value["children"][1] = value["children"][0].clone();
+ value["children"][1]["child_index"] = serde_json::json!(1);
+ let message: WorkerStatusMessage = serde_json::from_value(serde_json::json!({
+ "numerical_process_inventory": value.clone()
+ }))
+ .unwrap();
+ assert!(message.numerical_process_inventory.is_none());
+ for child in value["children"].as_array_mut().unwrap() {
+ child["status"] = serde_json::json!("invalid");
+ }
+ let message: WorkerStatusMessage = serde_json::from_value(serde_json::json!({
+ "numerical_process_inventory": value
+ }))
+ .unwrap();
+ assert_eq!(
+ message.numerical_process_inventory.unwrap().children.len(),
+ 2
+ );
+ }
+
fn make_worker(health: WorkerHealth, mem_used: i64, mem_total: i64) -> WorkerState {
WorkerState {
url: "http://w1:8080".into(),
@@ -285,6 +581,7 @@ mod tests {
bundle: "default".into(),
bundle_config_hash: String::new(),
supports_execution_authority_v1: false,
+ numerical_process_inventory: None,
models: vec![],
queue_depth: 0,
pending_cost: 0,
diff --git a/packages/sie_sdk/src/sie_sdk/types.py b/packages/sie_sdk/src/sie_sdk/types.py
index 8c7e0f573..7545b277f 100644
--- a/packages/sie_sdk/src/sie_sdk/types.py
+++ b/packages/sie_sdk/src/sie_sdk/types.py
@@ -924,6 +924,31 @@ class ResponseResult(TypedDict, total=False):
request: RequestMetadata
+class NumericalProfileObservation(TypedDict):
+ model_id: str
+ model_contract_sha256: str | None
+ local_identity: str | None
+
+
+class NumericalProfileSnapshot(TypedDict):
+ runtime_instance_id: str | None
+ complete: bool
+ profiles: list[NumericalProfileObservation]
+
+
+class NumericalProcessObservation(TypedDict):
+ child_index: int
+ status: Literal["observed", "incomplete", "unavailable", "invalid"]
+ snapshot: NotRequired[NumericalProfileSnapshot | None]
+
+
+class NumericalProcessInventory(TypedDict):
+ """Process diagnostics at observation time; grants no execution authority."""
+
+ observed_at_unix_ms: int
+ children: list[NumericalProcessObservation]
+
+
class WorkerInfo(TypedDict, total=False):
"""Information about a single worker in the cluster.
@@ -960,6 +985,7 @@ class WorkerInfo(TypedDict, total=False):
memory_total_bytes: int
bundle: NotRequired[str]
bundle_config_hash: str
+ numerical_process_inventory: NotRequired[NumericalProcessInventory]
class CapacityInfo(TypedDict, total=False):
diff --git a/packages/sie_server/REMOTE_BACKENDS.md b/packages/sie_server/REMOTE_BACKENDS.md
index 8db9d6def..07bc3bbfc 100644
--- a/packages/sie_server/REMOTE_BACKENDS.md
+++ b/packages/sie_server/REMOTE_BACKENDS.md
@@ -388,7 +388,18 @@ the entire record, including its process, timestamp and measured errors. Exact
inventory matching rejects missing, additional or replaced processes, even when
a replacement reports the same execution identity.
-This artifact grants no routing authority. Numerical gateway routing remains
+Sidecars independently poll every adapter child and attach optional
+`numerical_process_inventory` diagnostics to NATS health messages. Cluster
+status exposes each worker's observation timestamp and all child statuses
+(`observed`, `incomplete`, `unavailable`, or `invalid`), including saturated
+workers. The metadata is limited to 256 children and 64 KiB; an oversized
+inventory is omitted whole. Failed probes, legacy heartbeats and observations
+older than ten seconds do not retain a previous process's inventory. Normal
+health publication does not wait for these probes, and diagnostics use dedicated
+IPC connections so they do not occupy serving or readiness connection slots.
+
+These observations and the proof artifact grant no routing authority. An
+`observed` child can still lack a local identity. Numerical gateway routing remains
inactive until operator-owned evidence, complete live membership and execution
fencing are connected. Restarts require new proofs; a collector result cannot
authorize a new process or establish scale-to-zero equivalence.
diff --git a/packages/sie_server_sidecar/src/backend/adapter_pool.rs b/packages/sie_server_sidecar/src/backend/adapter_pool.rs
index f25ded7a5..783fda0f3 100644
--- a/packages/sie_server_sidecar/src/backend/adapter_pool.rs
+++ b/packages/sie_server_sidecar/src/backend/adapter_pool.rs
@@ -79,6 +79,8 @@ struct AdapterWorkerChild {
index: usize,
socket_path: PathBuf,
ipc: Arc<IpcClient>,
+ // Diagnostics must not check out a serving/readiness IPC slot.
+ numerical_ipc: IpcClient,
ready: AtomicBool,
inflight_batches: AtomicI64,
pending_items: AtomicI64,
@@ -143,6 +145,9 @@ impl AdapterWorkerPool {
index,
socket_path: socket_path.clone(),
ipc,
+ numerical_ipc: IpcClient::new(socket_path)
+ .with_timeout(Duration::from_secs(ipc_request_timeout_s))
+ .with_telemetry(runtime_state.telemetry.clone()),
ready: AtomicBool::new(false),
inflight_batches: AtomicI64::new(0),
pending_items: AtomicI64::new(0),
@@ -271,7 +276,7 @@ impl AdapterWorkerPool {
/// Diagnostic snapshots grant no routing authority or readiness capability.
pub async fn numerical_process_inventory(&self) -> Vec<NumericalProcessObservation> {
let mut observations = join_all(self.children.iter().map(|child| async move {
- match child.ipc.numerical_profile_snapshot().await {
+ match child.numerical_ipc.numerical_profile_snapshot().await {
Ok(snapshot) if valid_numerical_snapshot(&snapshot) => {
NumericalProcessObservation {
child_index: child.index,
diff --git a/packages/sie_server_sidecar/src/health_publisher.rs b/packages/sie_server_sidecar/src/health_publisher.rs
index 1d094cdb5..5be0aeb6f 100644
--- a/packages/sie_server_sidecar/src/health_publisher.rs
+++ b/packages/sie_server_sidecar/src/health_publisher.rs
@@ -41,10 +41,11 @@
//! [`WorkerStatusMessage`]: https://github.com/superlinked/sie/blob/main/packages/sie_gateway/src/types/worker.rs
//! [`resolve_queue_route`]: https://github.com/superlinked/sie/blob/main/packages/sie_gateway/src/state/worker_registry.rs
+use std::io::{self, Write};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::sync::RwLock;
-use std::time::Duration;
+use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
use async_nats::Client;
use serde::Serialize;
@@ -52,6 +53,7 @@ use tokio::task::JoinHandle;
use tokio::time::interval;
use tracing::{debug, info, warn};
+use crate::backend::adapter_pool::{AdapterWorkerPool, NumericalProcessObservation};
use crate::readiness::Readiness;
use crate::runtime_state::RuntimeState;
use crate::shutdown::Shutdown;
@@ -59,6 +61,95 @@ use crate::shutdown::Shutdown;
pub type SharedBundleConfigHash = Arc<RwLock<String>>;
pub type SharedLoadedModels = Arc<RwLock<Vec<String>>>;
pub type SharedUnsupportedModels = Arc<RwLock<Vec<String>>>;
+pub type SharedNumericalInventory = Arc<RwLock<Option<(Instant, serde_json::Value)>>>;
+
+// Same wire budget as gateway types/worker.rs. Drop the whole observation;
+// truncation would hide children that remain reachable through pool fallback.
+const MAX_NUMERICAL_INVENTORY_BYTES: usize = 64 * 1024;
+const MAX_NUMERICAL_CHILDREN: usize = 256;
+
+struct InventoryWriter(Vec<u8>);
+
+impl Write for InventoryWriter {
+ fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
+ if bytes.len() > MAX_NUMERICAL_INVENTORY_BYTES.saturating_sub(self.0.len()) {
+ return Err(io::Error::new(
+ io::ErrorKind::InvalidData,
+ "numerical inventory exceeds wire budget",
+ ));
+ }
+ self.0.extend_from_slice(bytes);
+ Ok(bytes.len())
+ }
+
+ fn flush(&mut self) -> io::Result<()> {
+ Ok(())
+ }
+}
+
+fn bounded_inventory(
+ children: &[NumericalProcessObservation],
+ observed_at_unix_ms: u64,
+) -> Option<serde_json::Value> {
+ if children.is_empty() || children.len() > MAX_NUMERICAL_CHILDREN {
+ return None;
+ }
+ #[derive(Serialize)]
+ struct Inventory<'a> {
+ observed_at_unix_ms: u64,
+ children: &'a [NumericalProcessObservation],
+ }
+ let mut writer = InventoryWriter(Vec::new());
+ serde_json::to_writer(
+ &mut writer,
+ &Inventory {
+ observed_at_unix_ms,
+ children,
+ },
+ )
+ .ok()?;
+ serde_json::from_slice(&writer.0).ok()
+}
+
+/// Poll independently of normal IPC pings and NATS health publication. A slow
+/// or unsupported diagnostic RPC must never consume the readiness budget.
+pub fn spawn_numerical_inventory(
+ pool: Arc<AdapterWorkerPool>,
+ inventory: SharedNumericalInventory,
+ shutdown: Arc<Shutdown>,
+) -> JoinHandle<()> {
+ tokio::spawn(async move {
+ let mut tick = interval(DEFAULT_PUBLISH_INTERVAL);
+ tick.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
+ loop {
+ tokio::select! {
+ biased;
+ _ = shutdown.wait() => break,
+ _ = tick.tick() => {}
+ }
+ let started = Instant::now();
+ let observed_at_unix_ms = SystemTime::now()
+ .duration_since(UNIX_EPOCH)
+ .ok()
+ .and_then(|duration| u64::try_from(duration.as_millis()).ok())
+ .unwrap_or(0);
+ let value = if pool.child_count() <= MAX_NUMERICAL_CHILDREN && observed_at_unix_ms > 0 {
+ tokio::select! {
+ biased;
+ _ = shutdown.wait() => break,
+ result = tokio::time::timeout(DEFAULT_PUBLISH_INTERVAL, pool.numerical_process_inventory()) => {
+ result.ok().and_then(|children| bounded_inventory(&children, observed_at_unix_ms))
+ }
+ }
+ } else {
+ None
+ };
+ if let Ok(mut guard) = inventory.write() {
+ *guard = value.map(|value| (started, value));
+ }
+ }
+ })
+}
/// Default subject prefix used by the gateway. Workers always
/// publish to `sie.health.<worker_id>` because the gateway's
@@ -114,6 +205,8 @@ pub struct HealthPublisherConfig {
/// Models the colocated backend reports as loaded. Updated by the IPC
/// heartbeat, not by config apply.
pub loaded_models: SharedLoadedModels,
+ /// Independently polled process diagnostics; never grants routing authority.
+ pub numerical_process_inventory: SharedNumericalInventory,
/// Positive only when every backend child supports the method fence.
pub execution_authority_v1: Arc<AtomicBool>,
/// The versioned pull consumer must also be running.
@@ -164,6 +257,8 @@ struct WorkerStatusPayload<'a> {
saturated: bool,
#[serde(skip_serializing_if = "<[String]>::is_empty")]
unsupported_models: &'a [String],
+ #[serde(skip_serializing_if = "Option::is_none")]
+ numerical_process_inventory: Option<&'a serde_json::Value>,
}
fn encode_payload(
@@ -224,6 +319,18 @@ fn encode_payload(
let inflight_batches = clamp_i64_to_i32(config.runtime_state.inflight_batches.get().max(0));
refresh_worker_saturation(&config.runtime_state);
let saturated = config.runtime_state.worker_saturated.get() > 0;
+ let inventory_guard = config.numerical_process_inventory.read().ok();
+ let numerical_process_inventory = inventory_guard.as_deref().and_then(|inventory| {
+ inventory
+ .as_ref()
+ .filter(|(observed, value)| {
+ !terminated
+ && observed.elapsed() <= DEFAULT_PUBLISH_INTERVAL * 2
+ && serde_json::to_vec(value)
+ .is_ok_and(|bytes| bytes.len() <= MAX_NUMERICAL_INVENTORY_BYTES)
+ })
+ .map(|(_, value)| value)
+ });
let payload = WorkerStatusPayload {
name: &config.worker_id,
ready,
@@ -246,6 +353,7 @@ fn encode_payload(
inflight_batches,
saturated,
unsupported_models: unsupported_models.as_slice(),
+ numerical_process_inventory,
};
serde_json::to_vec(&payload)
}
@@ -415,6 +523,12 @@ pub fn spawn(
#[cfg(test)]
mod tests {
use super::*;
+ use crate::backend::adapter_pool::NumericalSnapshotStatus;
+ use crate::protocol::ipc_types::{
+ NumericalProfileObservation, NumericalProfileSnapshotResponse,
+ };
+ use tokio::io::{AsyncReadExt, AsyncWriteExt};
+ use tokio::net::UnixListener;
fn cfg() -> HealthPublisherConfig {
HealthPublisherConfig {
@@ -426,6 +540,7 @@ mod tests {
bundle_config_hash: Arc::new(RwLock::new("hash-abc".into())),
unsupported_models: Arc::new(RwLock::new(Vec::new())),
loaded_models: Arc::new(RwLock::new(Vec::new())),
+ numerical_process_inventory: Arc::new(RwLock::new(None)),
execution_authority_v1: Arc::new(AtomicBool::new(false)),
authority_consumer_ready: Arc::new(AtomicBool::new(false)),
runtime_state: Arc::new(RuntimeState::new()),
@@ -433,6 +548,155 @@ mod tests {
}
}
+ #[tokio::test]
+ async fn pending_diagnostic_rpc_does_not_block_health_or_shutdown() {
+ let dir = tempfile::Builder::new()
+ .prefix("sie-diag-")
+ .tempdir_in("/tmp")
+ .unwrap();
+ let path = dir.path().join("worker.sock");
+ let listener = UnixListener::bind(&path).unwrap();
+ let requested = Arc::new(tokio::sync::Notify::new());
+ let request_signal = Arc::clone(&requested);
+ let worker = tokio::spawn(async move {
+ let mut connections = tokio::task::JoinSet::new();
+ loop {
+ let (mut socket, _) = listener.accept().await.unwrap();
+ let request_signal = Arc::clone(&request_signal);
+ connections.spawn(async move {
+ loop {
+ let mut length = [0; 4];
+ if socket.read_exact(&mut length).await.is_err() {
+ return;
+ }
+ let mut bytes = vec![0; u32::from_be_bytes(length) as usize];
+ socket.read_exact(&mut bytes).await.unwrap();
+ let request: serde_json::Value = rmp_serde::from_slice(&bytes).unwrap();
+ if request["method"] == "NumericalProfileSnapshot" {
+ request_signal.notify_one();
+ // Keep the diagnostic request pending while normal
+ // health continues on its separate connection.
+ std::future::pending::<()>().await;
+ }
+ assert_eq!(request["method"], "Ping");
+ let response = rmp_serde::to_vec_named(&serde_json::json!({
+ "version": crate::ipc_types::IPC_VERSION,
+ "request_id": request["request_id"], "ok": true,
+ "body": {"ready": true}
+ }))
+ .unwrap();
+ socket
+ .write_all(&(response.len() as u32).to_be_bytes())
+ .await
+ .unwrap();
+ socket.write_all(&response).await.unwrap();
+ }
+ });
+ }
+ });
+ let c = cfg();
+ let pool = AdapterWorkerPool::new(&[path], 1, 30, 30, Arc::clone(&c.runtime_state));
+ let shutdown = Arc::new(Shutdown::new());
+ let poller = spawn_numerical_inventory(
+ Arc::clone(&pool),
+ Arc::clone(&c.numerical_process_inventory),
+ Arc::clone(&shutdown),
+ );
+ tokio::time::timeout(Duration::from_secs(2), requested.notified())
+ .await
+ .unwrap();
+ let ping = tokio::time::timeout(Duration::from_secs(1), pool.primary_ipc().ping(0.0))
+ .await
+ .unwrap()
+ .unwrap();
+ assert!(ping.ready);
+ let payload: serde_json::Value =
+ serde_json::from_slice(&encode_payload(&c, true, false).unwrap()).unwrap();
+ assert_eq!(payload["ready"], true);
+ assert!(payload.get("numerical_process_inventory").is_none());
+ shutdown.fire();
+ tokio::time::timeout(Duration::from_secs(1), poller)
+ .await
+ .unwrap()
+ .unwrap();
+ worker.abort();
+ let _ = worker.await;
+ }
+
+ #[test]
+ fn diagnostic_inventory_keeps_unavailable_children_and_never_grants_authority() {
+ let children = vec![NumericalProcessObservation {
+ child_index: 0,
+ status: NumericalSnapshotStatus::Unavailable,
+ snapshot: None,
+ }];
+ let c = cfg();
+ let value = bounded_inventory(&children, 123).unwrap();
+ *c.numerical_process_inventory.write().unwrap() = Some((Instant::now(), value.clone()));
+ let payload: serde_json::Value =
+ serde_json::from_slice(&encode_payload(&c, true, false).unwrap()).unwrap();
+ assert_eq!(payload["numerical_process_inventory"], value);
+ assert_eq!(payload["ready"], true);
+ assert_eq!(payload["supports_execution_authority_v1"], false);
+ }
+
+ #[test]
+ fn oversized_inventory_is_dropped_whole_while_health_survives() {
+ let mut children = vec![NumericalProcessObservation {
+ child_index: 0,
+ status: NumericalSnapshotStatus::Observed,
+ snapshot: Some(NumericalProfileSnapshotResponse {
+ runtime_instance_id: Some("a".repeat(64)),
+ complete: true,
+ profiles: (0..100)
+ .map(|index| NumericalProfileObservation {
+ model_id: format!("{index}{}", "x".repeat(1020)),
+ model_contract_sha256: Some("b".repeat(64)),
+ local_identity: None,
+ })
+ .collect(),
+ }),
+ }];
+ assert!(bounded_inventory(&children, 1).is_none());
+ children = (0..=MAX_NUMERICAL_CHILDREN)
+ .map(|index| NumericalProcessObservation {
+ child_index: index,
+ status: NumericalSnapshotStatus::Unavailable,
+ snapshot: None,
+ })
+ .collect();
+ assert!(bounded_inventory(&children, 1).is_none());
+ let c = cfg();
+ *c.numerical_process_inventory.write().unwrap() = Some((
+ Instant::now(),
+ serde_json::json!({
+ "padding": "x".repeat(MAX_NUMERICAL_INVENTORY_BYTES)
+ }),
+ ));
+ let payload: serde_json::Value =
+ serde_json::from_slice(&encode_payload(&c, true, false).unwrap()).unwrap();
+ assert!(payload.get("numerical_process_inventory").is_none());
+ assert_eq!(payload["ready"], true);
+ assert_eq!(payload["bundle_config_hash"], "hash-abc");
+ }
+
+ #[test]
+ fn stale_and_shutdown_observations_are_not_republished() {
+ let c = cfg();
+ for (observed, terminated) in [
+ (Instant::now() - DEFAULT_PUBLISH_INTERVAL * 3, false),
+ (Instant::now(), true),
+ ] {
+ *c.numerical_process_inventory.write().unwrap() =
+ Some((observed, serde_json::json!({"children": []})));
+ let payload: serde_json::Value =
+ serde_json::from_slice(&encode_payload(&c, !terminated, terminated).unwrap())
+ .unwrap();
+ assert!(payload.get("numerical_process_inventory").is_none());
+ assert_eq!(payload["terminated"], terminated);
+ }
+ }
+
#[test]
fn subject_is_prefix_dot_worker_id() {
// Gateway's `extract_worker_url_from_status` does
@@ -491,6 +755,7 @@ mod tests {
saturated: false,
loaded_models: &[],
unsupported_models: &[],
+ numerical_process_inventory: None,
};
serde_json::to_value(&payload).unwrap()
};
@@ -538,6 +803,7 @@ mod tests {
saturated: false,
loaded_models: &[],
unsupported_models: &[],
+ numerical_process_inventory: None,
};
serde_json::to_value(&payload).unwrap()
};
diff --git a/packages/sie_server_sidecar/src/lib.rs b/packages/sie_server_sidecar/src/lib.rs
index 0d6b68559..13f21770e 100644
--- a/packages/sie_server_sidecar/src/lib.rs
+++ b/packages/sie_server_sidecar/src/lib.rs
@@ -552,6 +552,14 @@ pub async fn run(config: WorkerConfig) -> anyhow::Result<()> {
// ignore. Default is enabled because the sidecar pod has no
// `/ws/status` endpoint (that endpoint lives on the Python
// container) and therefore forces the gateway into `health_mode=nats`.
+ let numerical_process_inventory = Arc::new(std::sync::RwLock::new(None));
+ let numerical_inventory_handle = health_publish_enabled().then(|| {
+ crate::health_publisher::spawn_numerical_inventory(
+ Arc::clone(&worker_pool),
+ Arc::clone(&numerical_process_inventory),
+ shutdown.clone(),
+ )
+ });
let health_publisher_config = if health_publish_enabled() {
Some(crate::health_publisher::HealthPublisherConfig {
worker_id: config.worker_id.clone(),
@@ -562,6 +570,7 @@ pub async fn run(config: WorkerConfig) -> anyhow::Result<()> {
bundle_config_hash: config_apply_state.bundle_config_hash(),
unsupported_models: config_apply_state.unsupported_models(),
loaded_models: Arc::clone(&loaded_models),
+ numerical_process_inventory,
execution_authority_v1: worker_pool.execution_authority_v1(),
authority_consumer_ready: Arc::clone(&generation_direct_dispatch.authority_active),
runtime_state: Arc::clone(&runtime_state),
@@ -606,6 +615,10 @@ pub async fn run(config: WorkerConfig) -> anyhow::Result<()> {
readiness.mark_draining();
heartbeat_handle.abort();
let _ = heartbeat_handle.await; // best-effort join
+ if let Some(handle) = numerical_inventory_handle {
+ handle.abort();
+ let _ = handle.await;
+ }
// Let the periodic NATS health publisher observe shutdown and emit
// its tombstone before we move on. Aborting it immediately here can
diff --git a/packages/sie_ts_sdk/src/index.ts b/packages/sie_ts_sdk/src/index.ts
index 0f9e67c96..1b88aa9b0 100644
--- a/packages/sie_ts_sdk/src/index.ts
+++ b/packages/sie_ts_sdk/src/index.ts
@@ -92,6 +92,10 @@ export type {
CapacityInfo,
ClusterSummary,
ClusterWorkerInfo,
+ NumericalProcessInventory,
+ NumericalProcessObservation,
+ NumericalProfileSnapshot,
+ NumericalProfileObservation,
ModelSummary,
ServerInfo,
GPUMetrics,
diff --git a/packages/sie_ts_sdk/src/types.ts b/packages/sie_ts_sdk/src/types.ts
index 7fc2437c9..187ad4d40 100644
--- a/packages/sie_ts_sdk/src/types.ts
+++ b/packages/sie_ts_sdk/src/types.ts
@@ -720,12 +720,37 @@ export interface ClusterSummary {
total_qps: number;
}
+/** Process diagnostics at observation time; grants no execution authority. */
+export interface NumericalProcessInventory {
+ observed_at_unix_ms: number;
+ children: NumericalProcessObservation[];
+}
+
+export interface NumericalProcessObservation {
+ child_index: number;
+ status: "observed" | "incomplete" | "unavailable" | "invalid";
+ snapshot?: NumericalProfileSnapshot | null;
+}
+
+export interface NumericalProfileSnapshot {
+ runtime_instance_id: string | null;
+ complete: boolean;
+ profiles: NumericalProfileObservation[];
+}
+
+export interface NumericalProfileObservation {
+ model_id: string;
+ model_contract_sha256: string | null;
+ local_identity: string | null;
+}
+
export interface ClusterWorkerInfo {
url: string;
gpu: string;
healthy: boolean;
queue_depth: number;
loaded_models: string[];
+ numerical_process_inventory?: NumericalProcessInventory;
}
export interface ModelSummary {