feat: add evidence-backed log explanations - #20
Merged
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe analyzer now records evidence for detected anomalies and detailed error-rate spikes. A new reasoning module generates non-causal explanations. The CLI exposes these explanations through ChangesEvidence-backed explanations
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant Analyzer
participant Reasoning
CLI->>Analyzer: Analyze log entries
Analyzer-->>CLI: Return anomaly report and spike details
CLI->>Reasoning: Generate explanations
Reasoning-->>CLI: Return evidence explanations
CLI-->>CLI: Render explanations when --explain is enabled
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CoreyLeath-code
marked this pull request as ready for review
August 9, 2026 18:22
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
Adds an opt-in, evidence-backed explanation layer to LogSight's existing deterministic analysis. The CLI can now render why a finding was raised while preserving existing output and behavior when
--explainis not supplied.Architecture Changes
Files Changed
logsight/analyzer.py— adds backwards-compatible evidence and spike-detail models while preservingerror_rate_spike()'s return contract.logsight/reasoning.py— adds deterministic, evidence-only explanation rendering data.logsight/cli.py— adds opt-in--explaintoanalyzeandstdin; escapes displayed log content.tests/test_analyzer.py— verifies recorded error, outlier, and spike evidence.tests/test_reasoning.py— verifies direct/statistical explanations and no-finding behavior.tests/test_cli.py— verifies the CLI explanation output uses detector evidence across terminal line wrapping.README.md— documents scope, constraints, and reproducible commands for the feature.Validation Performed
GitHub Actions run CI #100 and CodeQL #37 completed successfully on the PR merge commit.
All files formatted.All checks passed!Success: no issues found in 5 source files57 passed in 2.19s94.88%total; configured 90% gate reachedpackage-and-containercompleted successfullysecuritybenchmarkcompleted successfullyCommands and Real Output
Risks
--explain.Follow-up Recommendations
NEEDS HUMAN DECISION
None.
Summary by CodeRabbit
New Features
--explainflag for file and standard-input analysis.Bug Fixes
Documentation