Skip to content
Merged
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
6 changes: 5 additions & 1 deletion crates/ironclaw_engine/orchestrator/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ def run_loop(context, goal, actions, state, config):
output = r.get("output")
output_str = str(output) if output is not None else "[no output]"
if r.get("is_error"):
output_str = "[ACTION FAILED] " + output_str
output_str = "[ACTION FAILED] " + action_name + ": " + output_str
batch_error_count += 1
else:
batch_success_count += 1
Expand All @@ -757,6 +757,10 @@ def run_loop(context, goal, actions, state, config):
action_call_id=call_id,
)

# TODO(#2325): track consecutive action errors here, mirroring the
# code error tracking above (lines 623-634). Needs a unified
# progress-tracking design across both execution paths.

# Check results for auth/approval interrupts
for r_idx, r in enumerate(results):
if r is None:
Expand Down
36 changes: 36 additions & 0 deletions crates/ironclaw_engine/src/executor/loop_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,42 @@ mod tests {
}
}

#[tokio::test]
async fn failed_action_result_is_explicit_in_next_llm_message() {
let (mut exec, _tx) = make_loop(
vec![
action_response("test_tool", "call_failed_tool"),
text_response("I could not complete that."),
],
vec![Ok(ActionResult {
call_id: String::new(),
action_name: "test_tool".into(),
output: serde_json::json!({"error": "No lease for action 'test_tool'"}),
is_error: true,
duration: Duration::from_millis(1),
})],
ThreadConfig::default(),
)
.await;

exec.run().await.unwrap();

let action_results: Vec<_> = exec
.thread
.internal_messages
.iter()
.filter(|m| m.role == crate::types::message::MessageRole::ActionResult)
.collect();

assert!(
action_results.iter().any(|m| {
m.content.contains("[ACTION FAILED] test_tool:")
&& m.content.contains("No lease for action 'test_tool'")
}),
"failed ActionResult content should be explicit for the next LLM turn"
);
}

/// Verify the trace analyzer does NOT flag any issues on a clean
/// action execution (no empty call_ids).
#[tokio::test]
Expand Down
Loading