Skip to content

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

Open
myhoai wants to merge 1 commit into
masterfrom
qa-28482-run-metadata-extra
Open

feat(gooddata-eval): optional run_metadata_extra on agentic evaluators#1686
myhoai wants to merge 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 for evaluation runs.
    • Custom metadata is now included in Langfuse traces across alert, conversation, question, guardrail, metric, search, and visualization evaluations.
    • Reserved trace fields are protected from being overridden by user-supplied metadata.
  • Tests
    • Added coverage for run-context metadata merging and override protection behavior.

@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: 366059d6-67fe-4942-a752-07d1ccc43d4c

📥 Commits

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

📒 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 (8)
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/general_question.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/visualization.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/search_tool.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/guardrail.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/metric_skill.py
  • packages/gooddata-eval/src/gooddata_eval/core/agentic/_langfuse.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 SDK-owned fields.

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 and sets SDK-owned metadata fields after merging it.
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 metadata merging, reserved-key precedence, generated run values, 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 SDK-owned fields
  build_run_context->>Langfuse: Create dataset-run context
Loading

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.
Reserved keys stay in their place!

🚥 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 summarizes 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 (d1f9189).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1686      +/-   ##
==========================================
+ Coverage   77.85%   77.91%   +0.06%     
==========================================
  Files         271      271              
  Lines       18603    18604       +1     
==========================================
+ Hits        14483    14495      +12     
+ 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

Add an optional run_metadata_extra parameter to build_run_context and every
evaluate_agentic_* entrypoint. When provided, its keys are added to the
Langfuse dataset-run metadata; default None keeps behavior byte-for-byte
identical, so existing callers are unaffected. SDK-owned keys
("testing_framework", "model_version") always take precedence and cannot be
overwritten by the extra dict.

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.
Includes unit coverage for the merge, reserved-key precedence, and default
no-op 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 252207e to d1f9189 Compare July 10, 2026 13:21
@myhoai myhoai enabled auto-merge July 10, 2026 13: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.

1 participant