Stop the text-search comment naming one language
CI / test (push) Successful in 1m41s

The choice is unchanged and now better argued: a deployment does not announce
which language its notes are in, so any stemmer picked here is the wrong one
somewhere — and applying the wrong one does not fail loudly, it quietly stops
finding things.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5 committed 2026-09-27 08:09:49 +02:00
1 parent 2bf7de1a43
commit f2f375d824
2 files changed
+8 -5

No files matched your search

+2 -2
View File
@@ -113,7 +113,7 @@ func TestASystemMessageIsNeverDropped(t *testing.T) {
// a forgotten turn — and much harder to spot, because the model keeps
// answering.
history := []store.Message{
{Role: "system", Content: "You only answer in Turkish."},
{Role: "system", Content: "Answer only in the user's own language."},
{Role: "user", Content: strings.Repeat("x", 500)},
{Role: "assistant", Content: strings.Repeat("y", 500)},
}
@@ -126,7 +126,7 @@ func TestASystemMessageIsNeverDropped(t *testing.T) {
if dropped != 2 {
t.Errorf("dropped %d turns, expected both non-system ones", dropped)
}
if got := strings.Join(splicedRoles(t, out), "|"); !strings.Contains(got, "only answer in Turkish") {
if got := strings.Join(splicedRoles(t, out), "|"); !strings.Contains(got, "user's own language") {
t.Errorf("the system message was dropped: %s", got)
}
}
@@ -29,9 +29,12 @@ CREATE TABLE memory_notes (
-- Touched on every write, so retention measures how long a note has gone
-- unrefreshed rather than how old it is.
updated_at BIGINT NOT NULL,
-- 'simple' rather than a language configuration: these are an agent's own
-- notes, in whatever language it chose, and stemming English rules over
-- Turkish text would quietly stop finding things.
-- 'simple' rather than a language configuration. These are an agent's own
-- notes, in whatever language it chose, and a deployment does not announce
-- which that is — so any stemmer picked here is the wrong one somewhere.
-- Applying English rules to text that is not English does not fail loudly:
-- it quietly stops finding things, which is the worst way for a search to
-- be wrong.
search tsvector GENERATED ALWAYS AS (
to_tsvector('simple', coalesce(key, '') || ' ' || coalesce(text, '') || ' ' || coalesce(tags, ''))
) STORED,