Skip to content

fix: detect eval orchestrator exiting without producing results#82091

Open
theobarberbany wants to merge 1 commit into
openshift:mainfrom
theobarberbany:fix-eval-false-green
Open

fix: detect eval orchestrator exiting without producing results#82091
theobarberbany wants to merge 1 commit into
openshift:mainfrom
theobarberbany:fix-eval-false-green

Conversation

@theobarberbany

@theobarberbany theobarberbany commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a post-execution check to openshift-claude-agent-eval-commands.sh that verifies run_result.json exists before writing a passing JUnit
  • Guards against the eval harness orchestrator launching execute.py in background, exiting cleanly, and the background task being killed — producing a false green

Context

Observed on openshift-eng/ai-helpers#627. The eval-payload-analysis-changed job reported green but no eval cases actually completed — eval-runs.tar contained only the empty directory structure (348 bytes, no run_result.json, no summary.yaml).

The orchestrator used run_in_background: true for execute.py, said "I'll wait for results," then ended its session. The background task was killed and commands.sh saw exit 0 from claude and wrote a passing JUnit.

This is a safety net — the root cause (orchestrator backgrounding execution) should also be fixed in the eval harness.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Updates the OpenShift Claude agent evaluation CI step to verify that run_result.json is produced after evaluation.
  • Marks the evaluation as failed when the orchestrator exits successfully without generating results, preventing false-green JUnit outcomes.
  • The underlying orchestrator behavior remains a separate follow-up issue.

The eval harness orchestrator can launch execute.py in background and
then exit cleanly, causing the background task to be killed. The
commands.sh script only checks the claude CLI exit code, so this
produces a false green JUnit.

Add a post-execution check that run_result.json exists before
declaring success.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The agent evaluation command now verifies that a successful eval-run produces a run_result.json. Missing results generate an error and change the exit status to ensure subsequent reporting and failure handling detect the incomplete run.

Changes

Agent evaluation validation

Layer / File(s) Summary
Post-eval result validation
ci-operator/step-registry/openshift/claude/agent-eval/openshift-claude-agent-eval-commands.sh
After a successful eval-run, the script searches the configured runs directory for run_result.json and sets EVAL_EXIT to 1 when none is found.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: amisstea

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR only changes a shell script; no Ginkgo test titles or specs were added or edited, so the check is not applicable.
Test Structure And Quality ✅ Passed PASS: This PR only changes a shell step script; there are no Ginkgo It blocks, setup/cleanup, or Eventually assertions to review.
Microshift Test Compatibility ✅ Passed PR only changes a shell script guard in ci-operator; no Ginkgo tests or MicroShift-sensitive APIs/features were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only a shell script changed; no Ginkgo e2e tests were added, so the SNO compatibility check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The change is only a shell post-execution result check in an eval script; it adds no pod scheduling, topology, affinity, or node-selection logic.
Ote Binary Stdout Contract ✅ Passed PASS: The PR only changes a Bash step-registry script; no Go main/init/TestMain or suite-setup stdout writes were introduced, so the OTE JSON stdout contract isn't implicated.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR only updates a shell eval harness script; no new Ginkgo tests or IPv4/external-network assumptions were introduced.
No-Weak-Crypto ✅ Passed The only changed logic is a result-file existence check; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons appear in the patch.
Container-Privileges ✅ Passed PASS: The PR only updates a shell script; no container/K8s manifests were changed, and no privileged/host* or allowPrivilegeEscalation settings were introduced.
No-Sensitive-Data-In-Logs ✅ Passed New log lines are generic error/status messages; they don’t print secrets, PII, or tokens, and the token-related log only notes loading success.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: detecting when the eval orchestrator exits without producing results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: theobarberbany
Once this PR has been reviewed and has the lgtm label, please assign bryan-cox for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
openshift-ci Bot requested review from bentito and cblecker July 17, 2026 16:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@ci-operator/step-registry/openshift/claude/agent-eval/openshift-claude-agent-eval-commands.sh`:
- Line 170: Update the RESULT_FILES assignment in the step script to avoid
piping find into head under pipefail. Use find with -type f, the run_result.json
name filter, -print, and -quit so only the first matching file is returned
without risking SIGPIPE or preventing EVAL_EXIT from being updated.
- Around line 168-170: Scope the result lookup in the EVAL_EXIT success path to
the current evaluation run instead of searching the shared RUNS_DIR recursively.
Use the current run’s output directory or clear RUNS_DIR before /eval-run, then
require that a newly created run_result.json exists before treating the run as
successful.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 1a8fa628-6007-4977-847c-b44702f59495

📥 Commits

Reviewing files that changed from the base of the PR and between 18cd65f and 437fb2e.

📒 Files selected for processing (1)
  • ci-operator/step-registry/openshift/claude/agent-eval/openshift-claude-agent-eval-commands.sh

Comment on lines +168 to +170
RUNS_DIR="${AGENT_EVAL_RUNS_DIR:-eval/runs}"
if [[ "${EVAL_EXIT}" -eq 0 ]]; then
RESULT_FILES=$(find "${RUNS_DIR}" -name "run_result.json" 2>/dev/null | head -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C 4 'AGENT_EVAL_RUNS_DIR|run_result\.json|eval-run|rm -rf' --glob '*.sh' .

Repository: openshift/release

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file='ci-operator/step-registry/openshift/claude/agent-eval/openshift-claude-agent-eval-commands.sh'

echo '=== outline ==='
ast-grep outline "$file" --view expanded

echo
echo '=== relevant ranges ==='
sed -n '1,220p' "$file" | cat -n

Repository: openshift/release

Length of output: 9981


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 3 'run_result\.json|run-id|AGENT_EVAL_RUNS_DIR|eval/runs|/eval-run' \
  ci-operator/step-registry/openshift/claude/agent-eval \
  ci-operator/step-registry -g '*.sh' -g '*.md' -g '*.yaml' -g '*.yml'

Repository: openshift/release

Length of output: 20719


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== AGENT_EVAL_RUNS_DIR references ==='
rg -n 'AGENT_EVAL_RUNS_DIR|run_result\.json|eval/runs|rm -rf .*eval/runs|mkdir -p .*eval/runs|rmdir .*eval/runs' ci-operator/step-registry/openshift/claude/agent-eval -g '*.sh' -g '*.yaml' -g '*.yml' -g '*.md'

echo
echo '=== other run_result.json uses in step-registry ==='
rg -n 'run_result\.json' ci-operator/step-registry -g '*.sh' -g '*.yaml' -g '*.yml' -g '*.md'

Repository: openshift/release

Length of output: 1672


🌐 Web query:

agent-eval-harness run_result.json run-id output directory eval-runs

💡 Result:

The term agent-eval-harness refers to a category of tools used to evaluate AI agents rather than a single, universally standardized piece of software [1][2][3]. Multiple projects use this or similar names, and they differ significantly in their CLI arguments and output structures [4][5][3]. Based on common conventions and documentation for these frameworks, here is how the specified components are typically handled: 1. run_result.json: This is generally the filename used for the final aggregated results of an evaluation run [4][6][5]. It contains structured data such as overall metrics, pass rates, latency, and costs [4][6]. 2. run-id: This is a unique identifier used to label a specific evaluation execution [4][5]. It is often used to organize output directories and filenames, allowing users to track experiments over time [4][5]. 3. output directory: This is the destination path (often defaulting to a folder like./results or./eval-runs) where the framework saves the artifacts of a run, including logs and the final run_result.json [4][7][5]. 4. eval-runs: This is commonly used as a parent directory name for storing multiple evaluation results [5]. For example, in many frameworks, you might run an evaluation using commands similar to these: # Example of running an evaluation with a custom output directory and run ID harness run --output./eval-runs --run-id my-experiment-001 After execution, the tool would typically generate a result file located at:./eval-runs/my-experiment-001/run_result.json Because there are multiple projects (such as reaatech/agent-eval-harness, najeed/ai-agent-eval-harness, and others), you should verify the specific CLI documentation of the version you are using, as flags (e.g., --run-id vs --id) and default paths may vary [4][7][5][2].

Citations:


Scope the result check to the current run. At lines 168-170, find "${RUNS_DIR}" -name "run_result.json" can match a stale file from an earlier execution in the shared eval/runs tree and let an incomplete run pass. Use the current run’s output path, or clear RUNS_DIR before /eval-run and require a newly created result.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/openshift/claude/agent-eval/openshift-claude-agent-eval-commands.sh`
around lines 168 - 170, Scope the result lookup in the EVAL_EXIT success path to
the current evaluation run instead of searching the shared RUNS_DIR recursively.
Use the current run’s output directory or clear RUNS_DIR before /eval-run, then
require that a newly created run_result.json exists before treating the run as
successful.

# -----------------------------------------------------------------------
RUNS_DIR="${AGENT_EVAL_RUNS_DIR:-eval/runs}"
if [[ "${EVAL_EXIT}" -eq 0 ]]; then
RESULT_FILES=$(find "${RUNS_DIR}" -name "run_result.json" 2>/dev/null | head -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Avoid piping find into head under pipefail.

If this script uses the required set -euo pipefail, find can receive SIGPIPE after head consumes the first match, causing the step to exit before EVAL_EXIT is updated. Use find "${RUNS_DIR}" -type f -name "run_result.json" -print -quit instead.

As per coding guidelines, step-registry scripts should default to set -euo pipefail, so this pipeline must be safe under that contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/step-registry/openshift/claude/agent-eval/openshift-claude-agent-eval-commands.sh`
at line 170, Update the RESULT_FILES assignment in the step script to avoid
piping find into head under pipefail. Use find with -type f, the run_result.json
name filter, -print, and -quit so only the first matching file is returned
without risking SIGPIPE or preventing EVAL_EXIT from being updated.

Source: Coding guidelines

@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@theobarberbany: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@stbenjam

Copy link
Copy Markdown
Member

Are we tracking this in agent-eval-harness?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants