pub fn execute_with_telemetry(
capability: &dyn Capability,
args: &Value,
dry_run: bool,
wal_path: &Path,
) -> Result<ExecutionResult>Expand description
Execute a capability with full telemetry, resource guarding, and WAL logging.
§Execution Flow
- Capture hardware telemetry and process snapshot (before)
- Check resource limits via
LlmoSafeGuard(circuit breaker at 80%) - Check zombie count (reject if > 10)
- Check args size (reject if > 1MB)
- Log
JobStartedevent to WAL - Validate arguments against capability schema
- Execute the capability
- Capture hardware telemetry and process snapshot (after)
- Identify spawned PIDs
- Log
JobCompletedorJobFailedevent to WAL
§Arguments
capability— The capability to execute (any type implementingCapability)args— JSON arguments for the capabilitydry_run— If true, the capability may skip side effectswal_path— Path to the WAL file (appended to)
§Returns
An ExecutionResult with before/after snapshots and the capability output.
Even on validation or execution failure, returns Ok with success: false
so the caller can inspect telemetry deltas.
§Errors
Returns Error::ResourceLimitExceeded if the LlmoSafeGuard circuit breaker
trips, zombie count exceeds 10, or args exceed 1MB. WAL write failures also
propagate as errors.
§Timeout Limitation
The timeout_secs parameter is currently not enforced. Rust’s
std::thread cannot be interrupted once started. A true timeout requires
either subprocess isolation or tokio::spawn_blocking with cancellation.
This is tracked for v0.2.0 (see FINDING #17 in module docs).