Skip to content

fix(gooddata-eval): send the run metadata to gen-ai as experiment metadata - #1897

Open
myhoai wants to merge 1 commit into
masterfrom
QA-29847-experiment-metadata-baggage
Open

myhoai wants to merge 1 commit into
masterfrom
QA-29847-experiment-metadata-baggage

Conversation

@myhoai

@myhoai myhoai commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • When gd-eval joins gen-ai's turns into the item's trace (GOODDATA_EVAL_JOIN_GENAI_TRACE, on by default since feat(gooddata-eval): put gen-ai turns under the eval item root trace #1863), gen-ai's spans name the experiment through baggage but carry no experiment metadata. Langfuse then lists most such experiments with metadata: {}, although gd-eval's root span carries all of it.
  • Measured on the staging nightly since the join shipped (2026-10-15): 60 of 68 joined experiments of agent_metric_skill list empty metadata, 0 of 184 unjoined ones (pre-merge, same SDK version) do. Readers that filter experiments by github_run_id, branch or workflow (the gdc-nas eval trend and the PR-comment baseline) drop those runs.
  • baggage_entries now adds one langfuse_experiment_metadata_<key> member per run-metadata key. The langfuse SDK on the gen-ai side (checked on 4.14.4, gen-ai's lock, and 4.15.2) maps each one to langfuse.experiment.metadata.<key>. A string goes as is, any other value as JSON, as the root span shows it. A key that is not a plain token is skipped with one warning; that rule and GOODDATA_EVAL_TRACE_LABELS now share BAGGAGE_KEY.
  • Not covered: eval_k and eval_gate are stamped at scoring time, after the turns ran, so gen-ai's spans still lack those two keys. Nothing in gdc-nas reads them from the experiment listing. The baggage header has no size budget; the run metadata in use today is eight short keys.

Test Plan

  • test_the_run_metadata_rides_along_as_experiment_metadata in tests/test_sse_client.py: the metadata members, a bool sent as true, and keys with a space, a comma or non-ASCII skipped.
  • Not verified end to end yet: the first staging nightly on a release with this change should list the joined experiments with their metadata.

Risk Assessment

low — adds baggage members to the chat request only when the item joins gen-ai's trace; gen-ai drops caller langfuse_* baggage unless acceptCallerBaggage is on. Revert: full.

jira: QA-29847
risk: low

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Chat requests now include available run metadata in the associated experiment metadata. Text, numbers, booleans, and lists are represented in a readable format, while values that are not set are omitted. Metadata values containing spaces, punctuation, or non-ASCII characters are preserved, making more run context available when reviewing experiment results.

…adata

When gd-eval joins gen-ai's turns into the item's trace, gen-ai's spans
name the experiment through baggage but carry no experiment metadata.
Langfuse then lists most such experiments with empty metadata, although
gd-eval's root span carries all of it. On the staging nightly since the
join shipped, 60 of 68 joined experiments of one dataset list `{}`,
while every unjoined one keeps its metadata. Readers that filter
experiments by github_run_id, branch or workflow drop those runs.

baggage_entries now adds a langfuse_experiment_metadata_<key> member
per run metadata key. The langfuse SDK on the gen-ai side maps each one
to langfuse.experiment.metadata.<key>, so the spans of the experiment
carry the metadata the root carries. A string goes as is and any other
value as JSON, as the root span shows it. A key that is not a plain
token is skipped with one warning, the rule GOODDATA_EVAL_TRACE_LABELS
already applies, and the two now share BAGGAGE_KEY.

eval_k and eval_gate are stamped at scoring time, after the turns ran,
so gen-ai's spans still lack those two keys.

jira: QA-29847
risk: low
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 9d4641ba-ff38-48e9-a8ae-8a6706cc4b34
📥 Commits

Reviewing files that changed from the base of the PR and between 4a5e851 and b0e60de.

📒 Files selected for processing: 3
  • packages/gooddata-eval/src/gooddata_eval/core/chat/sse_client.py
  • packages/gooddata-eval/src/gooddata_eval/core/langfuse/item_scope.py
  • packages/gooddata-eval/tests/test_sse_client.py

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📝 Walkthrough

Run metadata is added to Langfuse experiment metadata baggage entries. Chat trace-label validation now uses the shared baggage-key pattern. Tests cover metadata serialization, URL encoding, and omission of None values.

Changes: Metadata baggage propagation

Layer / File(s) Summary
Encode run metadata as baggage
packages/gooddata-eval/src/gooddata_eval/core/langfuse/item_scope.py
baggage_entries adds URL-quoted entries for non-None metadata with valid keys. String values remain unchanged; other values are JSON-serialized. Invalid keys are skipped and warned about once per key per process.
Use shared baggage-key validation
packages/gooddata-eval/src/gooddata_eval/core/chat/sse_client.py, packages/gooddata-eval/tests/test_sse_client.py
_trace_baggage uses BAGGAGE_KEY to validate label keys. Tests cover metadata encoding, value serialization, and omission of None values.

Priority: ➖ Normal

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

Change: Bug fix

Suggested reviewers: tychtjan

Merge Risk: ⚪ Minimal · up to b0e60

The metadata propagation change is mergeable after normal checks. No actionable failure was established in the reviewed paths.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 and concisely describes the main change: sending run metadata to gen-ai as experiment metadata.
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
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit packs metadata tight,
And quotes each value just right.
String, number, list go in,
Nulls and bad keys stay thin.
The baggage hops into the night.

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

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.10%. Comparing base (4a5e851) to head (b0e60de).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1897   +/-   ##
=======================================
  Coverage   85.10%   85.10%           
=======================================
  Files         337      337           
  Lines       24343    24358   +15     
=======================================
+ Hits        20716    20731   +15     
  Misses       3627     3627           

☔ 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.

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