Skip to content

chore: reverts judge message stripping#205

Open
andrewklatzke wants to merge 1 commit into
mainfrom
aklatzke/AIC-2848/revert-judge-stripping
Open

chore: reverts judge message stripping#205
andrewklatzke wants to merge 1 commit into
mainfrom
aklatzke/AIC-2848/revert-judge-stripping

Conversation

@andrewklatzke

@andrewklatzke andrewklatzke commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

https://launchdarkly.atlassian.net/jira/software/c/projects/AIC/boards/2045?selectedIssue=AIC-2848

Describe the solution you've provided

This is a reversion of functionality that was added.

Describe alternatives you've considered

Reverts behavior from #165 that stripped messages off of the judges and then re-created them.

Additional context

This was discussed and there are various concerns about this behavior. Since this is a semi-permanent solution once changes are applied on the server side we don't want to take this step yet.


Note

Medium Risk
Judge and managed-completion paths change how prompts are built and sent to providers, which can alter evaluation behavior for legacy judge configs; runner input typing is broader but list-input semantics are a contract change for direct runner callers.

Overview
Reverts the prior judge flow that stripped legacy template messages in LDAIClient and sent a single formatted string to the model. judge_config() again returns the full message list (including {{message_history}} / {{response_to_evaluate}} placeholders), and Judge.evaluate() builds the prompt by Mustache-interpolating those templates into a List[LDMessage] passed to Runner.run(). Evaluations now fail early when judge config has no messages.

The Runner contract is extended so run() accepts either a string (still appended to multi-turn history) or a message list used as the complete payload without prepending runner history or config messages. OpenAI and LangChain factories no longer seed runners with config.messages.

ManagedModel takes over completion conversation management: it keeps turn history, prepends config system messages, invokes the runner with the full list, and feeds judges history as CRLF-joined content (not role: lines).

Reviewed by Cursor Bugbot for commit 2e40f00. Bugbot is set up for automated code reviews on this repo. Configure here.

@andrewklatzke andrewklatzke requested a review from jsonbailey June 29, 2026 17:38
@andrewklatzke andrewklatzke marked this pull request as ready for review July 6, 2026 17:44
@andrewklatzke andrewklatzke requested a review from a team as a code owner July 6, 2026 17:44

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e40f00. Configure here.

(model, provider, messages, instructions,
tracker_factory, enabled, judge_configuration, variation) = self.__evaluate(
key, context, default.to_dict(), extended_variables
key, context, default.to_dict(), variables

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Judge placeholders cleared at config

High Severity

_judge_config passes user variables into __evaluate, which Mustache-interpolates every message. Legacy judge templates like {{message_history}} and {{response_to_evaluate}} are not in that map, so chevron blanks them before Judge._construct_evaluation_messages runs, breaking legacy judge evaluations loaded from flags.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2e40f00. Configure here.


evaluations_task = await self._track_judge_results(tracker, input_text, result.content)

self._messages.append(assistant_message)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Failed run appends assistant history

Medium Severity

ManagedModel.run always appends an assistant LDMessage after the runner returns, even when result.metrics.success is false. A failed call still leaves a user turn plus an empty or error assistant turn in _messages, which pollutes later all_messages sent to the model.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2e40f00. Configure here.

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