fix traffic observability, tg alerting robustness and prod compose ports
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 7s

This commit is contained in:
OG T
2026-06-07 20:38:19 +08:00
parent 3b665e4cbe
commit 663ad4d3a2
6 changed files with 436 additions and 34 deletions

View File

@@ -190,6 +190,9 @@ export async function GET(request: NextRequest) {
totalRows,
latestEvents,
judgeCompleteRows,
demandPoolCount,
demandPoolNewRows,
demandPoolScopeStats,
] = await Promise.all([
prisma.auditEvent.groupBy({
by: ["action"],
@@ -247,8 +250,48 @@ export async function GET(request: NextRequest) {
metadata: true,
},
}),
prisma.task.count({
where: {
status: "OPEN",
title: {
not: {
startsWith: "GitHub Issue:",
},
},
},
}),
prisma.task.count({
where: {
status: "OPEN",
title: {
not: {
startsWith: "GitHub Issue:",
},
},
created_at: { gte: since },
},
}),
prisma.task.aggregate({
where: {
status: "OPEN",
title: {
not: {
startsWith: "GitHub Issue:",
},
},
},
_avg: {
scope_clarity_score: true,
},
}),
]);
const demandSupply = {
open_task_count: demandPoolCount,
new_open_tasks_in_window: demandPoolNewRows,
avg_scope_clarity: demandPoolScopeStats._avg.scope_clarity_score,
};
let capturedPayoutCount = 0;
let releasedPayoutCount = 0;
try {
@@ -429,9 +472,12 @@ export async function GET(request: NextRequest) {
latest_surface: string;
latest_source_ip: string;
latest_user_agent: string;
latest_task_id: string;
latest_response_status: number | null;
latest_response_summary: string;
latest_reason: string;
latest_payload_summary: string;
latest_request_id: string;
latest_created_at_ms: number;
}> = new Map();
@@ -471,13 +517,34 @@ export async function GET(request: NextRequest) {
latest_surface: normalizedSurface,
latest_source_ip: normalizedIp,
latest_user_agent: normalizedUa,
latest_task_id: taskId,
latest_response_status: responseStatus,
latest_response_summary: responseSummary,
latest_reason: event.reason || "unknown",
latest_payload_summary:
typeof metadata?.payload_summary === "string" ? metadata.payload_summary : "unknown",
latest_request_id:
typeof metadata?.request_id === "string" ? metadata.request_id : "unknown",
latest_created_at_ms: eventAt,
});
} else {
existingActorActivity.events += 1;
if (eventAt > existingActorActivity.latest_created_at_ms) {
existingActorActivity.latest_action = event.action;
existingActorActivity.latest_surface = normalizedSurface;
existingActorActivity.latest_source_ip = normalizedIp;
existingActorActivity.latest_user_agent = normalizedUa;
existingActorActivity.latest_task_id = taskId;
existingActorActivity.latest_response_status = responseStatus;
existingActorActivity.latest_response_summary = responseSummary;
existingActorActivity.latest_reason = event.reason || "unknown";
existingActorActivity.latest_payload_summary =
typeof metadata?.payload_summary === "string" ? metadata.payload_summary : "unknown";
existingActorActivity.latest_request_id =
typeof metadata?.request_id === "string" ? metadata.request_id : "unknown";
existingActorActivity.latest_created_at_ms = eventAt;
}
}
if (
@@ -566,6 +633,7 @@ export async function GET(request: NextRequest) {
period_minutes: minutes,
total_events: totalRows,
action_summary: actionSummary,
demand_supply: demandSupply,
channel_summary: channelSummary,
actor_summary: actorSummary,
external_actor_summary: externalActorSummary,