Skip to content

Commit 2cd640b

Browse files
committed
feat(mesh): upgrade embedded mesh to v0.74 and harden shared compute
Pin mesh-llm to the v0.74.0 tag instead of a commit rev, and carry the desktop-side changes that upgrade needs: catalog/coordinator/recovery updates, the relay-mesh agent preset, and restart behaviour that survives community boundary changes and roster churn. Also promote reasoning to text in the OpenAI-compat parser when `content` is empty and there are no tool calls. Local models served through mesh sometimes return the entire answer as reasoning; with no tool calls there is nothing else to surface, so reporting an empty turn loses the reply. Signed-off-by: Michael Neale <[email protected]>
1 parent 66e7054 commit 2cd640b

17 files changed

Lines changed: 806 additions & 353 deletions

File tree

‎Cargo.lock‎

Lines changed: 104 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/buzz-agent/src/llm.rs‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,9 @@ fn parse_responses(v: Value) -> Result<LlmResponse, AgentError> {
11871187
Some("completed") => ProviderStop::EndTurn,
11881188
_ => ProviderStop::Other,
11891189
};
1190+
if text.is_empty() && !reasoning.is_empty() && tool_calls.is_empty() {
1191+
text = reasoning.clone();
1192+
}
11901193
let input_tokens = sum_usage(&v, &["input_tokens"]);
11911194
let output_tokens = sum_usage(&v, &["output_tokens"]);
11921195
// The Responses API nests the cache split under `input_tokens_details`.
@@ -1448,7 +1451,7 @@ fn parse_openai(v: Value) -> Result<LlmResponse, AgentError> {
14481451
let msg = choice
14491452
.get("message")
14501453
.ok_or_else(|| AgentError::Llm("missing message".into()))?;
1451-
let (text, block_reasoning) = openai_content_parts(msg.get("content"));
1454+
let (mut text, block_reasoning) = openai_content_parts(msg.get("content"));
14521455
// DeepSeek and vLLM-style OpenAI-compat hosts expose reasoning tokens on the
14531456
// message object. Prefer `reasoning_content` (DeepSeek's field name); fall
14541457
// back to `reasoning` (some other providers), and last to reasoning blocks
@@ -1495,6 +1498,13 @@ fn parse_openai(v: Value) -> Result<LlmResponse, AgentError> {
14951498
}
14961499
}
14971500
dedupe_provider_ids(&mut tool_calls);
1501+
// Some OpenAI-compat hosts (and local models served via mesh) return the
1502+
// whole answer as reasoning with an empty `content`. With no tool calls
1503+
// there is nothing else to surface, so promote reasoning to text rather
1504+
// than reporting an empty turn.
1505+
if text.is_empty() && !reasoning.is_empty() && tool_calls.is_empty() {
1506+
text = reasoning.clone();
1507+
}
14981508
let input_tokens = openai_chat_input_tokens(&v);
14991509
let output_tokens = sum_usage(&v, &["completion_tokens"]);
15001510
let cached_input_tokens = openai_chat_cached_tokens(&v);
@@ -2681,6 +2691,21 @@ mod tests {
26812691
assert_eq!(r.stop, ProviderStop::EndTurn);
26822692
}
26832693

2694+
#[test]
2695+
fn parse_responses_uses_reasoning_when_text_is_empty() {
2696+
let v = serde_json::json!({
2697+
"status": "completed",
2698+
"output": [{
2699+
"type": "reasoning",
2700+
"summary": [{"type": "summary_text", "text": "local model reply"}],
2701+
}],
2702+
});
2703+
let r = parse_responses(v).unwrap();
2704+
assert_eq!(r.text, "local model reply");
2705+
assert_eq!(r.reasoning, "local model reply");
2706+
assert!(r.tool_calls.is_empty());
2707+
}
2708+
26842709
#[test]
26852710
fn parse_responses_completed_with_function_call_is_tool_use() {
26862711
let v = serde_json::json!({
@@ -4033,6 +4058,23 @@ mod tests {
40334058
assert_eq!(parse_openai(v).unwrap().input_tokens, Some(123));
40344059
}
40354060

4061+
#[test]
4062+
fn parse_openai_uses_reasoning_content_when_content_is_empty() {
4063+
let v = serde_json::json!({
4064+
"choices": [{
4065+
"finish_reason": "stop",
4066+
"message": {
4067+
"content": "",
4068+
"reasoning_content": "local model reply"
4069+
}
4070+
}]
4071+
});
4072+
let r = parse_openai(v).unwrap();
4073+
assert_eq!(r.text, "local model reply");
4074+
assert_eq!(r.reasoning, "local model reply");
4075+
assert!(r.tool_calls.is_empty());
4076+
}
4077+
40364078
#[test]
40374079
fn parse_openai_databricks_prompt_tokens_already_inclusive() {
40384080
// Databricks' MLflow route uses the OpenAI chat wire format

‎crates/buzz-relay/Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ async-compression = { version = "0.4.42", features = ["tokio", "gzip"] }
8484
dev = ["buzz-auth/dev"]
8585

8686
[dev-dependencies]
87-
mesh-llm-sdk = { git = "https://github.com/Mesh-LLM/mesh-llm.git", tag = "v0.73.1", package = "mesh-llm-sdk", default-features = false, features = ["client", "serving"] }
88-
mesh-llm-host-runtime = { git = "https://github.com/Mesh-LLM/mesh-llm.git", tag = "v0.73.1", package = "mesh-llm-host-runtime", default-features = false, features = ["dynamic-native-runtime"] }
87+
mesh-llm-sdk = { git = "https://github.com/Mesh-LLM/mesh-llm.git", tag = "v0.74.0", package = "mesh-llm-sdk", default-features = false, features = ["client", "serving"] }
88+
mesh-llm-host-runtime = { git = "https://github.com/Mesh-LLM/mesh-llm.git", tag = "v0.74.0", package = "mesh-llm-host-runtime", default-features = false, features = ["dynamic-native-runtime"] }
8989
buzz-core = { workspace = true, features = ["test-utils"] }
9090
buzz-auth = { workspace = true, features = ["dev"] }
9191
reqwest = { workspace = true }

0 commit comments

Comments
 (0)