Skip to content

[fix] Show evaluators in annotation queues - #6263

Open
mmabrouk wants to merge 1 commit into
release/v0.114.0from
fix/annotation-queue-evaluator
Open

[fix] Show evaluators in annotation queues#6263
mmabrouk wants to merge 1 commit into
release/v0.114.0from
fix/annotation-queue-evaluator

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

After an evaluator was selected for an annotation queue, the annotate view reported that no evaluators were configured. The run API returned the evaluator step correctly, but its source mapping used kind: "testset". The frontend accepted only an older fixed list of mapping kinds, so Zod rejected the entire run response and the evaluator step disappeared.

Changes

Evaluation run mapping kinds now validate as strings, matching the backend contract where this field is free-form. Known mapping kinds remain documented in the TypeScript type for autocomplete. Step types and origins remain strict.

Before, one unfamiliar mapping kind caused the full /evaluations/runs/query response to fall back to zero runs. After this change, the run remains available and the annotation panel can resolve its evaluator step.

A regression test covers a real testcase-backed queue payload with kind: "testset" and confirms the evaluator reference survives parsing. It also covers future mapping kinds so the same failure mode does not recur.

Tests / notes

  • pnpm lint-fix from web/
  • pnpm vitest run in web/packages/agenta-entities: 93 files, 1,396 tests passed
  • pnpm exec tsc --noEmit -p tsconfig.json in web/packages/agenta-entities
  • Reproduced against the local EE deployment: the API returned the configured Quality Rating evaluator while the old schema rejected the run payload

What to QA

  • Create a testcase annotation queue with an evaluator, add testcases, and open the annotate view. The configured evaluator fields should appear instead of “No evaluators configured for this queue.”
  • Open an existing evaluation run. Its source and metric columns should continue to render.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 24, 2026
@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Blocked Blocked Aug 24, 2026 8:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for testset, query, and invocation evaluation run mappings.
    • Evaluation runs with new or backend-defined mapping types can now be loaded without validation errors.
  • Bug Fixes

    • Preserved evaluation runs and evaluator references when responses contain previously unsupported mapping types.
  • Tests

    • Added coverage for testset mappings and unknown future mapping types.

Walkthrough

The evaluation-run mapping schema now accepts arbitrary string kinds while retaining known kind literals for TypeScript narrowing. Unit tests cover testset mappings, annotation evaluator references, and unknown mapping kinds.

Changes

Evaluation-run mapping compatibility

Layer / File(s) Summary
Mapping-kind schema and response validation
web/packages/agenta-entities/src/evaluationRun/core/schema.ts, web/packages/agenta-entities/tests/unit/evaluationRunsResponseSchema.test.ts
The schema accepts known and backend-defined mapping kinds. Tests verify parsing of testset mappings, preservation of annotation evaluator metadata, and retention of runs with unknown kinds.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🟡 Moderate · up to db5af

The PR fixes evaluator visibility by accepting backend mapping kinds, but the current head still has a lint-blocking unused declaration and a test import that bypasses the public package entry point. Merge should wait for these bounded cleanup fixes.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary fix: displaying evaluators in annotation queues.
Description check ✅ Passed The description directly explains the schema change, the annotation queue issue, regression tests, and validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/annotation-queue-evaluator

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.

❤️ Share

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

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 8cf45977-efce-4bff-9ef9-6413b9a96fa7

📥 Commits

Reviewing files that changed from the base of the PR and between 801a619 and db5af77.

📒 Files selected for processing (2)
  • web/packages/agenta-entities/src/evaluationRun/core/schema.ts
  • web/packages/agenta-entities/tests/unit/evaluationRunsResponseSchema.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment on lines +28 to +41
const EVALUATION_RUN_MAPPING_KINDS = [
"testset",
"query",
"invocation",
"annotation",
// legacy / alternate taxonomy still accepted defensively
"input",
"ground_truth",
"application",
"evaluator",
"annotation",
])
export type EvaluationRunMappingKind = z.infer<typeof evaluationRunMappingKindSchema>
] as const
// The backend defines mapping kinds as a free-form string and may add values.
export const evaluationRunMappingKindSchema = z.string()
export type EvaluationRunMappingKind = (typeof EVALUATION_RUN_MAPPING_KINDS)[number] | (string & {})

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

file="web/packages/agenta-entities/src/evaluationRun/core/schema.ts"
printf '%s\n' '--- schema excerpt ---'
sed -n '1,80p' "$file"

printf '%s\n' '--- references to the declaration ---'
rg -n --fixed-strings 'EVALUATION_RUN_MAPPING_KINDS' web/packages/agenta-entities web 2>/dev/null || true

printf '%s\n' '--- lint configuration and package scripts ---'
find web -maxdepth 3 \( -name 'package.json' -o -name '*eslint*' -o -name 'tsconfig*.json' \) -print
rg -n 'no-unused-vars|noUnusedLocals|lint' web/packages/agenta-entities web/package.json web/*eslint* web/*tsconfig* 2>/dev/null || true

Repository: Agenta-AI/agenta

Length of output: 10967


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- unused-variable configuration ---'
sed -n '88,112p' web/eslint.config.mjs

printf '%s\n' '--- entity package configuration ---'
cat web/packages/agenta-entities/package.json

printf '%s\n' '--- TypeScript compiler options ---'
cat web/packages/agenta-entities/tsconfig.json
sed -n '1,120p' web/packages/tsconfig.base.json

Repository: Agenta-AI/agenta

Length of output: 9515


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- available local tooling ---'
command -v node || true
command -v pnpm || true
test -x web/node_modules/.bin/eslint && echo 'eslint binary present' || echo 'eslint binary absent'
test -x web/node_modules/.bin/tsc && echo 'tsc binary present' || echo 'tsc binary absent'

printf '%s\n' '--- pinned tool versions ---'
rg -n '"`@typescript-eslint/`(eslint-plugin|parser)"|typescript@|eslint@' web/pnpm-lock.yaml pnpm-lock.yaml 2>/dev/null | head -30 || true

Repository: Agenta-AI/agenta

Length of output: 3044


🌐 Web query:

@typescript-eslint/no-unused-vars variable used in typeof type query considered used

💡 Result:

The @typescript-eslint/no-unused-vars rule does not consider variables used if they are only referenced in a typeof type query [1][2]. In previous versions, the rule may have permitted such usage, but as of the v8 release, @typescript-eslint/no-unused-vars was updated to report variables that are used only in type positions [3][4]. The maintainers intentionally designed this behavior because declaring runtime variables solely for use in types adds unnecessary code and complexity, as these variables do not exist at runtime [1][5]. If you encounter this linting error, the recommended approach is to refactor the code to define the necessary types directly rather than deriving them from a runtime variable [1][2]. For example, instead of: const box = { value: 123 }; export type Box = typeof box; You should use: export interface Box { value: number; } This practice avoids redundant runtime code and makes the intent clearer [1][4]. While there have been requests to add an option to allow variables to be used only as types, the maintainers have declined these, opting instead to encourage cleaner type-only declarations [4].

Citations:


Remove the unused runtime declaration.

@typescript-eslint/no-unused-vars reports variables referenced only through typeof. Replace EVALUATION_RUN_MAPPING_KINDS with a type-only literal union, or export it when runtime consumers need the taxonomy.

🧰 Tools
🪛 GitHub Check: TypeScript lint

[failure] 28-28:
'EVALUATION_RUN_MAPPING_KINDS' is assigned a value but only used as a type. Allowed unused vars must match /^|^.*/u

Source: Linters/SAST tools

@@ -0,0 +1,72 @@
import {describe, expect, it} from "vitest"

import {evaluationRunsResponseSchema} from "../../src/evaluationRun/core/schema"

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

fd -a '^package\.json$' web/packages/agenta-entities \
  -x rg -n -C2 '"exports"|evaluationRun' {}

Repository: Agenta-AI/agenta

Length of output: 1304


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- package exports ---'
sed -n '28,52p' web/packages/agenta-entities/package.json

printf '%s\n' '--- evaluationRun exports and schema symbol ---'
fd -a . web/packages/agenta-entities/src/evaluationRun -t f \
  -x sh -c 'printf "\n--- %s ---\n" "$1"; sed -n "1,180p" "$1"' sh {} \
  | head -n 900

printf '%s\n' '--- related test import patterns ---'
rg -n 'from ["'\''](`@agenta/entities`|../../src|../../../src)' \
  web/packages/agenta-entities/tests/unit web/packages/agenta-entities/src/evaluationRun \
  | head -n 200

Repository: Agenta-AI/agenta

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- evaluationRun/index.ts ---'
cat -n web/packages/agenta-entities/src/evaluationRun/index.ts

printf '%s\n' '--- evaluationRun/core/index.ts ---'
cat -n web/packages/agenta-entities/src/evaluationRun/core/index.ts

printf '%s\n' '--- schema declarations ---'
rg -n -C3 'evaluationRunsResponseSchema|export .*schema|from ["'\'']\./core|from ["'\'']\./core/schema' \
  web/packages/agenta-entities/src/evaluationRun

Repository: Agenta-AI/agenta

Length of output: 10156


Import from the public evaluation-run subpath.

Use @agenta/entities/evaluationRun instead of the internal ../../src/evaluationRun/core/schema path. The subpath exports evaluationRunsResponseSchema.

Source: Coding guidelines

@github-actions

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-6263.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-6263-3e978e5
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-24T20:55:19.873Z

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

Labels

bug frontend size:S This PR changes 10-29 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant