MCPcopy Create free account
hub / github.com/AI45Lab/Code / heartbeat_payload_includes_runtime_counters

Function heartbeat_payload_includes_runtime_counters

core/src/ahp/executor_tests.rs:263–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

261
262#[test]
263fn heartbeat_payload_includes_runtime_counters() {
264 let executor = make_test_executor();
265 executor.runtime_state.observe_agent_event(
266 &AgentEvent::ToolStart {
267 id: "tool-1".to_string(),
268 name: "bash".to_string(),
269 },
270 "run-1",
271 );
272 executor.runtime_state.observe_agent_event(
273 &AgentEvent::TurnEnd {
274 turn: 1,
275 usage: usage(42),
276 },
277 "run-1",
278 );
279
280 let heartbeat = executor.heartbeat_payload();
281 assert_eq!(heartbeat.active_tools, Some(1));
282 assert_eq!(heartbeat.pending_actions, Some(0));
283 assert_eq!(heartbeat.queue_depth, Some(0));
284 assert_eq!(heartbeat.tokens_used, Some(42));
285 assert_eq!(heartbeat.current_state, "running_tools");
286}
287
288#[test]
289fn test_map_pre_tool_use() {

Callers

nothing calls this directly

Calls 4

make_test_executorFunction · 0.85
observe_agent_eventMethod · 0.80
heartbeat_payloadMethod · 0.80
usageFunction · 0.70

Tested by

no test coverage detected