mirror of
https://github.com/langchain-ai/langsmith-java.git
synced 2026-08-24 22:01:31 -04:00
714a32cc62
`logComparativeEvaluationFeedback` looked each run up by the keys of the score map returned by the user's comparative evaluator, but posted the feedback whether or not the lookup hit. On a miss, `POST /api/v1/feedback` went out with a `run_id` but no `session_id` — while still carrying this comparison's `comparative_experiment_id` and `feedback_group_id`. `ComparisonEvaluationResult.scores` is authored entirely by the evaluator and was never checked against the runs it was handed, so a nested run id, or one an LLM judge invented, was enough to trigger it. Such an entry is now skipped with a `WARNING`, and `.sessionId(...)` is unconditional in the builder. No fallback session is used: with two experiments in play there is no way to tell which one an unrecognised run belongs to. Evaluator-supplied text is sanitized before logging so a judge's output can't forge log records. The other feedback paths were checked and are unaffected — `evaluate()` supplies `session_id` via `TraceConfig`, and `evaluateExisting()` via the required `RunSchema.session_id`. New `EvaluateSupportTest` calls the internal helper directly with a mocked `FeedbackService`. This path had no coverage before. ## Test Plan - [x] `./gradlew :langsmith-java-core:test` green (422 test classes); `lintKotlin` clean