fix(agents): apply telegram monitoring live receipts
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m14s
CD Pipeline / build-and-deploy (push) Successful in 4m49s
CD Pipeline / post-deploy-checks (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m14s
CD Pipeline / build-and-deploy (push) Successful in 4m49s
CD Pipeline / post-deploy-checks (push) Has been cancelled
This commit is contained in:
@@ -391,6 +391,55 @@ type TelegramMonitoringCoveragePayload = {
|
||||
} | null;
|
||||
};
|
||||
|
||||
type TelegramMonitoringLiveReceiptApplyReadbackPayload = {
|
||||
status?: string | null;
|
||||
active_blockers?: string[] | null;
|
||||
operator_answer?: {
|
||||
all_ai_controlled_live_receipt_batches_have_apply_receipt?: boolean | null;
|
||||
metadata_live_receipt_apply_performed?: boolean | null;
|
||||
metadata_apply_does_not_mark_monitoring_live_receipt_accepted?: boolean | null;
|
||||
monitoring_live_receipt_gap_count_source_truth?: number | null;
|
||||
} | null;
|
||||
rollups?: {
|
||||
expected_live_receipt_batch_count?: number | null;
|
||||
applied_live_receipt_batch_count?: number | null;
|
||||
ready_live_receipt_binding_count?: number | null;
|
||||
expected_surface_count?: number | null;
|
||||
applied_surface_count?: number | null;
|
||||
expected_write_capable_surface_count?: number | null;
|
||||
applied_write_capable_surface_count?: number | null;
|
||||
metadata_only_receipt_count?: number | null;
|
||||
post_apply_verifier_ref_count?: number | null;
|
||||
monitoring_live_receipt_gap_count_source_truth?: number | null;
|
||||
metadata_live_receipt_apply_readback_ready?: boolean | null;
|
||||
runtime_target_write_performed?: boolean | null;
|
||||
} | null;
|
||||
live_receipt_bindings?: Array<{
|
||||
batch_id?: string | null;
|
||||
domain?: string | null;
|
||||
priority?: string | null;
|
||||
status?: string | null;
|
||||
surface_count?: number | null;
|
||||
write_capable_surface_count?: number | null;
|
||||
target_write_performed?: boolean | null;
|
||||
tag_hints?: {
|
||||
product_id?: string | null;
|
||||
service_name?: string | null;
|
||||
tool_id?: string | null;
|
||||
} | null;
|
||||
}> | null;
|
||||
operation_boundaries?: {
|
||||
runtime_target_write_performed?: boolean | null;
|
||||
monitoring_inventory_source_mutated?: boolean | null;
|
||||
monitoring_live_receipt_acceptance_mutated?: boolean | null;
|
||||
telegram_send_performed?: boolean | null;
|
||||
bot_api_call_performed?: boolean | null;
|
||||
raw_alert_payload_stored?: boolean | null;
|
||||
secret_value_read?: boolean | null;
|
||||
github_api_used?: boolean | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
type PanelMode = "full" | "compact";
|
||||
type Tone = "ok" | "warn" | "neutral";
|
||||
type WorkFilter = "all" | "completed" | "active" | "pending" | "blocked";
|
||||
@@ -549,6 +598,23 @@ async function fetchTelegramMonitoringCoverage(): Promise<TelegramMonitoringCove
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchTelegramMonitoringLiveReceiptApplyReadback(): Promise<TelegramMonitoringLiveReceiptApplyReadbackPayload | null> {
|
||||
const controller = new AbortController();
|
||||
const timeout = window.setTimeout(() => controller.abort(), 12_000);
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/api/v1/agents/telegram-alert-monitoring-live-receipt-apply-readback`, {
|
||||
cache: "no-store",
|
||||
signal: controller.signal,
|
||||
});
|
||||
if (!response.ok) return null;
|
||||
return (await response.json()) as TelegramMonitoringLiveReceiptApplyReadbackPayload;
|
||||
} catch {
|
||||
return null;
|
||||
} finally {
|
||||
window.clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
|
||||
export function AutonomousRuntimeReceiptPanel({
|
||||
mode = "full",
|
||||
}: {
|
||||
@@ -561,6 +627,8 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
const [consumerPayload, setConsumerPayload] = useState<LogConsumerReadbackPayload | null>(null);
|
||||
const [telegramVerifierPayload, setTelegramVerifierPayload] = useState<TelegramPostApplyVerifierPayload | null>(null);
|
||||
const [telegramCoveragePayload, setTelegramCoveragePayload] = useState<TelegramMonitoringCoveragePayload | null>(null);
|
||||
const [telegramLiveReceiptApplyPayload, setTelegramLiveReceiptApplyPayload] =
|
||||
useState<TelegramMonitoringLiveReceiptApplyReadbackPayload | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState(false);
|
||||
const [updatedAt, setUpdatedAt] = useState<Date | null>(null);
|
||||
@@ -568,18 +636,27 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
setLoading(true);
|
||||
const [next, priority, consumer, telegramVerifier, telegramCoverage] = await Promise.all([
|
||||
const [
|
||||
next,
|
||||
priority,
|
||||
consumer,
|
||||
telegramVerifier,
|
||||
telegramCoverage,
|
||||
telegramLiveReceiptApply,
|
||||
] = await Promise.all([
|
||||
fetchRuntimeControl(),
|
||||
fetchPriorityWorkOrder(),
|
||||
fetchLogConsumerReadback(),
|
||||
fetchTelegramPostApplyVerifier(),
|
||||
fetchTelegramMonitoringCoverage(),
|
||||
fetchTelegramMonitoringLiveReceiptApplyReadback(),
|
||||
]);
|
||||
setPayload(next);
|
||||
setPriorityPayload(priority);
|
||||
setConsumerPayload(consumer);
|
||||
setTelegramVerifierPayload(telegramVerifier);
|
||||
setTelegramCoveragePayload(telegramCoverage);
|
||||
setTelegramLiveReceiptApplyPayload(telegramLiveReceiptApply);
|
||||
setError(next === null);
|
||||
setUpdatedAt(next ? new Date() : null);
|
||||
setLoading(false);
|
||||
@@ -596,6 +673,7 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
const hasConsumerReadback = consumerPayload !== null;
|
||||
const hasTelegramVerifierReadback = telegramVerifierPayload !== null;
|
||||
const hasTelegramCoverageReadback = telegramCoveragePayload !== null;
|
||||
const hasTelegramLiveReceiptApplyReadback = telegramLiveReceiptApplyPayload !== null;
|
||||
const readback = payload?.runtime_receipt_readback;
|
||||
const ledger = readback?.autonomous_execution_loop_ledger;
|
||||
const traceLedger = readback?.trace_ledger;
|
||||
@@ -626,6 +704,9 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
const telegramCoverageTags = telegramCoveragePayload?.required_tag_dimensions ?? [];
|
||||
const telegramCoverageAssetKinds = telegramCoveragePayload?.monitoring_asset_rollups?.by_config_kind ?? {};
|
||||
const telegramCoverageAssetKindNames = Object.keys(telegramCoverageAssetKinds).slice(0, 5);
|
||||
const telegramLiveReceiptApplyRollups = telegramLiveReceiptApplyPayload?.rollups ?? {};
|
||||
const telegramLiveReceiptApplyBindings = telegramLiveReceiptApplyPayload?.live_receipt_bindings ?? [];
|
||||
const telegramLiveReceiptApplyBlockers = telegramLiveReceiptApplyPayload?.active_blockers ?? [];
|
||||
const consumerReady = consumerRollups.controlled_consumer_readback_ready === true
|
||||
|| consumerPayload?.status === "controlled_writeback_consumer_readback_ready";
|
||||
const telegramPostApplyVerifierReady =
|
||||
@@ -634,6 +715,9 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
const telegramMonitoringCoverageReady =
|
||||
telegramCoverageSummary.full_coverage_ready === true
|
||||
|| telegramCoveragePayload?.status === "telegram_alert_monitoring_coverage_ready";
|
||||
const telegramLiveReceiptApplyReady =
|
||||
telegramLiveReceiptApplyRollups.metadata_live_receipt_apply_readback_ready === true
|
||||
|| telegramLiveReceiptApplyPayload?.status === "telegram_monitoring_live_receipt_apply_readback_ready";
|
||||
const runtimeTargetWritePerformed = consumerRollups.runtime_target_write_performed === true
|
||||
|| consumerPayload?.controlled_consume?.runtime_target_write_performed === true
|
||||
|| consumerPayload?.operation_boundaries?.runtime_target_write_performed === true
|
||||
@@ -1300,6 +1384,30 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
? "ok" as Tone
|
||||
: "warn" as Tone,
|
||||
},
|
||||
{
|
||||
key: "apply",
|
||||
label: t("monitoringCoverage.apply"),
|
||||
value: readbackRatio(
|
||||
telegramLiveReceiptApplyRollups.applied_live_receipt_batch_count,
|
||||
telegramLiveReceiptApplyRollups.expected_live_receipt_batch_count,
|
||||
hasTelegramLiveReceiptApplyReadback
|
||||
),
|
||||
detail: t("monitoringCoverage.applyDetail", {
|
||||
surfaces: readbackRatio(
|
||||
telegramLiveReceiptApplyRollups.applied_surface_count,
|
||||
telegramLiveReceiptApplyRollups.expected_surface_count,
|
||||
hasTelegramLiveReceiptApplyReadback
|
||||
),
|
||||
gap: readbackNumber(
|
||||
telegramLiveReceiptApplyRollups.monitoring_live_receipt_gap_count_source_truth,
|
||||
hasTelegramLiveReceiptApplyReadback
|
||||
),
|
||||
}),
|
||||
icon: CheckCircle2,
|
||||
tone: !hasTelegramLiveReceiptApplyReadback
|
||||
? "neutral" as Tone
|
||||
: telegramLiveReceiptApplyReady ? "ok" as Tone : "warn" as Tone,
|
||||
},
|
||||
{
|
||||
key: "delivery",
|
||||
label: t("monitoringCoverage.delivery"),
|
||||
@@ -1627,7 +1735,7 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
})}
|
||||
</div>
|
||||
{mode === "full" ? (
|
||||
<div className="grid gap-px border-t border-[#e0ddd4] bg-[#e0ddd4] lg:grid-cols-3">
|
||||
<div className="grid gap-px border-t border-[#e0ddd4] bg-[#e0ddd4] lg:grid-cols-2 xl:grid-cols-4">
|
||||
<div className="bg-white px-4 py-3">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<p className="text-xs font-semibold text-[#77736a]">
|
||||
@@ -1660,6 +1768,64 @@ export function AutonomousRuntimeReceiptPanel({
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white px-4 py-3">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<p className="text-xs font-semibold text-[#77736a]">
|
||||
{t("monitoringCoverage.applyReadback")}
|
||||
</p>
|
||||
<span className="font-mono text-xs text-[#77736a]">
|
||||
{readbackRatio(
|
||||
telegramLiveReceiptApplyRollups.applied_live_receipt_batch_count,
|
||||
telegramLiveReceiptApplyRollups.expected_live_receipt_batch_count,
|
||||
hasTelegramLiveReceiptApplyReadback
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="mt-3 grid gap-2">
|
||||
{telegramLiveReceiptApplyBindings.length > 0 ? (
|
||||
telegramLiveReceiptApplyBindings.slice(0, 4).map((item) => (
|
||||
<div
|
||||
key={item.batch_id ?? item.domain ?? "live-receipt"}
|
||||
className="grid gap-1 border border-[#eee9dd] px-2 py-1.5"
|
||||
>
|
||||
<div className="flex min-w-0 items-center justify-between gap-2">
|
||||
<span className="min-w-0 truncate text-xs font-semibold text-[#141413]">
|
||||
{item.domain ?? item.batch_id ?? "--"}
|
||||
</span>
|
||||
<span className={cn(
|
||||
"shrink-0 border px-2 py-0.5 text-xs font-semibold",
|
||||
toneClass(item.target_write_performed ? "ok" : "warn")
|
||||
)}>
|
||||
{item.target_write_performed ? t("proof.ok") : t("states.open")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 font-mono text-xs text-[#77736a]">
|
||||
<span className="truncate">{item.batch_id ?? item.status ?? "--"}</span>
|
||||
{typeof item.surface_count === "number" ? (
|
||||
<span>
|
||||
{t("monitoringCoverage.surfaces", { count: item.surface_count })}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<span className="truncate text-xs text-[#5f5b52]">
|
||||
{[
|
||||
item.tag_hints?.product_id,
|
||||
item.tag_hints?.service_name,
|
||||
item.tag_hints?.tool_id,
|
||||
].filter(Boolean).join(" / ") || item.status || "--"}
|
||||
</span>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div className={cn(
|
||||
"border px-2 py-2 text-xs font-semibold",
|
||||
toneClass(telegramLiveReceiptApplyBlockers.length > 0 ? "warn" : "neutral")
|
||||
)}>
|
||||
{telegramLiveReceiptApplyBlockers[0] ?? t("states.loading")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white px-4 py-3">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<p className="text-xs font-semibold text-[#77736a]">
|
||||
|
||||
Reference in New Issue
Block a user