feat(tools): shell exit-code taxonomy and FailureKind integration#2226
Merged
feat(tools): shell exit-code taxonomy and FailureKind integration#2226
Conversation
a73a147 to
8adeeb9
Compare
, #2206) Complements #2214 (ToolErrorCategory + ToolErrorFeedback) with two gaps that remained after that PR: **Shell executor exit-code classification** ShellExecutor now returns `ToolError::Shell { exit_code, category, message }` for well-known failure modes instead of embedding errors in the output string: - exit 126 (permission denied) → ToolErrorCategory::PolicyBlocked - exit 127 (command not found) → ToolErrorCategory::PermanentFailure - stderr containing "permission denied" → PolicyBlocked - stderr containing "no such file or directory" → PermanentFailure These errors flow through the existing `ToolErrorFeedback.format_for_llm()` injection in native.rs, producing structured `[tool_error]` blocks for the LLM. **Skill evolution FailureKind integration** `From<ToolErrorCategory> for FailureKind` maps the taxonomy to skill evolution signals: PolicyBlocked/ConfirmationRequired/ToolNotFound → WrongApproach, InvalidParameters/TypeMismatch → SyntaxError, Timeout → Timeout, infrastructure errors (RateLimited, ServerError, NetworkError, PermanentFailure, Cancelled) → Unknown. Eliminates string heuristic for classified tool failures. Closes #2207, closes #2206.
8adeeb9 to
e051c9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complements #2214 (ToolErrorCategory + ToolErrorFeedback) with two gaps that remained after that PR:
ShellExecutornow returnsToolError::Shell { exit_code, category, message }for well-known failure modes instead of embedding errors in the output string. Flows through existingToolErrorFeedback.format_for_llm()injection innative.rs.From<ToolErrorCategory> for FailureKindmaps the taxonomy to skill evolution signals, replacing the string heuristic for classified tool failures.Changes
crates/zeph-tools/src/executor.rs:ToolError::Shell { exit_code, category, message }variant;category()delegates to stored categorycrates/zeph-tools/src/shell/mod.rs:classify_shell_exit()function;emit_completed()helper;execute_blockreturnsErr(ToolError::Shell)for exit 126/127 and stderr patternscrates/zeph-skills/src/evolution.rs:From<ToolErrorCategory> for FailureKind— PolicyBlocked/ConfirmationRequired/ToolNotFound → WrongApproach, InvalidParameters/TypeMismatch → SyntaxError, Timeout → Timeout, infrastructure → UnknownShell exit classifications
PolicyBlockedPermanentFailurePolicyBlockedPermanentFailureTest plan
--features full)cargo +nightly fmt --checkcleancargo clippyclean on changed cratesclassify_shell_exit: exit 126, 127, stderr patterns, exit 0 → None, generic exit 1 → NoneToolError::Shell.category(): PolicyBlocked, PermanentFailure, not quality failureFrom<ToolErrorCategory> for FailureKind: all 11 variants testedCloses #2207, closes #2206.