fix(cli): surface durable delivery status#80151
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: not applicable. for the additive JSON status surface. The prior no-visible cleanup concern is source-checkable and now covered by the PR's NO_REPLY/no-visible tests returning Real behavior proof Next step before merge Security Review detailsBest possible solution: Keep the durable-send-based projection, preserve Do we have a high-confidence way to reproduce the issue? Not applicable for the additive JSON status surface. The prior no-visible cleanup concern is source-checkable and now covered by the PR's NO_REPLY/no-visible tests returning Is this the best way to solve the issue? Yes. Projecting What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against fcc042559f96. Re-review progress:
|
|
@clawsweeper re-review Follow-up pushed in
The field-gating behavior is covered by the focused delivery tests; the live QA gateway proof covers end-to-end success-path durable delivery surfacing. |
48a9018 to
6377864
Compare
|
Rebased onto current Post-rebase local checks:
|
dda5f73 to
4fc66cb
Compare
|
Rebased onto current Follow-ups handled:
Local verification after the final rebase:
GitHub checks on the new head are now green, including |
4fc66cb to
3133ebf
Compare
5d89d4c to
e7f9493
Compare
|
Landed via rebase onto
Thanks @Kaspre! |
Summary
The new optional
deliveryStatusobject distinguishessent,suppressed,partial_failed, andfaileddelivery outcomes, including per-payload outcomes when durable delivery provides them.deliverySucceededremains the legacy retry-marker compatibility field:sentandsuppressedare terminal no-retry results, whilepartial_failedandfaileddo not clear retry state. One deliberate tightening: the compatibility boolean now follows the final durable send status rather than incidentalonErrorcallbacks, so non-fatal delivery hiccups do not incorrectly mark a finalsent/suppressedoutcome as retryable.Value proposition
Automation can now tell what happened after an agent produced payloads. Scripts and supervisors using
openclaw agent --json --delivercan distinguish successful sends, intentional hook suppressions, partial sends, preflight failures, and hard delivery failures without parsing human stderr or guessing from a coarse boolean.Anticipated consumers
openclaw agent --json --deliver.deliverySucceeded.Why maintainers should consider this
This follows Peter's guidance from #57843 by anchoring the public status projection on
sendDurableMessageBatch, not by extending deprecateddeliverOutboundPayloadssemantics. The change is additive, documented, and covered by focused tests for sent, suppressed, no-payload, preflight, partial failure, strict JSON failure, and best-effort failure paths.Verification
timeout 600s claude --print --tools "" --no-session-persistence --output-format text < /tmp/claude-review-current.txt(external local review; no blocking findings)pnpm test src/agents/command/delivery.test.ts(16 tests passed; covers sent delivery, hook suppression, no-payload suppression, preflight failure withreasonand noerrorMessage, partial failure witherrorMessage, strict delivery failure witherrorMessage, strict preflight failure, and best-effort failure paths)pnpm exec oxfmt --check --threads=1 docs/cli/agent.mdgit diff --checkpnpm check:deprecated-api-usagepnpm tsgo:corepnpm buildpnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/cli/agent.md src/agents/command/delivery.ts src/agents/command/delivery.test.tspnpm exec oxlint --tsconfig config/tsconfig/oxlint.core.json src/agents/command/delivery.ts src/agents/command/delivery.test.tspnpm docs:check-linkspnpm check:docspassed docs formatting, markdown lint, and MDX checks, then failed indocs:check-i18n-glossaryon broad existing zh-CN glossary drift across many docs. The failure was not specific to this newdeliveryStatussection.Real behavior proof
openclaw agent --json --deliveranddeliverAgentCommandResultnow expose durable delivery status fromsendDurableMessageBatch, including sent, suppressed, partial-failed, and failed outcomes, without changing the legacydeliverySucceededcompatibility field shape.OPENCLAW_BUILD_PRIVATE_QA=1, real QA gateway child,qa-channelplugin, Pi runtime, andmock-openai/gpt-5.5provider. The run used a synthetic QA channel only; no external chat service was contacted.node dist/index.js agent --agent qa --message 'Finish with exactlydelivery-proof-ok.' --json --deliver --reply-channel qa-channel --reply-to dm:delivery-proof --model mock-openai/gpt-5.5 --timeout 120.{ "waitResult": { "status": "ok" }, "mockProvider": { "requestCount": 1, "lastRequest": { "model": "gpt-5.5", "providerVariant": "openai" } }, "payloads": [{ "text": "delivery-proof-ok", "mediaUrl": null }], "deliveryStatus": { "requested": true, "attempted": true, "status": "sent", "succeeded": true, "resultCount": 1, "payloadOutcomes": [{ "index": 0, "status": "sent", "resultCount": 1 }] }, "qaChannel": { "outboundCount": 1, "outbound": [{ "conversation": { "id": "delivery-proof", "kind": "direct" }, "text": "delivery-proof-ok" }] } }waitResult.status: "ok", produced the payload textdelivery-proof-ok, delivered one QA-channel outbound message, and returneddeliveryStatus.status: "sent"with per-payloadstatus: "sent"andresultCount: 1.expectFinal/embedded-fallback path even though the equivalent gateway RPC completes and delivers. I am treating that as a separate CLI QA harness/client issue rather than part of this delivery-status projection.This PR supersedes draft PRs #53961 and #57755 after #57843 was closed because that approach tried to extend delivery-result semantics on an API that maintainers consider basically deprecated. Instead, this projects the newer
sendDurableMessageBatchresult model intodeliverAgentCommandResultandopenclaw agent --json --deliveroutput.