fix(anomaly): classify [stderr] output as AnomalyOutcome::Error#1474
Merged
fix(anomaly): classify [stderr] output as AnomalyOutcome::Error#1474
Conversation
ShellExecutor prefixes failed command output with [stderr] but the anomaly detector only checked for [error] and [exit code]. The latter pattern was dead code that never matched any executor output. Replace [exit code with [stderr] in the anomaly classification condition in tool_execution.rs and apply the same fix to the audit classification in shell.rs. Add regression tests for both paths.
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.
Fixes #1453.
Changes
crates/zeph-core/src/agent/tool_execution.rs: replace dead-code[exit codepattern with[stderr]in anomaly outcome classification. The[exit codestring was never emitted by any executor;[stderr]is the actual prefix used byShellExecutorfor failed child process output.crates/zeph-tools/src/shell.rs: apply the same fix to audit classification — add|| out.contains("[stderr]")to theAuditResult::Errorbranch.Tests
handle_tool_result_error_prefix_triggers_anomaly_error(was testing dead[exit codepattern, now correctly tests[error])handle_tool_result_stderr_prefix_triggers_anomaly_errorregression teststderr_output_logged_as_audit_errorend-to-end audit test inzeph-toolsTotal: 4901 passed, 0 failed.