From 80a16a7788de24b6514066040b5726581d8faa38 Mon Sep 17 00:00:00 2001 From: nachiketb Date: Thu, 1 Oct 2026 15:28:49 -0700 Subject: [PATCH] refactor(libsy): separate task context from judge instructions Signed-off-by: nachiketb --- crates/libsy/src/algorithms/llm_class.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/libsy/src/algorithms/llm_class.rs b/crates/libsy/src/algorithms/llm_class.rs index 40d9ad3d9..6f1e7b00a 100644 --- a/crates/libsy/src/algorithms/llm_class.rs +++ b/crates/libsy/src/algorithms/llm_class.rs @@ -186,8 +186,9 @@ struct TaskInput { recent_turn_window: Option, } -impl ClassifierInput for TaskInput { - fn build_messages(&self, _state: &State, request: &Request) -> Vec { +impl TaskInput { + /// Selects conversation content without adding judge instructions. + fn messages(&self, request: &Request) -> Vec { // The default preserves the whole-task anchor and latest user update. A // configured window widens that to the surrounding conversation. let mut messages = match self.recent_turn_window { @@ -204,6 +205,13 @@ impl ClassifierInput for TaskInput { .retain(|block| !matches!(block, ContentBlock::Reasoning { .. })); } messages.retain(|message| !message.content.is_empty()); + messages + } +} + +impl ClassifierInput for TaskInput { + fn build_messages(&self, _state: &State, request: &Request) -> Vec { + let mut messages = self.messages(request); // Only the windowed path carries assistant turns and tool traffic for the judge // to be distracted by. The default path is user task messages only — the anchor // and the latest follow-up — so there is nothing there to outrank.