You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Four fixes from end-to-end production audit:
1. Crash recovery (C2): loadPlansFromDisk() now scans for plans stuck in
EXECUTING state and resets them to FAILED with a recovery message.
Prevents permanently wedged plans after process crashes.
2. Concurrent alert dedup race (H2): Alert ingestion now wraps the
check-then-create logic inside withCaseLock() to eliminate the TOCTOU
race. Concurrent duplicate alerts merge gracefully instead of 500.
3. HTTP error codes (M4): parseJsonBody() errors now carry httpStatus
(400 for invalid JSON, 413 for oversized body, 408 for timeout).
Catch-all handler respects these instead of returning generic 500.
4. Policy Guard thresholds (M5): Aligned confidence thresholds in
policy-guard AGENTS.md and TOOLS.md with policy.yaml per-action
values (low=0.7, medium=0.7, high=0.8, critical=0.95).
Also added GET /api/plans/:id tests confirming the endpoint exists and
works correctly (C3 was already implemented).
log("info","triage","Updated existing case with new alert",{
3972
4107
case_id: effectiveCaseId,
3973
4108
alert_id: alertId,
3974
4109
...(groupedCaseId&&{grouped_from: caseId}),
3975
4110
});
3976
4111
}else{
3977
-
// Create new case
3978
-
awaitcreateCase(caseId,caseData);
3979
-
indexCaseEntities(caseId,entities,severity);
3980
-
log("info","triage","Created new case from alert",{case_id: caseId,alert_id: alertId, severity });
4112
+
log("info","triage","Created new case from alert",{case_id: effectiveCaseId,alert_id: alertId, severity });
3981
4113
3982
4114
// Dispatch to triage agent via OpenClaw gateway
3983
4115
// NOTE: Callback URLs are NOT included in the webhook message because
@@ -3987,14 +4119,14 @@ function createServer() {
3987
4119
// callback URL templates. The agent reads case_id from this data and
3988
4120
// substitutes it into the URL pattern from its system prompt.
3989
4121
dispatchToGateway("/webhook/wazuh-alert",{
3990
-
message: `New triage task. Case ID: ${caseId}. Severity: ${severity}. Title: ${caseData.title}. Entities: ${entities.length} extracted. Follow your AGENTS.md instructions to triage this alert and advance the pipeline.`,
3991
-
case_id: caseId,
4122
+
message: `New triage task. Case ID: ${effectiveCaseId}. Severity: ${severity}. Title: ${caseData.title}. Entities: ${entities.length} extracted. Follow your AGENTS.md instructions to triage this alert and advance the pipeline.`,
4123
+
case_id: effectiveCaseId,
3992
4124
severity,
3993
4125
title: caseData.title,
3994
4126
entities_count: entities.length,
3995
4127
trigger: "alert_ingestion",
3996
4128
}).catch((err)=>{
3997
-
log("warn","dispatch","Failed to dispatch alert ingestion webhook",{case_id: caseId,error: err.message});
4129
+
log("warn","dispatch","Failed to dispatch alert ingestion webhook",{case_id: effectiveCaseId,error: err.message});
0 commit comments