fix(v2): AI_FALLBACK replaces the ACTIONABLE_NOW-with-confidence-0 lie, normalize null-like strings
Fallback (ai_disabled, ai_error, invalid_json, ai_max_candidates_cap -- any candidate the AI never actually analyzed) now produces classification 'AI_FALLBACK', an explicit technical state that is never part of the 11-class enum sent to OpenAI (the AI itself can never legitimately return it). Previously it silently claimed ACTIONABLE_NOW with confidence 0, which made unanalyzed tickets indistinguishable from genuinely confirmed ones at the classification-label level. Also normalizes blocker_type/waiting_for when the model returns the literal string "null"/"none"/"n/a"/"" instead of JSON null -- done once, in the validation layer (logic/classification.js), not scattered around the workflow. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
db7a261a10
commit
00a42db269
+11
-4
@@ -1,11 +1,18 @@
|
||||
// AI_FALLBACK e um estado tecnico: significa "a IA nunca analisou este chamado" (erro,
|
||||
// timeout, IA desligada, JSON invalido, ou cortado pelo limite de AI_MAX_CANDIDATES). NAO e
|
||||
// uma conclusao da IA -- por isso nunca usa uma das 11 classes que a IA pode retornar
|
||||
// (ver logic/classification.js). Politica de elegibilidade fica centralizada em
|
||||
// logic/cooldown.js (applyFallbackPolicy), nao aqui.
|
||||
const AI_FALLBACK_CLASSIFICATION = 'AI_FALLBACK';
|
||||
|
||||
function buildFallbackClassification(reason) {
|
||||
return {
|
||||
classification: 'ACTIONABLE_NOW',
|
||||
actionable_today: true,
|
||||
classification: AI_FALLBACK_CLASSIFICATION,
|
||||
actionable_today: false,
|
||||
confidence: 0,
|
||||
blocker_type: null,
|
||||
waiting_for: null,
|
||||
next_action: 'Revisar chamado manualmente',
|
||||
next_action: 'Revisar chamado manualmente (nao analisado pela IA)',
|
||||
suggested_action_type: 'manual_review',
|
||||
business_risk: 'medium',
|
||||
reason: `Fallback deterministico: ${reason}`,
|
||||
@@ -15,4 +22,4 @@ function buildFallbackClassification(reason) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { buildFallbackClassification };
|
||||
module.exports = { buildFallbackClassification, AI_FALLBACK_CLASSIFICATION };
|
||||
|
||||
Reference in New Issue
Block a user