mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-04 12:50:37 +01:00
Slack mentions now start eyes reactions after the authorized task/comment commits, independently of attachments, subscription and scheduler acceptance. Omit unused optional URL-preview polling while retaining message text, links and files. Keep receipt failures and missing-file warnings independent, including terminal cleanup of older multi-line diagnostics. Verified with full current-head CI and E2E, Superagent and legacy security checks, Apex 5/5 with no unresolved findings, 19 selected real-PostgreSQL receipt/authorization/cleanup cases, and full frozen-source typecheck/build. The first CI attempt's unchanged Cursor probe timeout is retained in the PR; the one failed-only retry passed under unchanged deadlines. Live Slack latency still requires deployed acceptance. Co-Authored-By: Paperclip <noreply@paperclip.ing>
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { trace, type Span } from "@opentelemetry/api";
|
|
|
|
// Closed, content-free Observability dimensions. No provider IDs or content.
|
|
export function beginSlackReceiptTiming(input: {
|
|
operation: "add" | "remove";
|
|
queuedAt: Date;
|
|
receivedAt: Date | null;
|
|
}) {
|
|
if (!process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim()) return () => {};
|
|
let span: Span | undefined;
|
|
try {
|
|
span = trace.getTracer("paperclip.chat").startSpan("chat.slack.receipt", {
|
|
attributes: {
|
|
"paperclip.chat.receipt.operation": input.operation,
|
|
"paperclip.chat.receipt.queue_ms": Math.max(0, Date.now() - input.queuedAt.getTime()),
|
|
},
|
|
});
|
|
} catch { /* Tracing cannot prevent the reaction. */ }
|
|
return (outcome: "confirmed" | "failed") => {
|
|
try {
|
|
span?.setAttribute("paperclip.chat.receipt.outcome", outcome);
|
|
if (input.receivedAt) span?.setAttribute("paperclip.chat.receipt.delivery_age_ms", Math.max(0, Date.now() - input.receivedAt.getTime()));
|
|
} catch { /* Tracing cannot change provider settlement. */ }
|
|
try { span?.end(); } catch { /* Best-effort span completion. */ }
|
|
};
|
|
}
|