feat(diagnostics): add outbound delivery lifecycle events#71471
feat(diagnostics): add outbound delivery lifecycle events#71471vincentkoc merged 2 commits intomainfrom
Conversation
Greptile SummaryThis PR adds three new diagnostic events ( Confidence Score: 5/5Safe to merge — changes are additive, well-tested, and consistent with established patterns in the codebase. No P0 or P1 issues found. The implementation correctly uses guard flags (deliveryStarted/deliveryFinished) to prevent duplicate or missing diagnostic events, follows the same spanWithDuration + span.end(evt.ts) pattern used by all other OTEL event handlers, and the privacy controls (no body text, recipient, room ID, or media path in spans/metrics) are verified by targeted assertions in the tests. No files require special attention. Reviews (1): Last reviewed commit: "Merge branch 'main' into feat/otel-deliv..." | Re-trigger Greptile |
f614a30 to
5f990d9
Compare
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Diagnostic message delivery events expose sessionKey/policyKey to plugin SDK listeners
DescriptionThe new outbound delivery diagnostics emit Because the plugin SDK publicly exports
Vulnerable code (new behavior): return params.mirror?.sessionKey ?? params.session?.key ?? params.session?.policyKey;
...
emitDiagnosticEvent({
type: "message.delivery.started",
channel: params.channel,
deliveryKind: params.deliveryKind,
...(params.sessionKey ? { sessionKey: params.sessionKey } : {}),
});While the bundled OTEL exporter and stability snapshots currently avoid exporting RecommendationAvoid exposing stable per-user/session identifiers to untrusted diagnostic listeners. Options:
Example (strip before public listeners): export function onDiagnosticEvent(listener: (evt: DiagnosticEventPayload) => void): () => void {
return onInternalDiagnosticEvent((event) => {
if (event.type === "log.record") return;
// Remove sensitive identifiers from public plugin surface
const { sessionKey, sessionId, ...rest } = event as any;
listener(rest);
});
}Also consider removing Analyzed PR: #71471 at commit Last updated on: 2026-04-25T08:20:49Z |
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (#71471) and credit @jlapenna whose #70424 framed the broader tracing work. - Cron malformed legacy jobs: add (#71509). - OpenAI/Codex OAuth region failures: add (#71501) and credit reporter @wulala-xjj (#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (#61249) and @ycjlb2023-peteryi (#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (#55017). - MCP config reload disposal: credit reporter @xieyuanqing (#60656).
… Unreleased Three of my (vincentkoc) entries were missing closing PR refs, and several maintainer-fix entries were missing credit for the user who reported the underlying issue: - Diagnostics/OTEL outbound delivery: add (openclaw#71471) and credit @jlapenna whose openclaw#70424 framed the broader tracing work. - Cron malformed legacy jobs: add (openclaw#71509). - OpenAI/Codex OAuth region failures: add (openclaw#71501) and credit reporter @wulala-xjj (openclaw#51175). - Telegram duplicate pollers: credit reporter @Co-Messi (openclaw#56230). - MCP/CLI one-shot retire: credit reporter @spartoviMD (openclaw#71457). - OpenAI/Codex image baseUrl canonicalize: credit reporter @GodsBoy (openclaw#71460). - Feishu TTS Ogg/Opus: credit reporters @sg1416-zg (openclaw#61249) and @ycjlb2023-peteryi (openclaw#37868). - MiniMax TTS portal OAuth: credit reporter @zx15210404690-hash (openclaw#55017). - MCP config reload disposal: credit reporter @xieyuanqing (openclaw#60656).
Summary
message.delivery.started,message.delivery.completed, andmessage.delivery.errordiagnostic events at the shared outbound delivery seamopenclaw.message.delivery.startedmetrics,openclaw.message.delivery.duration_mshistograms, andopenclaw.message.deliveryspansPrivacy / Cardinality
channel,deliveryKind, optional diagnosticsessionKey, duration/result count, and bounded error categoryContext
Validation
pnpm docs:listpnpm test src/infra/outbound/deliver.test.ts extensions/diagnostics-otel/src/service.test.ts src/logging/diagnostic.test.tspnpm plugin-sdk:api:checkpnpm check:changedafter expanding the worktree withgwt sparse fullpnpm plugin-sdk:api:check