Repository navigation
fix(AIC-3576): record deferred judge scores under the evaluated config - #13
Merged
Merged
Conversation
RunJudge built its result trackData from the judge's own executeAndTrack trackData, copying over only the parent's GraphKey, so a deferred judge score was tracked under the judge config's configKey, variationKey, version, runId and model stamps instead of the config it evaluated. It now returns the parent's trackData plus JudgeConfigKey, the same payload the inline path tracks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andrewklatzke
approved these changes
Oct 21, 2026
jeffdupont
added a commit
to launchdarkly/python-ai-sdk
that referenced
this pull request
Oct 21, 2026
#190) Fixes [AIC-3576](https://launchdarkly.atlassian.net/browse/AIC-3576). ## Why When judges run in the background (`skip_judges=True` and then `run_judge(task, handlers)`), the returned `track_data` was built by spreading the judge's own call `track_data` over the parent's. A caller who then tracks it records the score under the judge config's `configKey`, `variationKey`, `version` and `runId`, not under the config that was evaluated. The inline `run_judges` path already tracks `{**base_track_data, "judgeConfigKey": ...}`, so the same judge scored differently depending on which path ran it. This reverses the model-stamp stripping that 5d1e678 added (`omit_model_stamps(task.parent_track_data)`). That change assumed the result described the judge, so it hid the parent's `modelKey`/`modelVersion`. The identity is now the parent's, so the parent's stamps describe it correctly, which is what the inline path sends. ## Fix - `packages/client/src/launchdarkly_ai_server/judges.py`: `run_judge` returns `{**task.parent_track_data, "judgeConfigKey": task.config_key}` and drops the `omit_model_stamps` import. `omit_model_stamps` stays exported (`tests/test_public_surface.py`). - `packages/client/tests/test_judges.py`: replaced 5d1e678's two stamp tests in `TestRunJudgeTrackData` with one test asserting the deferred `track_data` equals `{**parent, "judgeConfigKey": ...}` and equals the payload `run_judges` passes to `track()`. ## Testing - `make test`: 2543 passed, 14 skipped - `make typecheck`: no issues in 75 source files - `make lint`: all checks passed; `make format-check`: 161 files formatted - With the fix reverted, the new test fails: `{'configKey': 'judge-key'} != {'configKey': 'main-flag'}` (and runId, variationKey, version, model fields). Related: launchdarkly/js-ai-sdk#148, launchdarkly/go-ai-sdk#13, spec launchdarkly/ai-sdks-monorepo#74 🤖 Generated with [Claude Code](https://claude.com/claude-code) [AIC-3576]: https://launchdarkly.atlassian.net/browse/AIC-3576?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
jeffdupont
added a commit
to launchdarkly/js-ai-sdk
that referenced
this pull request
Oct 21, 2026
#148) Fixes [AIC-3576](https://launchdarkly.atlassian.net/browse/AIC-3576). ## Why When judges run in the background (`skipJudges: true` and then `runJudge(task, handlers)`), the returned `trackData` was built by spreading the judge's own call `trackData` over the parent's. A caller who then tracks it records the score under the judge config's `configKey`, `variationKey`, `version` and `runId`, not under the config that was evaluated. The inline `runJudges` path already tracks `{ ...baseTrackData, judgeConfigKey }`, so the same judge scored differently depending on which path ran it. This reverses the model-stamp stripping that d374962 added (`omitModelStamps(parentTrackData)`). That change assumed the result described the judge, so it hid the parent's `modelKey`/`modelVersion`. The identity is now the parent's, so the parent's stamps describe it correctly, which is what the inline path sends. ## Fix - `packages/client/src/judges.ts`: `runJudge` returns `trackData: { ...parentTrackData, judgeConfigKey: configKey }`. It drops the unused `trackData` destructure and the `omitModelStamps` import. `omitModelStamps` stays exported from the package root. - `packages/client/src/__tests__/judges.test.ts`: replaced d374962's two stamp tests with one test asserting the deferred `trackData` equals `{ ...parentTrackData, judgeConfigKey }` and equals the payload `runJudges` passes to `track()`. ## Testing - `yarn typecheck`: pass - `yarn code:check`: pass (237 files) - `yarn test`: all workspaces pass (client: 1400 passed, 11 skipped) - With the fix reverted, the new test fails: `expected { runId: 'judge-run', … } to deeply equal { runId: 'parent-run', … }` (configKey `judge-key` vs `main-flag`). Related: launchdarkly/python-ai-sdk#190, launchdarkly/go-ai-sdk#13, spec launchdarkly/ai-sdks-monorepo#74 🤖 Generated with [Claude Code](https://claude.com/claude-code) [AIC-3576]: https://launchdarkly.atlassian.net/browse/AIC-3576?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes AIC-3576.
Why
When judges run in the background (
SkipJudges: trueand thenRunJudge(ctx, task, handlers)), the returnedTrackDatastarted from the judge's ownexecuteAndTrackresult and copied over only the parent'sGraphKey. A caller who then tracks it records the score under the judge config'sConfigKey,VariationKey,Version,RunIDand model stamps, not under the config that was evaluated. The inline path already tracksa.parentTDplusJudgeConfigKey(aiserver/judges.go), so the same judge scored differently depending on which path ran it. JS and Python had the same bug and are fixed in the PRs below.Fix
aiserver/judges.go:RunJudgebuilds the result fromtask.ParentTrackDataand setsJudgeConfigKey.GraphKeyis still carried because it is part of the parent's trackData.aiserver/judges_test.go: newTestDeferredJudgeTrackDataMatchesInline. It checks that the deferredTrackDataequals the parent invocation'sTrackDataplusJudgeConfigKey, that its JSON equals the inlinequalitymetric payload (only the per-invocationrunIddiffers), and that a parentGraphKeysurvives.Testing
make test(go test -race ./...): all 16 packages ok (557 tests pass, 0 fail)go vet ./.../make lint: cleandeferred map[configKey:judge … modelKey:judge-model … version:5] != inline map[configKey:cfg … modelKey:parent-model … version:3]Related: launchdarkly/js-ai-sdk#148, launchdarkly/python-ai-sdk#190, spec https://github.com/launchdarkly/ai-sdks-monorepo/pull/74
🤖 Generated with Claude Code