fix: restrict tool-heavy/swe-bench tagging to software development or agent-related tasks

This commit is contained in:
2026-07-17 17:25:17 +00:00
parent eb90f949a0
commit 293cf057b9
2 changed files with 104 additions and 2 deletions
+70 -1
View File
@@ -1,6 +1,10 @@
package server
import "testing"
import (
"testing"
"gophergate/internal/router"
)
func TestIsSoftwareDevelopment(t *testing.T) {
tests := []struct {
@@ -29,3 +33,68 @@ func TestIsSoftwareDevelopment(t *testing.T) {
}
}
}
func TestGetRouteCtxTags(t *testing.T) {
s := &Server{}
tests := []struct {
name string
routeCtx *router.RouteContext
expectedTags []string
mustContain []string
mustExclude []string
}{
{
name: "Standard query with tools",
routeCtx: &router.RouteContext{
UserMessage: "Search the web for weather in Paris",
RequiresToolCalling: true,
},
mustExclude: []string{"tool-heavy", "swe-bench"},
},
{
name: "Coding query with tools",
routeCtx: &router.RouteContext{
UserMessage: "Write a python script to parse logs",
RequiresToolCalling: true,
IsSoftwareDevelopment: true,
},
mustContain: []string{"tool-heavy", "swe-bench"},
},
{
name: "Agent query with tools",
routeCtx: &router.RouteContext{
UserMessage: "agent please orchestrate the multi-agent task",
RequiresToolCalling: true,
},
mustContain: []string{"tool-heavy", "swe-bench"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tags := s.getRouteCtxTags(tt.routeCtx)
for _, expected := range tt.mustContain {
found := false
for _, tag := range tags {
if tag == expected {
found = true
break
}
}
if !found {
t.Errorf("expected tag %q to be present, but was not in %v", expected, tags)
}
}
for _, excluded := range tt.mustExclude {
for _, tag := range tags {
if tag == excluded {
t.Errorf("expected tag %q to be excluded, but was found in %v", excluded, tags)
}
}
}
})
}
}