Skip to content

feat(frontend): /m live evaluations like /w - #8178

Merged
mmabrouk merged 2 commits into
release/v0.128.9from
feat/m-parity-live-evals
Nov 6, 2026
Merged

mmabrouk merged 2 commits into
release/v0.128.9from
feat/m-parity-live-evals

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Nov 6, 2026

Copy link
Copy Markdown
Member

Context

The /w vs /m comparison found several differences on the live evaluation screens (findings evaluations-live-01, -02 and -04):

  • The new live evaluation drawer said "No filters • Sampling 100% • Live traffic" while its filter button showed 1. It also had no "Run on historical data" control, and an empty divider sat above the first section.
  • The live run's overview showed "1 query" instead of the filter. Cost, Duration and Tokens showed "—", so the radar said "Insufficient metrics".
  • The run header had "Pause", while the runs list menu says "Stop evaluation". A stopped live run still showed "Running".

The chart at 0.00% next to 95.45% in the table is already fixed in #8164, which this PR is based on.

Changes

Drawer.

  • The Query summary counts the locked "trace type is invocation" filter, like the filter button: "1 filter • Sampling 100% • Live traffic".
  • "Run on historical data" shows with its start and end dates, off and disabled with the tooltip "Not available yet", exactly as in /w. The API does not run live evaluations over past traces yet.
  • The first section has no top divider.

Overview. "Filters / Queries" shows the query itself and its sampling rate, as /w prints them:

trace_type is invocation AND references in [{"id":"…"}]
Sample rate: —

The text comes from the stored query, read with POST /queries/revisions/retrieve through a new runQueryConfigQueryAtomFamily, and from a pure formatter, formatQueryFiltering / formatQuerySampleRate. Both live in @agenta/entities/evaluationRun.

Cost, duration and tokens of a live run. A live run calls no app, so what it spends per trace is its evaluators' spend. The metric catalog now adds up the evaluators' means per trace. Errors were already added up across the evaluators.

On the parity data: Duration 483.86 ms (judge 483.65 + regex 0.21), Tokens 114, and a non-zero Cost. /w printed 243 ms, which is the average of the two evaluators, not the time a trace takes. Auto runs still read their app step only; a test pins that.

Stopped state. The header button says "Stop" and "Resume" (tooltips "Stop evaluation" and "Resume evaluation"), the words the runs list menu and /w use. A stopped live run's Status reads "Stopped" instead of "Running". The server keeps a stopped run's status as running and turns off is_active. I kept the header button, which /w does not have: it is the only way to stop or resume from the run page.

Not in this PR: the evaluator details in the drawer (evaluations-live-05: prompt, model and schema). That is a larger piece, best next to the evaluator drawer work.

Without beta developer mode: these screens are developer views (the Evaluations view is in the hidden stage). A user without beta developer mode reaches them only on a deployment that forces the view on, the same as #8164.

Based on #8164 (feat/m-parity-evaluation-logic); PR base = that branch.

Tests

  • evaluation-run-metrics.test.ts (entities):
    • a live run's duration, tokens and cost are the per-trace sum of its evaluators', on the captured parity run;
    • an auto run still reads only its app step.
    • The old assertion that a live run has no duration is updated.
  • evaluation-run-live-query-text.test.ts (entities): nested groups, list values, no filter, sampling rate.
  • runSummaryTable.render.test.tsx:
    • the query row shows the filter and the sampling rate, and waits while the query loads;
    • a stopped live run shows "Stopped".
  • liveEvaluationSheet.render.test.tsx:
    • the summary counts the invocation filter (updated from "No filters");
    • the historical data switch and its dates are disabled.
  • /m, /w and entities type checks pass; pnpm run lint passes; Prettier passes on the changed files.
  • Quick look on the parity data: the live overview shows the filter, 476 ms, 115 tokens, a cost, the radar, and 96.75% in both the card and the table. The drawer shows "1 filter" and the disabled historical control.

What to QA

  • Open the live evaluation "Capital finder live checks". Filters / Queries shows the filter. Cost, Duration and Tokens have values, and the radar draws.
  • Click Stop. The button turns into Resume, and Status reads "Stopped". Click Resume to restore it.
  • Evaluations, Live Evals, New evaluation. The Query line says "1 filter". "Run on historical data" is off and disabled, with the "Not available yet" tooltip.

Agenta Product Agent added 2 commits November 6, 2026 12:18
…e overview, live cost and time, Stop wording and stopped state, filter count, historical data switch
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Summary

Summary by CodeRabbit

  • New Features

    • Live run summaries now show query filters and sampling rates, with a loading placeholder while query details are unavailable.
    • Added a disabled historical-data option with date fields marked as unavailable.
    • Query summaries include the locked invocation filter.
    • Live run metrics now include evaluator-reported duration, token, and cost data when invocation details are unavailable.
  • Bug Fixes

    • Inactive live runs are labeled “Stopped,” and the run action is labeled “Stop” rather than “Pause.”

The pull request adds query configuration and historical-data controls to live evaluation views. It updates live-run status and query details in run summaries, and changes metric aggregation when invocation steps are absent.

Changes: Live evaluation controls

Layer / File(s) Summary
Query controls and summary
web/mobile/src/features/evaluations/live/HistoricalDataControl.tsx, web/mobile/src/features/evaluations/live/LiveEvaluationForm.tsx, web/mobile/src/features/evaluations/live/LiveSection.tsx, web/mobile/tests/unit/liveEvaluationSheet.render.test.tsx
The Query section adds disabled historical-data controls. The query summary counts the locked invocation filter, and tests cover the control defaults and updated counts.

Run overview details

Layer / File(s) Summary
Query configuration and formatting
web/packages/agenta-entities/src/evaluationRun/state/runQuery.ts, web/packages/agenta-entities/src/evaluationRun/core/liveQuery.ts, web/packages/agenta-entities/src/evaluationRun/{core,state,index}.ts, web/packages/agenta-entities/tests/unit/evaluation-run-live-query-text.test.ts
A query atom retrieves filtering and sampling configuration. Formatting helpers render nested filters and valid sample rates. The package exports these additions, with tests for the formatted output.
Overview query and status display
web/mobile/src/features/evaluation-run/overview/{useRunOverview,RunOverviewView,runSummaryRows}.tsx, web/mobile/src/features/evaluation-run/{RunDetailsHeader,RunOnlineToggle}.tsx, web/mobile/tests/unit/runSummaryTable.render.test.tsx
The overview loads query configuration and displays its formatted filter and sample rate, with a loading marker while data is pending. Inactive live runs display “Stopped,” and the live-run action uses “Stop” labels and iconography.

Live-run metric aggregation

Layer / File(s) Summary
Evaluator metric aggregation
web/packages/agenta-entities/src/evaluationRun/state/runMetrics.ts, web/packages/agenta-entities/tests/unit/evaluation-run-metrics.test.ts
When invocation steps are absent, cost, duration, and token metrics use evaluator steps. Multiple candidates combine per trace. Tests cover live-run metrics and auto-run duration.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RunOverviewView
  participant useRunOverview
  participant runQueryConfigQueryAtomFamily
  participant buildRunSummaryRows
  RunOverviewView->>useRunOverview: Request overview data
  useRunOverview->>runQueryConfigQueryAtomFamily: Read configuration for query ID
  runQueryConfigQueryAtomFamily-->>useRunOverview: Return query configuration or pending state
  useRunOverview-->>RunOverviewView: Return overview with query state
  RunOverviewView->>buildRunSummaryRows: Pass query configuration
  buildRunSummaryRows-->>RunOverviewView: Return formatted query details or loading marker
Loading

Possibly related PRs

  • Agenta-AI/agenta#8042: Adds the run overview, live-run toggle, and metric catalog that this pull request extends.
  • Agenta-AI/agenta#8125: Adds inactive live-run status and evaluator error aggregation, which this pull request updates and extends.
Merge Risk: Moderate · up to e9224

A run can show query settings it did not use and misleading metrics or status. Correct those displays before merging.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title describes the goal of aligning /m live evaluations with /w.
Description check Passed The description covers the live evaluation UI, query display, metrics, and stopped state changes.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 7 functions across 18 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Website preview

Preview URL: https://pr-8178-agenta-website-preview.mahmoud-637.workers.dev

Built from e9224bfb2da26682ea8f3a77be362c099a1bf321. This comment updates in place on every push.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Item Value
Status stopped
Commit e9224bfb2da26682ea8f3a77be362c099a1bf321
Manual expiry (UTC) Not granted
CI deadline (UTC) Not granted
Workflow https://github.com/Agenta-AI/agenta/actions/runs/42214027839

Preview use finished or expired. Environment absence verified; retained storage requires separate provider accounting.

Post /preview as a new comment to request a one-hour preview. Repeating it while active does not extend the hour.
Preview data is disposable. Expiry is enforced by the next successful cleanup sweep, not an exact timer.
Environment deletion stops its compute. Provider-retained storage and permanent services may still be billed.

@mmabrouk

mmabrouk commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

@mmabrouk I’ll start a review of the PR.

Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 5

Nitpick comments: 1

web/packages/agenta-entities/src/evaluationRun/state/runQuery.ts: 1

30-30: Trivial · Functional Correctness · Quick win

Validate the filtering cast with zod before it reaches formatQueryFiltering.

Line 30 casts data?.filtering to QueryFilteringText without validation. The guideline requires zod validation at the boundary, with safeParseWithLogging. It says Fern types under-declare backend extra="allow" fields. A malformed condition (for example null inside conditions) makes "conditions" in condition in formatQueryFiltering throw. The overview then crashes instead of logging a drift error.

Add a local zod schema for QueryFilteringText. Parse data?.filtering with safeParseWithLogging from @agenta/entities/shared. Fall back to null on failure.

As per coding guidelines: "Keep zod validation at the boundary" and "Use safeParseWithLogging from @agenta/entities/shared for the validation."

Source: Coding guidelines

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 876cd6f and e9224bf.

Files selected for processing: 18

  • web/mobile/src/features/evaluation-run/RunDetailsHeader.tsx
  • web/mobile/src/features/evaluation-run/RunOnlineToggle.tsx
  • web/mobile/src/features/evaluation-run/overview/RunOverviewView.tsx
  • web/mobile/src/features/evaluation-run/overview/runSummaryRows.tsx
  • web/mobile/src/features/evaluation-run/overview/useRunOverview.ts
  • web/mobile/src/features/evaluations/live/HistoricalDataControl.tsx
  • web/mobile/src/features/evaluations/live/LiveEvaluationForm.tsx
  • web/mobile/src/features/evaluations/live/LiveSection.tsx
  • web/mobile/tests/unit/liveEvaluationSheet.render.test.tsx
  • web/mobile/tests/unit/runSummaryTable.render.test.tsx
  • web/packages/agenta-entities/src/evaluationRun/core/index.ts
  • web/packages/agenta-entities/src/evaluationRun/core/liveQuery.ts
  • web/packages/agenta-entities/src/evaluationRun/index.ts
  • web/packages/agenta-entities/src/evaluationRun/state/index.ts
  • web/packages/agenta-entities/src/evaluationRun/state/runMetrics.ts
  • web/packages/agenta-entities/src/evaluationRun/state/runQuery.ts
  • web/packages/agenta-entities/tests/unit/evaluation-run-live-query-text.test.ts
  • web/packages/agenta-entities/tests/unit/evaluation-run-metrics.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@mmabrouk
mmabrouk changed the base branch from feat/m-parity-evaluation-logic to release/v0.128.9 November 6, 2026 14:33
@mmabrouk
mmabrouk merged commit 1e7c541 into release/v0.128.9 Nov 6, 2026
81 of 88 checks passed
@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant