feat(routing): add auto_escalate retry to complex tier

This commit is contained in:
William Valentin
2026-02-17 10:39:47 -08:00
parent d67cfa64a6
commit 70bb14a6f6
3 changed files with 97 additions and 1 deletions
+14 -1
View File
@@ -888,7 +888,20 @@ export function createMessageRouter(deps: {
}
}
const response = await agent.process(messageText, attachments);
let response: string;
try {
response = await agent.process(messageText, attachments);
} catch (error) {
const currentTier = agent.getModelTier();
const canEscalate = deps.config.agents.auto_escalate && currentTier !== 'complex';
if (!canEscalate) {
throw error;
}
console.warn(`Auto-escalating session ${msg.channel}:${msg.senderId} from ${currentTier} to complex after processing failure.`);
agent.setModelTier('complex');
response = await agent.process(messageText, attachments);
}
const outboundAttachments = collector.drain();
await reply({
text: response,