fix: route model mentions by intent
CI / test (push) Successful in 50s
CI / test (pull_request) Successful in 49s

This commit is contained in:
m
2026-08-24 01:46:34 +03:00
parent e93f810946
commit 4cdd1a5276
3 changed files with 14 additions and 4 deletions
@@ -6,7 +6,7 @@
"risk_tier": "E",
"intent": "Make the default chat path refuse unverified factual answers instead of exposing model speculation; preserve explicitly classified internal status paths and leave a general research capability for the next routing stage.",
"requirement_ids": ["truth-first default", "no fabricated factual answers", "semantic routing without entity word lists"],
"allowed_change_scope": {"modules": ["creator-web", "cognitive-worker"], "paths": ["cmd/creator-web/server.go", "cmd/creator-web/chat_test.go", "cmd/cognitive-worker/interpretation.go", "cmd/cognitive-worker/interpretation_test.go", "dev/ACTIVE_TASK.json", "dev/tasks/DEV-000274-truth-first-question-gate.json", "docs/PROJECT_STATUS.md", "docs/evidence/**"]},
"allowed_change_scope": {"modules": ["creator-web", "cognitive-worker", "interaction"], "paths": ["cmd/creator-web/server.go", "cmd/creator-web/chat_test.go", "cmd/cognitive-worker/interpretation.go", "cmd/cognitive-worker/interpretation_test.go", "modules/interaction/domain/chat.go", "modules/interaction/domain/chat_test.go", "dev/ACTIVE_TASK.json", "dev/tasks/DEV-000274-truth-first-question-gate.json", "docs/PROJECT_STATUS.md", "docs/evidence/**"]},
"forbidden_change_scope": {"paths": ["architecture/**", "security/**", "database/**", "contracts/**", "deploy/**", "LLM-local/**"]},
"allowed_architecture_delta": {"new_cross_module_dependencies": 0, "new_canonical_owners": 0, "new_privileges": 0, "new_third_party_dependencies": 0, "new_database_owner_roles": 0},
"contracts": {"consume": ["existing semantic speech act and information request", "existing local cognitive gateway"], "may_change": ["truthful chat presentation gate", "interpretation prompt guidance"]},
@@ -17,7 +17,7 @@
"persistence_and_migrations": ["none"],
"failure_retry_restart": ["missing research capability never becomes a fabricated answer"],
"assumptions": ["a later task will connect WEB_RESEARCH to a read-only source connector", "explicit user requests to discuss hypotheses/options remain a separate cognitive path"],
"acceptance_scenarios": ["weather-like factual question does not expose a model-generated answer without evidence", "response explains that verification is unavailable and names safe source category", "internal classified status path remains functional", "no city/entity keyword list is introduced"],
"acceptance_scenarios": ["weather-like factual question does not expose a model-generated answer without evidence", "response explains that verification is unavailable and names safe source category", "internal classified status path remains functional", "an incidental word such as model does not open an inventory or verification route", "routing uses semantic intent rather than city/entity keyword lists"],
"required_tests": ["go test ./cmd/creator-web/... ./cmd/cognitive-worker/...", "go vet ./cmd/creator-web/... ./cmd/cognitive-worker/...", "go run ./cmd/devctl preflight -active dev/ACTIVE_TASK.json", "go run ./cmd/devctl check-diff -active dev/ACTIVE_TASK.json", "go run ./cmd/devctl check-architecture", "go run ./cmd/devctl/independent", "git diff --check", "CI", "production health smoke"],
"terminal_gap_states": ["BLOCKED_BY_MISSING_CAPABILITY"]
}
+3 -2
View File
@@ -432,10 +432,11 @@ func capabilityHintsFor(primary, secondary interaction.SpeechAct, tokens []strin
if containsInterrogative(tokens) && containsArithmetic(tokens) {
add("COGNITIVE_REASONING")
}
if containsToken(tokens, "свободно") || containsToken(tokens, "гб") || containsToken(tokens, "модель") {
if containsToken(tokens, "свободно") || containsToken(tokens, "гб") {
add("VERIFY_FACT")
}
if containsStemInTokens(tokens, "модел", "ии") && containsStemInTokens(tokens, "настро", "список", "доступ", "подключ") {
modelIntent := containsStemInTokens(tokens, "настро", "список", "доступ", "подключ", "сравн", "выбер", "провер", "проверь", "перечисл")
if containsStemInTokens(tokens, "модел", "ии") && modelIntent && (primary == interaction.SpeechActQuestion || primary == interaction.SpeechActDirective || primary == interaction.SpeechActRequestToInvestigate || secondary == interaction.SpeechActQuestion || secondary == interaction.SpeechActDirective || secondary == interaction.SpeechActRequestToInvestigate) {
add("VERIFY_FACT")
}
values := make([]string, 0, len(seen))
+9
View File
@@ -103,6 +103,15 @@ func TestDeterministicCandidateTreatsModelRequestAsDirectiveNeedingCognition(t *
}
}
func TestAWordModelDoesNotTriggerModelInventoryOrVerification(t *testing.T) {
candidate := BuildDeterministicCandidate("модель должна понимать смысл вопроса", "", time.Unix(10, 0).UnixMilli())
for _, hint := range candidate.CapabilityHints {
if hint == "VERIFY_FACT" {
t.Fatalf("an incidental model mention must not trigger fact verification: %+v", candidate)
}
}
}
func TestInformationRequestsAreClassifiedOnceByInteraction(t *testing.T) {
cases := []struct {
message string