Skip to content

feat(gooddata-eval): optional run_metadata_extra on agentic evaluators#1686

Merged
myhoai merged 1 commit into
masterfrom
qa-28482-run-metadata-extra
Jul 13, 2026
Merged

feat(gooddata-eval): optional run_metadata_extra on agentic evaluators#1686
myhoai merged 1 commit into
masterfrom
qa-28482-run-metadata-extra

Conversation

@myhoai

@myhoai myhoai commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Add an optional run_metadata_extra parameter to build_run_context and every evaluate_agentic_* entrypoint. When provided, its keys are merged into the Langfuse dataset-run metadata; default None keeps behavior byte-for-byte identical, so existing callers are unaffected.

Enables a caller (e.g. gdc-nas tavern-e2e CI) to stamp a github_run_id on runs for exact report isolation, without the SDK reading any ambient env itself.

Summary by CodeRabbit

  • New Features
    • Added optional custom run metadata support (run_metadata_extra) for evaluation runs.
    • Custom metadata is now included in Langfuse traces across alert, conversation, general question, guardrail, metric, search, and visualization evaluations.
    • Reserved run context fields (such as model_version) are protected from being overridden by user-supplied metadata.
  • Bug Fixes
    • Removed the hardcoded default testing_framework when no run metadata is provided.
  • Tests
    • Added coverage for run-context metadata merging, override protection, and behavior when run_metadata_extra is omitted.

@myhoai myhoai requested review from hkad98, lupko and pcerny as code owners July 10, 2026 12:22
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 425b6d14-21cf-4db3-8b90-a0df7a884634

📥 Commits

Reviewing files that changed from the base of the PR and between d1f9189 and d599be3.

📒 Files selected for processing (9)
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/_langfuse.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/alert_skill.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/conversation.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/general_question.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/guardrail.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/metric_skill.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/search_tool.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/visualization.py
  • packages/gooddata-eval/tests/test_agentic_run_context.py
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/visualization.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/metric_skill.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/search_tool.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/general_question.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/guardrail.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/alert_skill.py

📝 Walkthrough

Walkthrough

Agentic evaluation functions now accept optional extra run metadata, forward it to build_run_context, and merge it into Langfuse dataset-run metadata while preserving the resolved model version and removing the default testing framework.

Changes

Langfuse metadata propagation

Layer / File(s) Summary
Run-context metadata merge
packages/gooddata-eval/src/gooddata_eval/core/agentic/_langfuse.py
build_run_context accepts optional extra metadata, applies the resolved model_version after merging it, and no longer supplies a default testing framework.
Evaluator metadata forwarding
packages/gooddata-eval/src/gooddata_eval/core/agentic/{alert_skill,conversation,general_question,guardrail,metric_skill,search_tool,visualization}.py
Agentic evaluation functions expose run_metadata_extra and pass it to build_run_context.
Metadata merge validation
packages/gooddata-eval/tests/test_agentic_run_context.py
Tests cover extra metadata inclusion, model-version precedence, and behavior without extra metadata.

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

Sequence Diagram(s)

sequenceDiagram
  participant Evaluator
  participant build_run_context
  participant Langfuse
  Evaluator->>build_run_context: Forward run_metadata_extra
  build_run_context->>build_run_context: Merge metadata and set resolved model_version
  build_run_context->>Langfuse: Create dataset-run context
Loading

Suggested reviewers: lupko, pcerny

Poem

A bunny hops through metadata bright,
Adds little tags to traces in flight.
Each agent passes the bundle along,
Langfuse records the extra song.
The model version stays strong!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding optional run_metadata_extra support to agentic evaluators.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.91%. Comparing base (f8f7256) to head (d599be3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1686      +/-   ##
==========================================
+ Coverage   77.85%   77.91%   +0.05%     
==========================================
  Files         271      271              
  Lines       18603    18603              
==========================================
+ Hits        14483    14494      +11     
+ Misses       4120     4109      -11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/gooddata-eval/src/gooddata_eval/core/agentic/_langfuse.py (1)

398-402: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding a unit test for the merge/override behavior.

run_metadata_extra can silently overwrite reserved keys (testing_framework, model_version) since metadata.update(run_metadata_extra) runs unconditionally after they're set. This is likely intentional (caller override), but a test asserting both the default-preserving path and the override path would guard against regressions, especially since this metadata is used for report isolation (e.g. github_run_id).

🤖 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 `@packages/gooddata-eval/src/gooddata_eval/core/agentic/_langfuse.py` around
lines 398 - 402, Add unit tests for the metadata construction logic in the
relevant agentic evaluation function, covering defaults when no extra metadata
is supplied and confirming that run_metadata_extra intentionally overrides
testing_framework and model_version while preserving additional keys such as
github_run_id.
🤖 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.

Nitpick comments:
In `@packages/gooddata-eval/src/gooddata_eval/core/agentic/_langfuse.py`:
- Around line 398-402: Add unit tests for the metadata construction logic in the
relevant agentic evaluation function, covering defaults when no extra metadata
is supplied and confirming that run_metadata_extra intentionally overrides
testing_framework and model_version while preserving additional keys such as
github_run_id.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1b678bad-788a-4ac6-9cf7-5a6a7e511f22

📥 Commits

Reviewing files that changed from the base of the PR and between f8f7256 and 252207e.

📒 Files selected for processing (8)
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/_langfuse.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/alert_skill.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/conversation.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/general_question.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/guardrail.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/metric_skill.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/search_tool.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/visualization.py

@myhoai myhoai force-pushed the qa-28482-run-metadata-extra branch from 252207e to d1f9189 Compare July 10, 2026 13:21
@myhoai myhoai enabled auto-merge July 10, 2026 13:24
Comment on lines +388 to +394
"""Return (run_name_base, run_metadata) with model version resolved from workspace API.

:param run_metadata_extra: optional extra key/values added to the dataset-run
metadata (e.g. a CI run id for scoping). Default None keeps behavior unchanged.
SDK-owned keys ("testing_framework", "model_version") always take precedence and
cannot be overwritten by this dict.
"""

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.

Python SDK uses Google style docstring. Please change it.

metadata: dict[str, Any] = {"testing_framework": "tavern-e2e"}
# Start from caller extras, then set SDK-owned keys last so they always win.
metadata: dict[str, Any] = dict(run_metadata_extra) if run_metadata_extra else {}
metadata["testing_framework"] = "tavern-e2e"

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.

Do not hardcode this in this repository.

Add an optional run_metadata_extra parameter to build_run_context and every
evaluate_agentic_* entrypoint. Its keys are added to the Langfuse dataset-run
metadata; default None keeps behavior unchanged for existing callers. The
SDK-derived model_version is applied last and cannot be overwritten by it.

Stop hardcoding the consumer-specific "tavern-e2e" testing_framework tag in the
SDK (both build_run_context and the observe() fallback); callers now supply
their own run tags via run_metadata_extra. This enables a caller (e.g. gdc-nas
tavern-e2e CI) to stamp testing_framework + a github_run_id for exact report
isolation, without the SDK reading any ambient env itself.

Docstring converted to Google style. Includes unit coverage for the merge,
model_version precedence, and default paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@myhoai myhoai force-pushed the qa-28482-run-metadata-extra branch from d1f9189 to d599be3 Compare July 13, 2026 07:01
@myhoai myhoai merged commit c31c1ec into master Jul 13, 2026
13 checks passed
@myhoai myhoai deleted the qa-28482-run-metadata-extra branch July 13, 2026 07:24
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