Add Slack alerts and skill-aware monitoring

This commit is contained in:
dahyeon committed 2026-05-18 19:11:05 -07:00
1 parent b63985694a
commit f1b30d716d
19 files changed
+1288 -112

No files matched your search

+8 -2
View File
@@ -10,6 +10,7 @@ import type { NatsClient } from "@common/nats";
import type { LlmClient } from "@llm/llm-client";
import { AlertService } from "@obs/alert";
import { metrics } from "@obs/metrics";
import { createSlackNotifierFromEnv } from "@obs/slack-notifier";
import type { Skill } from "@skills/skill";
import type { SkillCapabilityCard, SkillRegistry } from "@skills/skill-loader";
import { getLogger } from "@obs/logger";
@@ -52,7 +53,11 @@ export class SupervisorSkill implements Skill {
private readonly llmClient?: Pick<LlmClient, "chatCompletion"> | undefined,
private readonly skillRegistry?: SkillRegistry | undefined,
) {
this.alertService = new AlertService(garnetClient, natsClient);
this.alertService = new AlertService(
garnetClient,
natsClient,
createSlackNotifierFromEnv(),
);
}
canHandle(request: AgentRequest): boolean {
@@ -83,13 +88,14 @@ export class SupervisorSkill implements Skill {
target: target ?? "human-review",
userId: request.userId,
});
metrics.humanOverrideTotal.inc({ kind: reason });
metrics.humanOverrideTotal.inc({ kind: reason, skill: this.name });
await this.alertService.sendAlert(
{
kind: "supervisor-handoff",
metric: "agent.supervisor_handoff",
severity: "warn",
skill: this.name,
suggestedAction: "Review the supervisor handoff queue.",
threshold: 0,
timestamp: new Date().toISOString(),