fix(governor): classify multi-word greetings ('hey there!', 'good morning') and short verb-less messages as conversational so they don't trigger the agent loop

This commit is contained in:
2026-06-10 17:50:31 -07:00
parent 756fe7b092
commit 1dcebe0fa7

View File

@@ -113,14 +113,26 @@ function classifyTurnIntent(message: string): TurnIntent {
)
return "status_check";
// Conversational fallback — ONLY when the entire message is a greeting or a
// bare acknowledgement. Previously `/^(ok|...)/` matched "ok" as a prefix of
// "okay <real request>", misclassifying real work as chat (budget 1) and
// causing round_cap cut-offs. Require the whole message to be the ack.
// Conversational: greetings, acknowledgements, and short pleasantries.
// By this point we've already matched action verbs, diagnostics, and
// questions, so anything that *starts* with a greeting/ack, or is a very
// short verb-less leftover, is chat — reply in text, don't run the agent
// loop. Note we still avoid the old `/^(ok)/` prefix bug: "okay is the auth
// connected up?" already returned `status_check` above (ends with "?").
const wordCount = m.split(/\s+/).filter(Boolean).length;
if (
/^(hi|hey|hello|yo|thanks|thank you|ok|okay|kk|k|yes|yep|yeah|yup|no|nope|nah|sure|cool|nice|great|awesome|perfect)[\s!.?]*$/.test(
// Greetings (incl. multi-word: "hey there!", "good morning")
/^(hi|hey|hello|heya|hiya|yo|sup|howdy|greetings|good (morning|afternoon|evening|day))\b/.test(
m,
)
) ||
// Acknowledgements / pleasantries
/^(thanks|thank you|ty|ok|okay|kk|k|yes|yep|yeah|yup|no|nope|nah|sure|cool|nice|great|awesome|perfect|got it|sounds good|will do|nvm|never mind)\b/.test(
m,
) ||
/(what'?s up|how are you|how'?s it going|good to see you)/.test(m) ||
// Very short, verb-less, non-question leftovers are ambiguous → treat as
// chat and let the model ask, rather than spinning up a 40-round build.
(wordCount <= 4 && m.length <= 30 && !m.endsWith("?"))
)
return "conversational";