-
Notifications
You must be signed in to change notification settings - Fork 2
feat(reliability): wire FaultCategory enum path in native.rs Err branch for skill evolution #2224
Description
Context
PR for #2207/#2206 added From<FaultCategory> for FailureKind mapping (executor.rs → evolution.rs) but the enum-based path is not yet wired at the call sites. All 3 call sites still use FailureKind::from_error() string heuristic:
native.rs:1379:FailureKind::from_error(&output)legacy.rs:560:FailureKind::from_error(&err_str)legacy.rs:603:FailureKind::from_error(&output.summary)
Problem
In native.rs Err branch (lines 1325-1349), e: ToolError goes out of scope before the skill outcome recording at line 1379. The precise enum-based FaultCategory classification is lost — the heuristic then re-parses the formatted corrective signal text to recover the same information.
Fix
In the Err(e) arm of native.rs (around line 1349), capture e.fault_category() before e is consumed by to_corrective_signal() or Display, then pass FailureKind::from(fault_category) to the skill outcome recording at line 1379.
Same fix applicable to legacy.rs if ToolError is accessible there.
Impact
Enables precise, enum-based skill evolution signal for classified tool failures — PolicyBlocked → WrongApproach, InvalidArguments → BadInput, etc. — instead of relying on keyword matching in the formatted signal text.
References
- Closes prerequisite from research(reliability): L-ICL — pinpoint correction at failing step prevents context corruption from tool errors (arXiv:2602.00276) #2207/research(reliability): Characterizing Faults in Agentic AI — empirical taxonomy of 385 faults across 40 OSS agent repos (arXiv:2603.06847) #2206 PR
From<FaultCategory> for FailureKindimpl:crates/zeph-skills/src/evolution.rs