mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: add text fallback for pure rich content tool results
Providers that only serialize text content (OpenAI, Codex, Anthropic) would produce no tool output for the model when execute returns only rich content. Always include a text placeholder so the model sees a valid tool result. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -310,7 +310,13 @@ impl CodeExecutionClient {
|
||||
});
|
||||
|
||||
if is_pure_ref && !rich_contents.is_empty() {
|
||||
Ok(rich_contents)
|
||||
// Always include a text fallback so providers that only serialize
|
||||
// text content (OpenAI, Codex, Anthropic) still produce a tool result
|
||||
// for the model. The rich content carries audience metadata and will
|
||||
// be filtered by downstream audience logic.
|
||||
let mut contents = vec![Content::text("Tool returned rich content.")];
|
||||
contents.extend(rich_contents);
|
||||
Ok(contents)
|
||||
} else {
|
||||
let return_val = serde_json::to_string_pretty(&output.output)
|
||||
.unwrap_or_else(|_| json!(&output.output).to_string());
|
||||
|
||||
Reference in New Issue
Block a user