explain-error-plugin
explain-error-plugin copied to clipboard
feat: add Pipeline Graph View integration for AI Explain
Summary
Adds an Explain Error button to the Pipeline Graph View page that appears when a user selects a failed node. The feature reuses the existing ErrorExplanationAction caching mechanism — showing a cached explanation when available, generating a new AI explanation otherwise.
Changes
New files
| File | Description |
|---|---|
GraphViewExplainErrorAction.java |
RunAction2 providing AJAX endpoints: doCheckBuildStatus, doCheckNodeStatus, doExplainNodeError |
GraphViewExplainErrorActionFactory.java |
TransientActionFactory that injects the action into all runs (only when pipeline-graph-view is installed) |
PipelineGraphViewDecorator.java |
PageDecorator that injects JS/CSS into the */stages page |
explain-error-graph-view.js |
Frontend logic: monitors ?selected-node= URL parameter changes, shows/hides the Explain button based on node failure status, displays explanation panel with regenerate/close controls |
GraphViewExplainErrorActionTest.java |
13 unit tests covering build status, node status queries, cache hits, force-new generation |
Modified files
| File | Change |
|---|---|
PipelineLogExtractor.java |
Added extractNodeLog(String nodeId) method to extract log output from a specific flow node by its ID |
Behavior
-
Button placement: The button is injected into the top-right action bar (next to Run/Replay buttons) on the Pipeline Graph View (
*/stages) page. -
Activation logic:
- The build must have completed with a non-SUCCESS result.
- Only when the user clicks a failed node (one with
ErrorActionor a descendant withErrorAction) does the button become visible. - Clicking a green (successful) node hides the button.
-
Caching: Same as the existing Console integration:
- If an
ErrorExplanationActionexists for the run, it is returned directly (with a "previously generated" note). forceNew=truetriggers a fresh AI call.- The "View failure output" link deep-links to the selected node in the graph view.
- If an
-
Graceful degradation: When
pipeline-graph-viewis not installed, no action is injected and no JS is loaded.
Testing
Tests run: 13, Failures: 0, Errors: 0, Skipped: 0
Full mvn verify passes with zero SpotBugs errors.