fix(prometheus): prevent agent fallback to build in background tasks (#695)

This commit is contained in:
Nguyen Khac Trung Kien
2026-01-13 07:39:25 +07:00
committed by GitHub
parent 2314a0d371
commit 8d65748ad3
8 changed files with 139 additions and 9 deletions
+13
View File
@@ -49,6 +49,8 @@ import { getSystemMcpServerNames } from "./features/claude-code-mcp-loader";
import {
setMainSession,
getMainSessionID,
setSessionAgent,
clearSessionAgent,
} from "./features/claude-code-session-state";
import {
builtinTools,
@@ -428,11 +430,22 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
setMainSession(undefined);
}
if (sessionInfo?.id) {
clearSessionAgent(sessionInfo.id);
await skillMcpManager.disconnectSession(sessionInfo.id);
await lspManager.cleanupTempDirectoryClients();
}
}
if (event.type === "message.updated") {
const info = props?.info as Record<string, unknown> | undefined;
const sessionID = info?.sessionID as string | undefined;
const agent = info?.agent as string | undefined;
const role = info?.role as string | undefined;
if (sessionID && agent && role === "user") {
setSessionAgent(sessionID, agent);
}
}
if (event.type === "session.error") {
const sessionID = props?.sessionID as string | undefined;
const error = props?.error;