Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update issue
Signed-off-by: Rohit Patil <[email protected]>
  • Loading branch information
ropatil010 committed Nov 5, 2025
commit afb7d6382b6ec37810314028c374d90b18635722
9 changes: 5 additions & 4 deletions pkg/promptsets/core/health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ func initHealthCheckPrompts(o internalk8s.Openshift) []api.ServerPrompt {

func buildHealthCheckPromptMessages(verbose bool, namespace string) []api.PromptMessage {
scopeMsg := "across all namespaces"
namespaceFilter := ""
podListInstruction := "- Use pods_list to get all pods"

if namespace != "" {
scopeMsg = fmt.Sprintf("in namespace '%s'", namespace)
namespaceFilter = fmt.Sprintf(" in namespace '%s'", namespace)
podListInstruction = fmt.Sprintf("- Use pods_list_in_namespace with namespace parameter set to '%s' to get all pods in namespace '%s'", namespace, namespace)
}

verboseMsg := ""
Expand Down Expand Up @@ -77,7 +78,7 @@ Follow these steps systematically:
- Count total nodes and categorize issues

## 3. Check Pod Health
- Use pods_list to get all pods%s
%s
- Identify problematic pods:
* Phase = Failed or Pending (CRITICAL)
* Container state waiting with reason:
Expand Down Expand Up @@ -161,7 +162,7 @@ Warnings: [count]
- Be efficient: don't call the same tool multiple times unnecessarily
- If a resource type doesn't exist (e.g., ClusterOperator on vanilla K8s), skip it gracefully
- Provide clear, actionable insights in your summary
- Use emojis for visual clarity: ✅ (healthy), ⚠️ (warning), ❌ (critical)`, scopeMsg, namespaceFilter, verboseMsg)
- Use emojis for visual clarity: ✅ (healthy), ⚠️ (warning), ❌ (critical)`, scopeMsg, podListInstruction, verboseMsg)

assistantMessage := `I'll perform a comprehensive cluster health check following the systematic approach outlined. Let me start by gathering information about the cluster components.`

Expand Down
6 changes: 4 additions & 2 deletions pkg/promptsets/core/health_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func TestBuildHealthCheckPromptMessages(t *testing.T) {
// Check user message content
userContent := messages[0].Content
assert.Contains(t, userContent, "across all namespaces")
assert.Contains(t, userContent, "pods_list")
assert.Contains(t, userContent, "Use pods_list to get all pods")
assert.Contains(t, userContent, "resources_list")
assert.Contains(t, userContent, "events_list")
assert.NotContains(t, userContent, "pods_list_in_all_namespaces")
assert.NotContains(t, userContent, "pods_list_in_namespace")

// Check assistant message
assert.Contains(t, messages[1].Content, "comprehensive cluster health check")
Expand All @@ -58,6 +58,8 @@ func TestBuildHealthCheckPromptMessages(t *testing.T) {
userContent := messages[0].Content
assert.Contains(t, userContent, "in namespace 'test-namespace'")
assert.NotContains(t, userContent, "across all namespaces")
assert.Contains(t, userContent, "Use pods_list_in_namespace with namespace parameter set to 'test-namespace'")
assert.NotContains(t, userContent, "Use pods_list to get all pods")
})

t.Run("Messages with verbose mode", func(t *testing.T) {
Expand Down