Files
weichenandCursor 6fd1d441a9
ci / vet-and-test (pull_request) Successful in 45s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
Keep tool pairs and fold reminders into the last result
Why: Old tool results were filling the window, compaction could split a tool group or commit a stale summary, and reminders arrived as extra user messages.
Evidence: Compaction retries a conflict and opens the circuit after three failures; clearing keeps the last five tool results; a stale file write is rejected; RPC reports started, queued, or handled.
Impact: Requests over the context window replace older tool results with a placeholder. Rewriting an existing file now requires a read in the same run. Subagent text over 32000 characters is capped.
Refs: feature/context-engineering
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-03 16:19:36 +00:00

25 lines
657 B
Go

package tools
import "testing"
func TestApplySelectionDeltas(t *testing.T) {
base := []string{"read_file", "write_file", "grep"}
got := ApplySelection(base, "-write_file,+edit_file")
want := []string{"read_file", "grep", "edit_file"}
if len(got) != len(want) {
t.Fatalf("%v", got)
}
for i := range want {
if got[i] != want[i] {
t.Fatalf("got %v want %v", got, want)
}
}
replaced := ApplySelection(base, "read_file, grep")
if len(replaced) != 2 || replaced[0] != "read_file" || replaced[1] != "grep" {
t.Fatalf("bare list: %v", replaced)
}
if same := ApplySelection(base, ""); len(same) != 3 {
t.Fatalf("empty spec: %v", same)
}
}