feat(web): explain callback trace backlog handling
This commit is contained in:
@@ -848,6 +848,19 @@ type CallbackRepliesWorkItemResponse = {
|
||||
summary?: CallbackReplyAuditSummary | null;
|
||||
};
|
||||
|
||||
type CallbackTraceRecoveryActionKey =
|
||||
| "unavailable"
|
||||
| "closed"
|
||||
| "investigateActiveGap"
|
||||
| "verifyInstrumentation"
|
||||
| "waitDecay"
|
||||
| "observeRecovery";
|
||||
|
||||
type CallbackTraceRecoveryAction = {
|
||||
actionKey: CallbackTraceRecoveryActionKey;
|
||||
humanRequired: boolean;
|
||||
};
|
||||
|
||||
type AiRouteRepairEvidence = {
|
||||
target_resource?: string | null;
|
||||
access_blockers?: string[];
|
||||
@@ -1627,24 +1640,54 @@ function callbackOwnerReviewOpenEvents(
|
||||
function callbackTraceRecoveryStatus(
|
||||
summary: CallbackReplyAuditSummary | null | undefined
|
||||
): WorkStatus {
|
||||
if (!summary) {
|
||||
return "blocked";
|
||||
}
|
||||
const missingTrace = summary.outbound_reply_markup_missing_trace_ref_total ?? 0;
|
||||
if (missingTrace <= 0) {
|
||||
const action = callbackTraceRecoveryAction(summary);
|
||||
if (action.actionKey === "closed") {
|
||||
return "live";
|
||||
}
|
||||
const gapStatus = summary.outbound_reply_markup_trace_ref_gap_status;
|
||||
const recoveryStatus = summary.outbound_reply_markup_trace_ref_gap_recovery_status;
|
||||
if (gapStatus === "active_gap" || recoveryStatus === "no_recovery_signal") {
|
||||
if (
|
||||
action.actionKey === "investigateActiveGap" ||
|
||||
action.actionKey === "verifyInstrumentation" ||
|
||||
action.actionKey === "unavailable"
|
||||
) {
|
||||
return "blocked";
|
||||
}
|
||||
if (recoveryStatus === "recovered_after_gap") {
|
||||
if (action.actionKey === "waitDecay") {
|
||||
return "in_progress";
|
||||
}
|
||||
return "watching";
|
||||
}
|
||||
|
||||
function callbackTraceRecoveryAction(
|
||||
summary: CallbackReplyAuditSummary | null | undefined
|
||||
): CallbackTraceRecoveryAction {
|
||||
if (!summary) {
|
||||
return { actionKey: "unavailable", humanRequired: true };
|
||||
}
|
||||
const missingTrace = summary.outbound_reply_markup_missing_trace_ref_total ?? 0;
|
||||
if (missingTrace <= 0) {
|
||||
return { actionKey: "closed", humanRequired: false };
|
||||
}
|
||||
const recent1h =
|
||||
summary.outbound_reply_markup_missing_trace_ref_recent_1h_total ?? 0;
|
||||
const recent24h =
|
||||
summary.outbound_reply_markup_missing_trace_ref_recent_24h_total ?? 0;
|
||||
const gapStatus = summary.outbound_reply_markup_trace_ref_gap_status;
|
||||
const recoveryStatus = summary.outbound_reply_markup_trace_ref_gap_recovery_status;
|
||||
if (gapStatus === "active_gap" || recent1h > 0) {
|
||||
return { actionKey: "investigateActiveGap", humanRequired: true };
|
||||
}
|
||||
if (recoveryStatus === "no_recovery_signal") {
|
||||
return { actionKey: "verifyInstrumentation", humanRequired: true };
|
||||
}
|
||||
if (recoveryStatus === "recovered_after_gap") {
|
||||
if (recent24h > 0) {
|
||||
return { actionKey: "waitDecay", humanRequired: false };
|
||||
}
|
||||
return { actionKey: "closed", humanRequired: false };
|
||||
}
|
||||
return { actionKey: "observeRecovery", humanRequired: false };
|
||||
}
|
||||
|
||||
function buildWorkItems(
|
||||
telemetry: Telemetry,
|
||||
t: ReturnType<typeof useTranslations>
|
||||
@@ -1679,6 +1722,7 @@ function buildWorkItems(
|
||||
const latestCallbackWorkItem = latestCallbackSummary?.work_item ?? null;
|
||||
const latestCallbackTriage = latestCallbackWorkItem?.triage ?? null;
|
||||
const callbackTraceSummary = telemetry.callbackReplies?.summary ?? null;
|
||||
const callbackTraceAction = callbackTraceRecoveryAction(callbackTraceSummary);
|
||||
const aiRoute = telemetry.aiRouteStatus;
|
||||
const aiRouteRepairEvidence = aiRoute?.repair_evidence ?? null;
|
||||
const aiRouteWorkItem = aiRouteRepairEvidence?.work_item ?? null;
|
||||
@@ -2055,6 +2099,25 @@ function buildWorkItems(
|
||||
}),
|
||||
evidenceDetails: callbackTraceSummary
|
||||
? [
|
||||
t("evidence.callbackTraceRecoveryAction", {
|
||||
action: t(
|
||||
`callbackTraceRecoveryActions.${callbackTraceAction.actionKey}` as never
|
||||
),
|
||||
human: t(
|
||||
`humanRequired.${callbackTraceAction.humanRequired ? "yes" : "no"}` as never
|
||||
),
|
||||
}),
|
||||
t("evidence.callbackTraceRecoveryOwner"),
|
||||
t("evidence.callbackTraceRecoveryClosure", {
|
||||
recent1h:
|
||||
callbackTraceSummary
|
||||
.outbound_reply_markup_missing_trace_ref_recent_1h_total ??
|
||||
0,
|
||||
recent24h:
|
||||
callbackTraceSummary
|
||||
.outbound_reply_markup_missing_trace_ref_recent_24h_total ??
|
||||
0,
|
||||
}),
|
||||
t("evidence.callbackTraceRecoveryDecision", {
|
||||
gap:
|
||||
callbackTraceSummary.outbound_reply_markup_trace_ref_gap_status ??
|
||||
|
||||
Reference in New Issue
Block a user