-
Notifications
You must be signed in to change notification settings - Fork 25
feat(playbooks): add AI diagnose failure button for failed playbook runs #2849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis change introduces AI-powered diagnostic capabilities for failed playbook runs. It includes a new DiagnosePlaybookFailureButton component with feature-flag gating, renaming PlaybookRunsActions to PlaybookRunDetailView, and enhancing the AI chat infrastructure to support initial prompts that auto-send on open. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant DFB as DiagnosePlaybookFailureButton
participant ACP as AiChatPopover Context
participant AChat as AIChat Component
participant API as AI API
User->>DFB: Click "Diagnose Failure"
DFB->>DFB: Aggregate playbook run data<br/>(status, error, duration, etc.)
DFB->>DFB: Format diagnostic message<br/>with truncation
DFB->>ACP: setInitialPrompt("Why did this<br/>playbook fail?")
DFB->>ACP: Push diagnostic message to chat
DFB->>ACP: Open popover
ACP->>AChat: Provide initialPrompt & chat context
AChat->>AChat: useEffect detects ready status<br/>with initialPrompt
AChat->>API: Auto-send initial prompt<br/>(once per open)
API-->>AChat: Response
AChat-->>User: Display diagnostic result
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |
fbfa0d3 to
e856356
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@src/components/Playbooks/Runs/Actions/__tests__/PlaybookRunsAction.unit.test.tsx`:
- Around line 183-189: The failing test throws "useAiFeatureLoader must be used
within AiFeatureLoaderProvider" because PlaybookRunDetailView (rendered in
PlaybookRunsAction.unit.test.tsx) triggers the AiFeatureRequest →
useAiFeatureLoader() path; fix by either wrapping the rendered component with
AiFeatureLoaderProvider (and FeatureFlagsContextProvider) in the test's render
tree or by mocking the feature-flag hook so AI is disabled; specifically update
the test to provide AiFeatureLoaderProvider/FeatureFlagsContextProvider around
<PlaybookRunDetailView data={mockData} /> or mock useAiFeatureLoader /
feature-flags to return isAiDisabled: true to avoid invoking AiFeatureRequest.
src/components/Playbooks/Runs/Actions/__tests__/PlaybookRunsAction.unit.test.tsx
Show resolved
Hide resolved
|
@adityathebe make the button size consistent with rerun playbook |
Add a 'Diagnose Failure' button that opens the navbar AI chat popover pre-populated with playbook run context (spec, actions, errors) for interactive failure diagnosis. - New DiagnosePlaybookFailureButton component with client-side context - Lazy-loaded behind AI feature flag, only rendered for failed runs - Rename PlaybookRunsActions to PlaybookRunDetailView
Add ref guard to AIChat's initialPrompt effect so it fires exactly once instead of re-triggering every time status cycles back to 'ready'. Update DiagnosePlaybookFailureButton to use setInitialPrompt for auto-sending 'Why did this playbook fail?' and change quick prompts to follow-up questions only.
… JSON context - Pass entire PlaybookRunWithActions JSON to LLM instead of selective formatting - Add detailed system prompt explaining playbooks, actions, and diagnosis approach - Remove complex manual formatting and truncation logic - Simplify code by passing raw JSON data
55f8f52 to
6fb33bb
Compare
Adds a Diagnose Failure button to the playbook run detail page when a run has failed.
resolves: flanksource/mission-control#2744