diff --git a/crates/openfang-memory/src/session.rs b/crates/openfang-memory/src/session.rs index 71a43909..7a18e0f9 100644 --- a/crates/openfang-memory/src/session.rs +++ b/crates/openfang-memory/src/session.rs @@ -496,7 +496,7 @@ impl SessionStore { .conn .lock() .map_err(|e| OpenFangError::Internal(e.to_string()))?; - let messages_blob = rmp_serde::to_vec(&canonical.messages) + let messages_blob = rmp_serde::to_vec_named(&canonical.messages) .map_err(|e| OpenFangError::Serialization(e.to_string()))?; conn.execute( "INSERT INTO canonical_sessions (agent_id, messages, compaction_cursor, compacted_summary, updated_at) diff --git a/crates/openfang-runtime/src/drivers/claude_code.rs b/crates/openfang-runtime/src/drivers/claude_code.rs index 2a11aebd..897d12ed 100644 --- a/crates/openfang-runtime/src/drivers/claude_code.rs +++ b/crates/openfang-runtime/src/drivers/claude_code.rs @@ -186,6 +186,7 @@ impl ClaudeCodeDriver { ContentBlock::ToolUse { .. } | ContentBlock::ToolResult { .. } | ContentBlock::Thinking { .. } + | ContentBlock::RedactedThinking { .. } | ContentBlock::Unknown => None, }) .collect::>() @@ -792,6 +793,7 @@ mod tests { data: fake_b64, }, ]), + ..Default::default() }], tools: vec![], max_tokens: 1024, @@ -824,6 +826,7 @@ mod tests { media_type: "image/jpeg".to_string(), data: "Zm9v".to_string(), }]), + ..Default::default() }], tools: vec![], max_tokens: 1024, diff --git a/crates/openfang-runtime/src/drivers/openai.rs b/crates/openfang-runtime/src/drivers/openai.rs index 5d9cf521..15964f71 100644 --- a/crates/openfang-runtime/src/drivers/openai.rs +++ b/crates/openfang-runtime/src/drivers/openai.rs @@ -776,6 +776,7 @@ impl LlmDriver for OpenAIDriver { } } + let already_has_reasoning = choice.message.reasoning_text().is_some(); if let Some(text) = choice.message.content { if !text.is_empty() { // Extract ... blocks that some local models @@ -785,7 +786,7 @@ impl LlmDriver for OpenAIDriver { // Only add if we didn't already get a reasoning field // (either legacy `reasoning_content` or new vLLM 0.19+ // `reasoning`). Issue #1157. - if choice.message.reasoning_text().is_none() { + if !already_has_reasoning { // Mark the format so we re-emit as inline `` // tags on the next turn (MiniMax/M2.5 style). content.push(ContentBlock::Thinking { diff --git a/crates/openfang-runtime/src/tool_runner.rs b/crates/openfang-runtime/src/tool_runner.rs index 10457a9c..85fec6c9 100644 --- a/crates/openfang-runtime/src/tool_runner.rs +++ b/crates/openfang-runtime/src/tool_runner.rs @@ -1399,16 +1399,18 @@ fn resolve_directory_path_for_create( // Walk up to find the nearest existing ancestor, canonicalize it, then // re-append the missing tail. let mut existing: PathBuf = candidate.clone(); - let mut tail: Vec<&std::ffi::OsStr> = Vec::new(); + let mut tail: Vec = Vec::new(); while !existing.exists() { - let Some(parent) = existing.parent() else { - return Err("Invalid path: no existing ancestor".to_string()); + let parent = match existing.parent() { + Some(p) => p.to_path_buf(), + None => return Err("Invalid path: no existing ancestor".to_string()), }; - let Some(name) = existing.file_name() else { - return Err("Invalid path: no filename component".to_string()); + let name = match existing.file_name() { + Some(n) => n.to_os_string(), + None => return Err("Invalid path: no filename component".to_string()), }; tail.push(name); - existing = parent.to_path_buf(); + existing = parent; } let canon_existing = existing