feat(M4-013,M5-001,M5-002,M5-003): routing e2e tests, agent config loading, model+agent switching (#323)
Some checks failed
ci/woodpecker/push/ci Pipeline failed

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #323.
This commit is contained in:
2026-03-23 01:09:09 +00:00
committed by jason.woltje
parent 1035d13fc0
commit 701bb69e6c
5 changed files with 277 additions and 10 deletions

View File

@@ -341,7 +341,7 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
}
/**
* Set a per-conversation model override (M4-007).
* Set a per-conversation model override (M4-007 / M5-002).
* When set, the routing engine is bypassed and the specified model is used.
* Pass null to clear the override and resume automatic routing.
* M5-005: Emits session:info to clients subscribed to this conversation when a model is set.
@@ -356,11 +356,7 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
this.agentService.updateSessionModel(conversationId, modelName);
// M5-005: Broadcast session:info to all clients subscribed to this conversation
const agentSession = this.agentService.getSession(conversationId);
if (agentSession) {
// Find all clients subscribed to this conversation and emit updated session:info
this.broadcastSessionInfo(conversationId);
}
this.broadcastSessionInfo(conversationId);
} else {
modelOverrides.delete(conversationId);
this.logger.log(`Model override cleared: conversation=${conversationId}`);
@@ -386,13 +382,14 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
if (!agentSession) return;
const piSession = agentSession.piSession;
const resolvedAgentName = extra?.agentName ?? agentSession.agentName;
const payload = {
conversationId,
provider: agentSession.provider,
modelId: agentSession.modelId,
thinkingLevel: piSession.thinkingLevel,
availableThinkingLevels: piSession.getAvailableThinkingLevels(),
...(extra?.agentName ? { agentName: extra.agentName } : {}),
...(resolvedAgentName ? { agentName: resolvedAgentName } : {}),
...(extra?.routingDecision ? { routingDecision: extra.routingDecision } : {}),
};