Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(agent): add AgentProgress::turn_completed constructor

Steven Enamakel3b5782c18703
diff --git a/crates/openhuman-core/src/agent/progress.rs b/crates/openhuman-core/src/agent/progress.rs
index 0581a2eea4..b96b04407e 100644
--- a/crates/openhuman-core/src/agent/progress.rs
+++ b/crates/openhuman-core/src/agent/progress.rs
@@ -437,3 +437,14 @@ pub enum AgentProgress {
output: Option<String>,
},
}
+
+impl AgentProgress {
+ /// A [`Self::TurnCompleted`] for a turn that finished on its own (no
+ /// early stop).
+ pub fn turn_completed(iterations: u32) -> Self {
+ Self::TurnCompleted {
+ iterations,
+ stop: None,
+ }
+ }
+}
diff --git a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
index 86469cbf03..9ae74e4e4b 100644
--- a/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
+++ b/crates/openhuman-core/src/web_chat/progress_bridge_tests.rs
@@ -275,12 +275,7 @@ async fn stops_heartbeat_after_turn_completed() {
}
// Complete the turn, then drop the sender so the bridge loop breaks.
- tx.send(AgentProgress::TurnCompleted {
- iterations: 1,
- stop: None,
- })
- .await
- .unwrap();
+ tx.send(AgentProgress::turn_completed(1)).await.unwrap();
drop(tx);
// Let the bridge process TurnCompleted + observe the closed channel.
@@ -442,12 +437,7 @@ async fn wait_drained_returns_after_queued_events_are_forwarded() {
})
.await
.unwrap();
- tx.send(AgentProgress::TurnCompleted {
- iterations: 1,
- stop: None,
- })
- .await
- .unwrap();
+ tx.send(AgentProgress::turn_completed(1)).await.unwrap();
// The sender stays alive (as a detached sub-agent's clone would), so the
// drain must come from `TurnCompleted`, not from the channel closing.
diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjs
index 5c3e03f61a..72c437f51c 100644
--- a/scripts/ci/check-openhuman-rust-layout.mjs
+++ b/scripts/ci/check-openhuman-rust-layout.mjs
@@ -25,13 +25,14 @@ const LEGACY_LIMIT_ENTRIES = [
// runtime compatibility work. They are being split along semantic seams.
// `spawn_async_subagent_execute.rs`: 847 -> 821 when the argument prologue
// moved to `spawn_async_subagent_args.rs`, 821 -> 809 via
- // `AbortReport::deliver`, 809 -> 795 via `CompletionTarget`. Still exempt because the rest of that function's
+ // `AbortReport::deliver`, 809 -> 795 via `CompletionTarget`, 795 -> 791 when
+ // the detached-usage comments were reflowed. Still exempt because the rest of that function's
// phases close over locals whose types are not nameable from this module
// (see that fragment's header); taking it under 750 needs a visibility
// change in `subagent_sessions`.
[
"crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs",
- 795,
+ 791,
],
// `spawn_subagent_tool_impl.rs` had its entry DELETED, not lowered: the
// parameter schema moved to `spawn_subagent_parameters.rs` and the file is