Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,229 changes: 968 additions & 261 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/buzz-relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ metrics-exporter-prometheus = { workspace = true }
dev = ["buzz-auth/dev"]

[dev-dependencies]
mesh-llm-sdk = { git = "https://github.com/Mesh-LLM/mesh-llm.git", rev = "ebc3ab4c4b5f4a45d5bc942c66c18583800c3f82", package = "mesh-llm-sdk", default-features = false, features = ["client", "serving"] }
mesh-llm-host-runtime = { git = "https://github.com/Mesh-LLM/mesh-llm.git", rev = "ebc3ab4c4b5f4a45d5bc942c66c18583800c3f82", package = "mesh-llm-host-runtime", default-features = false, features = ["dynamic-native-runtime"] }
mesh-llm-sdk = { git = "https://github.com/Mesh-LLM/mesh-llm.git", rev = "c209d1775fec5fcf6ab314628826dfdb0615ea6a", package = "mesh-llm-sdk", default-features = false, features = ["client", "serving"] }
mesh-llm-host-runtime = { git = "https://github.com/Mesh-LLM/mesh-llm.git", rev = "c209d1775fec5fcf6ab314628826dfdb0615ea6a", package = "mesh-llm-host-runtime", default-features = false, features = ["dynamic-native-runtime"] }
buzz-core = { workspace = true, features = ["test-utils"] }
buzz-auth = { workspace = true, features = ["dev"] }
reqwest = { workspace = true }
455 changes: 455 additions & 0 deletions crates/buzz-relay/examples/mesh_admission_smoke.rs

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion crates/buzz-relay/examples/mesh_serve_client_smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async fn main() -> anyhow::Result<()> {
anyhow::bail!("MeshLLM native runtime for MeshLLM {current} is not installed; run `just mesh-e2e-hardware` to prepare it");
}
mesh_llm_host_runtime::initialize_host_runtime()
.await
.map_err(|error| anyhow::anyhow!("MeshLLM host runtime init failed: {error}"))?;
eprintln!("[smoke] MeshLLM host runtime initialized");

Expand Down Expand Up @@ -137,7 +138,14 @@ async fn main() -> anyhow::Result<()> {
}
println!("[smoke] OK — routed completion finish_reason={finish:?} content={content:?}");
eprintln!("[smoke] PASS: serve→client→inference proven over mesh");
Ok(())
// Exit immediately, skipping remaining Rust drops (tokio runtime, iroh
// endpoints). The embedded ggml Metal runtime can GGML_ASSERT inside C++
// static destructors at process teardown when a node wasn't cleanly shut
// down (observed here after a startup failure; mesh-console issue #8 is
// the same crash — its fix is libc::_exit, which this repo's no-unsafe
// rule rules out). Both nodes are stopped above, which is what keeps the
// finalizers quiet on the success path.
std::process::exit(0);
}

/// Poll a node's `/models` until it reports a model, returning the served id
Expand Down
33 changes: 33 additions & 0 deletions crates/buzz-relay/src/mesh_status_publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ pub struct BuzzMeshStatus {
/// Mesh identity, if mesh-llm has joined/created one.
#[serde(skip_serializing_if = "Option::is_none")]
pub mesh_id: Option<String>,
/// Reporter's mesh owner id (mesh-llm owner keypair identity). Serve
/// nodes build their admission allowlist from the member owner ids in
/// these notes, so a member's node is only dialable/joinable by nodes
/// whose owner id appears in a relay-signed status note.
#[serde(skip_serializing_if = "Option::is_none")]
pub owner_id: Option<String>,
/// Human mesh name, if configured.
#[serde(skip_serializing_if = "Option::is_none")]
pub mesh_name: Option<String>,
Expand Down Expand Up @@ -109,6 +115,7 @@ pub fn sanitize_mesh_status(payload: &Value, now_unix: u64) -> BuzzMeshStatus {
let node_id = string_field(payload, "node_id");
let mesh_id = string_field(payload, "mesh_id");
let mesh_name = string_field(payload, "mesh_name");
let owner_id = string_field(payload, "ownerId").or_else(|| string_field(payload, "owner_id"));
let my_vram_gb = payload.get("my_vram_gb").and_then(Value::as_f64);

let mut models = Vec::<MeshModelOption>::new();
Expand Down Expand Up @@ -182,6 +189,7 @@ pub fn sanitize_mesh_status(payload: &Value, now_unix: u64) -> BuzzMeshStatus {
status_type: MESH_STATUS_TYPE.to_string(),
updated_at: now_unix,
mesh_id,
owner_id,
mesh_name,
serve_targets,
models,
Expand Down Expand Up @@ -357,6 +365,31 @@ mod tests {
assert!(!serialized.contains("/secret"));
}

#[test]
fn sanitizer_carries_owner_id_for_admission_roster() {
let payload = serde_json::json!({
"token": "endpoint-token-a",
"ownerId": "owner-abc123",
"hosted_models": ["Qwen3-8B-Q4_K_M"],
"peers": []
});
let status = sanitize_mesh_status(&payload, 123);
assert_eq!(status.owner_id.as_deref(), Some("owner-abc123"));

// snake_case variant also accepted; absent stays None (and is omitted
// from the serialized note).
let snake = serde_json::json!({ "token": "t", "owner_id": "owner-x", "peers": [] });
assert_eq!(
sanitize_mesh_status(&snake, 1).owner_id.as_deref(),
Some("owner-x")
);
let none = serde_json::json!({ "token": "t", "peers": [] });
let status = sanitize_mesh_status(&none, 1);
assert_eq!(status.owner_id, None);
let serialized = serde_json::to_string(&status).unwrap();
assert!(!serialized.contains("ownerId"));
}

#[test]
fn sanitizer_keeps_model_id_separate_from_label() {
let payload = serde_json::json!({
Expand Down
Loading
Loading