docs: document outbound delivery queue · openclaw/openclaw@5a6eddf
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers outbound delivery core: hooks, queue cleanup, durable capability |
| 2 | +// checks, adapter sends, transcript mirroring, and payload outcomes. |
1 | 3 | import path from "node:path"; |
2 | 4 | import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
3 | 5 | import { chunkText } from "../../auto-reply/chunk.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Outbound delivery core runs plugin hooks, queue durability, channel adapter |
| 2 | +// sends, commit hooks, diagnostics, transcript mirroring, and payload outcomes. |
1 | 3 | import { resolveChunkMode, resolveTextChunkLimit } from "../../auto-reply/chunk.js"; |
2 | 4 | import { runReplyPayloadSendingHook } from "../../auto-reply/reply/reply-payload-sending-hook.js"; |
3 | 5 | import type { ReplyPayload } from "../../auto-reply/types.js"; |
@@ -126,6 +128,8 @@ let transcriptRuntimePromise:
|
126 | 128 | | undefined; |
127 | 129 | |
128 | 130 | async function loadTranscriptRuntime() { |
| 131 | +// Transcript writes are optional side effects; keep this lazy for import-only |
| 132 | +// delivery policy checks and tests. |
129 | 133 | transcriptRuntimePromise ??= import("../../config/sessions/transcript.runtime.js"); |
130 | 134 | return await transcriptRuntimePromise; |
131 | 135 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Delivery commit hooks attach post-commit side effects to result objects |
| 2 | +// without widening the public outbound result shape. |
1 | 3 | import { createSubsystemLogger } from "../../logging/subsystem.js"; |
2 | 4 | import { formatErrorMessage } from "../errors.js"; |
3 | 5 | import type { OutboundDeliveryResult } from "./deliver-types.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Delivery queue recovery drains pending outbound sends with backoff, crash |
| 2 | +// replay protection, unknown-send reconciliation, and failed-entry pruning. |
1 | 3 | import { |
2 | 4 | resolveDateTimestampMs, |
3 | 5 | resolveExpiresAtMsFromDurationMs, |
@@ -387,6 +389,8 @@ async function drainQueuedEntry(opts: {
|
387 | 389 | entry.recoveryState === "send_attempt_started" || |
388 | 390 | entry.recoveryState === "unknown_after_send" |
389 | 391 | ) { |
| 392 | +// A crash after platform send start cannot be blindly replayed; adapters |
| 393 | +// must reconcile whether the platform already committed the message. |
390 | 394 | const reconciliation = await reconcileUnknownQueuedDelivery({ |
391 | 395 | entry, |
392 | 396 | cfg: opts.cfg, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Delivery queue storage persists replayable outbound send intents and tracks |
| 2 | +// platform-send recovery state in the shared SQLite queue. |
1 | 3 | import type { ReplyDispatchKind } from "../../auto-reply/reply/reply-dispatcher.types.js"; |
2 | 4 | import type { ReplyPayload } from "../../auto-reply/types.js"; |
3 | 5 | import type { RenderedMessageBatchPlanItem } from "../../channels/message/types.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers delivery retry policy: permanent-error classification, backoff timing, |
| 2 | +// and first-replay eligibility after crashes. |
1 | 3 | import { describe, expect, it } from "vitest"; |
2 | 4 | import { |
3 | 5 | computeBackoffMs, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers reconnect-triggered queue drain selection, active claims, backoff |
| 2 | +// bypass, and concurrent drain suppression. |
1 | 3 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 4 | import type { OpenClawConfig } from "../../config/config.js"; |
3 | 5 | import { openOpenClawStateDatabase } from "../../state/openclaw-state-db.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers startup delivery recovery, backoff, permanent failures, unknown-send |
| 2 | +// reconciliation, commit hooks, and retry budget deferral. |
1 | 3 | import { MAX_DATE_TIMESTAMP_MS } from "@openclaw/normalization-core/number-coercion"; |
2 | 4 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
3 | 5 | import { openOpenClawStateDatabase } from "../../state/openclaw-state-db.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Verifies SQLite-backed outbound queue storage, metadata, failure updates, |
| 2 | +// recovery-state markers, and failed-entry moves. |
1 | 3 | import path from "node:path"; |
2 | 4 | import { describe, expect, it } from "vitest"; |
3 | 5 | import { openOpenClawStateDatabase } from "../../state/openclaw-state-db.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Test helpers provide isolated delivery-queue state directories and logger |
| 2 | +// stubs for queue/recovery tests. |
1 | 3 | import fs from "node:fs"; |
2 | 4 | import path from "node:path"; |
3 | 5 | import { afterAll, beforeAll, beforeEach, vi } from "vitest"; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。