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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/ironclaw_agent_loop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async-trait = "0.1"
blake3 = "1"
ironclaw_common = { path = "../ironclaw_common", version = "0.4.2" }
ironclaw_host_api = { path = "../ironclaw_host_api", version = "0.1.0" }
ironclaw_observability = { path = "../ironclaw_observability" }
ironclaw_turns = { path = "../ironclaw_turns", version = "0.1.0" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
10 changes: 10 additions & 0 deletions crates/ironclaw_agent_loop/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod checkpoint;
mod exit_helpers;
mod gates;
mod input;
mod latency;
mod loop_exit;
mod mapping;
mod model;
Expand Down Expand Up @@ -190,6 +191,15 @@ enum TurnCompletedStep {
Exit(LoopExit),
}

impl TurnCompletedStep {
fn iteration_or(&self, fallback: u32) -> u32 {
match self {
Self::Continue { state, .. } => state.iteration,
Self::Exit(_) => fallback,
}
}
}
Comment on lines +194 to +201

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Don't synthesize iteration 0 for TurnCompletedStep::Exit.

Line 198 forces Exit(_) to 0, but canonical.rs uses completed.iteration() to label post_capability and post_capability_resume. Any exit coming out of assistant_reply or capabilities will therefore be traced under iteration 0 instead of the live loop iteration. Carry the caller's current iteration through that trace boundary instead of encoding a sentinel here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/ironclaw_agent_loop/src/executor.rs` around lines 194 - 201, The
TurnCompletedStep::iteration helper is synthesizing a sentinel 0 for Exit, which
causes canonical.rs tracing to lose the live loop iteration when labeling
post_capability and post_capability_resume. Update TurnCompletedStep::iteration
and the callers around assistant_reply/capabilities so Exit carries or preserves
the current iteration from the caller/state instead of returning 0, and use that
value when emitting the trace boundary.


#[derive(Debug, Default)]
struct PendingInputAck {
tokens: Vec<LoopInputAckToken>,
Expand Down
Loading
Loading