Why: Byte truncation split UTF-8, subagent results could return unbounded text, and a write could overwrite a file that changed after it was read. Evidence: cutRunes keeps a two-character Chinese prefix; tool selection honors -name; checklist reminders go through the reminder bus. Impact: Tool output limits count characters. A subagent result over 32000 characters is stored as an artifact and the parent sees the path. fs_write_file rejects an existing file that was not read in this run. Refs: feature/context-engineering Co-authored-by: Cursor <cursoragent@cursor.com>
19 lines
436 B
Go
19 lines
436 B
Go
package runtime
|
|
|
|
import (
|
|
"testing"
|
|
|
|
agentllm "agent-native/runtime/llm"
|
|
)
|
|
|
|
func TestApplyToolSelectionRemovesName(t *testing.T) {
|
|
decls := []agentllm.ToolDecl{{Name: "read_file"}, {Name: "write_file"}}
|
|
got := applyToolSelection(decls, "-write_file,+missing")
|
|
if len(got) != 1 || got[0].Name != "read_file" {
|
|
t.Fatalf("%+v", got)
|
|
}
|
|
if same := applyToolSelection(decls, ""); len(same) != 2 {
|
|
t.Fatalf("empty: %+v", same)
|
|
}
|
|
}
|