The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix: suppress cli-internal tool blocks even when metadata is missing
Steven Enamakelf34ed31d856b
diff --git a/src/openhuman/inference/provider/claude_code/event_mapper.rs b/src/openhuman/inference/provider/claude_code/event_mapper.rsindex 51092c87a9..de9efdc3c0 100644--- a/src/openhuman/inference/provider/claude_code/event_mapper.rs+++ b/src/openhuman/inference/provider/claude_code/event_mapper.rs@@ -180,36 +180,20 @@ impl EventMapper {.and_then(Value::as_str).filter(|s| !s.is_empty()).map(str::to_string);- let call_id = block- .get("id")- .and_then(Value::as_str)- .filter(|s| !s.is_empty())- .map(str::to_string);if let Some(name) = tool_name.as_deref() {log::debug!("[claude-code][event-mapper] CLI self-executed tool `{name}` (not surfaced to the harness)");}- if call_id.is_none() || tool_name.is_none() {- log::warn!(- "[claude-code][event-mapper] skipping tool_use block with missing id or name"- );- return Vec::new();- }- let call_id = call_id.unwrap();- let tool_name = tool_name.unwrap();// The block is tracked so its `input_json_delta`s and its stop// event are swallowed rather than leaking, but it is NOT// surfaced to OpenHuman's harness — see the note on// `on_block_stop`.- log::debug!(- "[claude-code][event-mapper] cli-internal tool_use name={tool_name} id={call_id} (not surfaced)"- );self.blocks.insert(index,BlockState {kind: BlockKind::Tool,- tool_name: Some(tool_name),+ tool_name,text_accum: String::new(),},);diff --git a/src/openhuman/inference/provider/claude_code/event_mapper_tests.rs b/src/openhuman/inference/provider/claude_code/event_mapper_tests.rsindex e7918b3fff..6571b9e714 100644--- a/src/openhuman/inference/provider/claude_code/event_mapper_tests.rs+++ b/src/openhuman/inference/provider/claude_code/event_mapper_tests.rs@@ -56,6 +56,27 @@ fn cli_internal_tool_calls_are_not_surfaced_to_the_harness() {);}+#[test]+fn cli_internal_tool_blocks_without_metadata_are_still_suppressed() {+ let mut m = EventMapper::new();+ let start = json!({+ "type": "content_block_start",+ "index": 1,+ "content_block": {"type": "tool_use"}+ });+ let args = json!({+ "type": "content_block_delta",+ "index": 1,+ "delta": {"type": "input_json_delta", "partial_json": "{\"x\":1}"}+ });+ let stop = json!({"type": "content_block_stop", "index": 1});++ assert!(m.handle(ClaudeCodeEvent::StreamEvent { event: start }).is_empty());+ assert!(m.handle(ClaudeCodeEvent::StreamEvent { event: args }).is_empty());+ assert!(m.handle(ClaudeCodeEvent::StreamEvent { event: stop }).is_empty());+ assert!(m.tool_calls.is_empty());+}+/// Text in the same turn still streams normally — dropping the tool block must/// not swallow the CLI's actual answer.#[test]