Skip to content

Commit 15a931f

Browse files
committed
evals(openshift): Add evals tasks for node_debug_exec tool
1 parent f0e86ac commit 15a931f

11 files changed

Lines changed: 159 additions & 3 deletions

File tree

.github/workflows/mcpchecker.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
workflow_dispatch:
1414
inputs:
1515
suite:
16-
description: 'Which task suite to run (core, helm, kubevirt, kiali, tekton, or all)'
16+
description: 'Which task suite to run (core, helm, kubevirt, kiali, tekton, openshift, or all)'
1717
required: false
1818
default: 'core'
1919
type: choice
@@ -23,6 +23,7 @@ on:
2323
- kubevirt
2424
- kiali
2525
- tekton
26+
- openshift
2627
- all
2728
task-filter:
2829
description: 'Regular expression to filter tasks (optional)'
@@ -111,7 +112,7 @@ jobs:
111112
COMMENT_BODY="${COMMENT_BODY//[[:space:]]/ }"
112113
read -r _ FIRST_WORD _ <<< "$COMMENT_BODY"
113114
case "${FIRST_WORD,,}" in
114-
core|helm|kubevirt|kiali|tekton|all)
115+
core|helm|kubevirt|kiali|tekton|openshift|all)
115116
SUITE="${FIRST_WORD,,}"
116117
;;
117118
esac
@@ -136,9 +137,13 @@ jobs:
136137
echo "label-selector=suite=tekton" >> $GITHUB_OUTPUT
137138
echo "toolsets=core,tekton" >> $GITHUB_OUTPUT
138139
;;
140+
openshift)
141+
echo "label-selector=suite=openshift" >> $GITHUB_OUTPUT
142+
echo "toolsets=core,config,openshift" >> $GITHUB_OUTPUT
143+
;;
139144
all)
140145
echo "label-selector=" >> $GITHUB_OUTPUT # No filter: run all taskSets
141-
echo "toolsets=core,config,helm,kiali,kubevirt,tekton" >> $GITHUB_OUTPUT
146+
echo "toolsets=core,config,helm,kiali,kubevirt,tekton,openshift" >> $GITHUB_OUTPUT
142147
;;
143148
*)
144149
# Default to core suite (matches 'core' or any unrecognized suite)

evals/claude-code/eval.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,13 @@ config:
9292
toolPattern: ".*"
9393
minToolCalls: 1
9494
maxToolCalls: 15
95+
# OpenShift tasks
96+
- glob: ../tasks/openshift/*/*.yaml
97+
labelSelector:
98+
suite: openshift
99+
assertions:
100+
toolsUsed:
101+
- server: kubernetes
102+
toolPattern: ".*"
103+
minToolCalls: 1
104+
maxToolCalls: 20

evals/gemini-agent/eval.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ config:
2626
toolPattern: ".*"
2727
minToolCalls: 1
2828
maxToolCalls: 20
29+
# OpenShift tasks
30+
- glob: ../tasks/openshift/*/*.yaml
31+
labelSelector:
32+
suite: openshift
33+
assertions:
34+
toolsUsed:
35+
- server: kubernetes
36+
toolPattern: ".*"
37+
minToolCalls: 1
38+
maxToolCalls: 20

evals/openai-agent/eval.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,13 @@ config:
9292
toolPattern: ".*"
9393
minToolCalls: 1
9494
maxToolCalls: 15
95+
# OpenShift tasks
96+
- glob: ../tasks/openshift/*/*.yaml
97+
labelSelector:
98+
suite: openshift
99+
assertions:
100+
toolsUsed:
101+
- server: kubernetes
102+
toolPattern: ".*"
103+
minToolCalls: 1
104+
maxToolCalls: 20

evals/tasks/openshift/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OpenShift Task Stack
2+
3+
OpenShift-focused MCP tasks live here. Each folder under this directory is a self-contained scenario that exercises the OpenShift toolset—primarily `nodes_debug_exec` for privileged node-level debugging.
4+
5+
## Prerequisites
6+
7+
- Kubernetes cluster with at least one control-plane node (Kind is used in CI as `mcp-eval-cluster`)
8+
- MCP server running with the `openshift` toolset enabled (`TOOLSETS=core,config,openshift`)
9+
- `read_only = false` and `disable_destructive = false` (the debug tool is destructive and hidden otherwise)
10+
- ServiceAccount permissions: create/delete pods, exec into pods, schedule on nodes, run privileged pods
11+
12+
## Prompt Design
13+
14+
Prompts describe **what to find**, not **how to find it**. They do not name MCP tools, container images, or implementation details such as `/host` mounts or `chroot`. The agent must discover and use the appropriate OpenShift tooling on its own.
15+
16+
Task-level `assertions.toolsUsed` in each `task.yaml` still verify that `nodes_debug_exec` was called for scenarios that require node debug exec.
17+
18+
## Cleanup and Verification
19+
20+
Each task ships with:
21+
22+
- **`cleanup.sh`** — deletes ephemeral debug pods labeled `app.kubernetes.io/component=node-debug`
23+
- **`verify.sh`** — asserts no `node-debug-*` pods remain after the agent completes
24+
25+
Response checks use `verify.contains` in the task YAML (e.g. `"Linux"` or `"hosts"` in the agent reply).
26+
27+
## Registration and CI
28+
29+
Tasks are discovered automatically when `metadata.labels.suite` is `openshift`. They are registered in:
30+
31+
- `evals/openai-agent/eval.yaml`
32+
- `evals/claude-code/eval.yaml`
33+
- `evals/gemini-agent/eval.yaml`
34+
35+
CI runs the suite via the mcpchecker workflow (`openshift` option or `/run-mcpchecker openshift` on PRs) with `toolsets=core,config,openshift`.
36+
37+
## Running Locally
38+
39+
```bash
40+
make run-server TOOLSETS=core,config,openshift
41+
make run-evals EVAL_CONFIG=evals/openai-agent/eval.yaml EVAL_LABEL_SELECTOR=suite=openshift
42+
43+
# Single task:
44+
mcpchecker check evals/openai-agent/eval.yaml --run "check-node-kernel"
45+
```
46+
47+
## Adding a New Task
48+
49+
1. Create a new subdirectory (e.g., `my-scenario/`) with `task.yaml` and optional `setup.sh`, `verify.sh`, and `cleanup.sh`.
50+
2. Set `metadata.labels.suite: openshift` so the task is picked up by the openshift taskSet.
51+
3. Write a goal-only prompt; pin `nodes_debug_exec` in task-level `assertions.toolsUsed` when the scenario requires it.
52+
4. Provide `cleanup.sh` (and preferably `verify.sh`) to ensure ephemeral debug pods are removed.
53+
54+
## Tasks
55+
56+
| Task | Difficulty | Prompt | Verification |
57+
|------|------------|--------|--------------|
58+
| **check-node-kernel** | easy | What is the kernel version running on the control-plane node? | Response contains `Linux`; no leftover debug pods |
59+
| **list-host-etc** | medium | On the control-plane node, list the contents of `/etc` and report what you find. | Response contains `hosts`; no leftover debug pods |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
kubectl delete pods -A -l app.kubernetes.io/component=node-debug --ignore-not-found --wait=false
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
kind: Task
2+
metadata:
3+
labels:
4+
suite: openshift
5+
name: check-node-kernel
6+
difficulty: easy
7+
steps:
8+
prompt:
9+
inline: What is the kernel version running on the control-plane node?
10+
verify:
11+
contains: "Linux"
12+
file: verify.sh
13+
cleanup:
14+
file: cleanup.sh
15+
assertions:
16+
toolsUsed:
17+
- server: kubernetes
18+
toolPattern: "nodes_debug_exec"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
remaining=$(kubectl get pods -A -l app.kubernetes.io/component=node-debug --no-headers 2>/dev/null | wc -l | tr -d ' ')
5+
if [ "${remaining}" -gt 0 ]; then
6+
echo "Found leftover node-debug pods:"
7+
kubectl get pods -A -l app.kubernetes.io/component=node-debug
8+
exit 1
9+
fi
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
kubectl delete pods -A -l app.kubernetes.io/component=node-debug --ignore-not-found --wait=false
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
kind: Task
2+
metadata:
3+
labels:
4+
suite: openshift
5+
name: list-host-etc
6+
difficulty: medium
7+
steps:
8+
prompt:
9+
inline: "On the control-plane node, list the contents of /etc and report what you find."
10+
verify:
11+
contains: "hosts"
12+
file: verify.sh
13+
cleanup:
14+
file: cleanup.sh
15+
assertions:
16+
toolsUsed:
17+
- server: kubernetes
18+
toolPattern: "nodes_debug_exec"

0 commit comments

Comments
 (0)