Files
ARTEX/agent/coverage_inject_test.go
T
Ege Arhan 2ed4e78684 fix(tools): keep coverage-only tools out of the shared domain registry
AllDomainTools is built from a task-less ToolSet and feeds buildDomainReg,
which ToolResolve uses to inject any tool bound to an agent. record_coverage
and list_untested_assets were registered there, so a worker whose
coverage_enabled=false had them dropped in its own base and then injected
back by the resolver: the model saw record_coverage and every call answered
"record_coverage requires a task context" (#892).

Signed-off-by: Ege Arhan <egearhany@gmail.com>
2026-12-05 09:31:15 +00:00

38 lines
1.2 KiB
Go

package agent
import "testing"
// The server-level registry behind buildDomainReg injects any bound domain tool
// into agents whose own ToolSet dropped it. Its ToolSet is task-less, so a coverage
// tool registered there can only answer "requires a task context" — and, worse,
// re-adds record_coverage to a worker whose coverage_enabled=false already filtered
// it out (#892). Keep the coverage-only tools out of the registry.
func TestAllDomainToolsExcludesCoverageOnlyTools(t *testing.T) {
ts := NewToolSet(nil, "")
all := ts.AllDomainTools()
for name := range coverageOnlyTools {
for _, tool := range all {
if tool.Name() == name {
t.Fatalf("%s is in AllDomainTools; a task-less instance injects it into tasks with coverage off", name)
}
}
}
// The registry still has to carry the rest; an empty list would make injection a
// no-op and hide the bug rather than fix it.
if len(all) == 0 {
t.Fatal("AllDomainTools is empty")
}
for _, want := range []string{"insert_assets", "list_assets", "report_finding"} {
found := false
for _, tool := range all {
if tool.Name() == want {
found = true
break
}
}
if !found {
t.Fatalf("%s is missing from AllDomainTools", want)
}
}
}