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

Function gen_subagent_task

core/tests/test_persisted_schema_roundtrip.rs:321–353  ·  view source on GitHub ↗
(rng: &mut Rng)

Source from the content-addressed store, hash-verified

319}
320
321fn gen_subagent_task(rng: &mut Rng) -> SubagentTaskSnapshot {
322 let status = match rng.below(4) {
323 0 => SubagentStatus::Running,
324 1 => SubagentStatus::Completed,
325 2 => SubagentStatus::Failed,
326 _ => SubagentStatus::Cancelled,
327 };
328 let progress_n = rng.below(3);
329 SubagentTaskSnapshot {
330 task_id: rng.string(),
331 parent_session_id: rng.string(),
332 child_session_id: rng.string(),
333 agent: rng.string(),
334 description: rng.string(),
335 status,
336 started_ms: rng.u64_small(),
337 updated_ms: rng.u64_small(),
338 finished_ms: rng.opt_u64(),
339 output: rng.opt_string(),
340 success: if rng.boolean() {
341 Some(rng.boolean())
342 } else {
343 None
344 },
345 progress: (0..progress_n)
346 .map(|_| SubagentProgressEntry {
347 timestamp_ms: rng.u64_small(),
348 status: rng.string(),
349 metadata: rng.json_value(2),
350 })
351 .collect(),
352 }
353}
354
355/// Cheap-to-construct, representative `AgentEvent`s — including the three
356/// variants added in 3.3.0 (`BudgetThresholdHit`, `PassivationRequested`,

Calls 7

belowMethod · 0.80
stringMethod · 0.80
u64_smallMethod · 0.80
opt_u64Method · 0.80
opt_stringMethod · 0.80
booleanMethod · 0.80
json_valueMethod · 0.80

Tested by

no test coverage detected