Recognise smalltalk that is addressed by name
"Thank you Owliver" was answered with a six-section operational briefing: decision backlog, screening backlog, two at-risk roles, shift coverage, overtime, withdrawals, five numbered next steps and three policy citations. Tools were called and the corpus was retrieved, for a message that said thanks. The set held "thank you" and it held "hi owliver". It did not hold the two together, because the name variants had been written out by hand for the greetings and never for the thanks or the farewells. That is the failure mode of enumerating a cross product: one half gets maintained and the other half silently does not, and nothing points at the gap. So the name comes off once, in stripVocative, and the set holds each phrase exactly once. "Thanks Owliver", "Owliver hi" and "Good night Owliver" all reduce to a row that already existed. The three hand-written "hi owliver" rows are gone; "owliver" alone stays, since that is somebody getting the agent's attention rather than a phrase with a name attached. Stripped only at an end and only as a whole word. "ask owliver to check the rota" and "hi owliver which positions are at risk" keep their tools and their evidence — a message that asks for something is not smalltalk however politely it opens. Both directions are tested. Also adds the thanks nobody had written down yet: thankyou, thx, tysm, thank you so much, much appreciated, perfect thanks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -176,3 +176,35 @@ func TestCatalogueWithheldOnceToolBudgetIsSpent(t *testing.T) {
|
||||
t.Errorf("the final call carried %d tool definitions; the tool budget was spent", n)
|
||||
}
|
||||
}
|
||||
|
||||
// The case from production: "Thank you Owliver" answered with a six-section
|
||||
// operational briefing — tools, retrieval, citations, next steps — because the
|
||||
// set held "thank you" and "hi owliver" but not the two together.
|
||||
func TestSmalltalkSurvivesBeingAddressedByName(t *testing.T) {
|
||||
for _, q := range []string{
|
||||
"Thank you Owliver", "thanks owliver", "Thanks, Owliver!",
|
||||
"Owliver hi", "hi owliver", "Hello Owliver",
|
||||
"Good morning Owliver", "good night owliver", "bye owliver",
|
||||
"owliver", "Owliver?",
|
||||
} {
|
||||
if !isSmalltalk(q) {
|
||||
t.Errorf("isSmalltalk(%q) = false; a greeting addressed by name is still a greeting", q)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The name comes off only as a vocative at an end. A real question that
|
||||
// mentions the agent is still a real question.
|
||||
func TestAQuestionMentioningTheNameIsNotSmalltalk(t *testing.T) {
|
||||
for _, q := range []string{
|
||||
"ask owliver to check the rota",
|
||||
"owliver how many shifts are uncovered",
|
||||
"thanks owliver now show me the backlog",
|
||||
"is owliver working",
|
||||
"hi owliver which positions are at risk",
|
||||
} {
|
||||
if isSmalltalk(q) {
|
||||
t.Errorf("isSmalltalk(%q) = true; this asks for something and must keep its tools", q)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user