feat(delivery): surface deliveryStatus in --json output#1687
Open
BingqingLyu wants to merge 1 commit into
Open
feat(delivery): surface deliveryStatus in --json output#1687BingqingLyu wants to merge 1 commit into
BingqingLyu wants to merge 1 commit into
Conversation
Enrich deliverAgentCommandResult with a structured deliveryStatus return and a diagnostic [delivery] log line, making five previously-invisible failure paths visible: no channel, internal channel, no target, thrown error, and empty results. deliveryStatus contract: - succeeded: boolean (true when at least one payload delivered) - hadPartialFailure: true when onError fired but some payloads succeeded - error: true when delivery threw (bestEffort) or preflight check failed - Early return (no payloads) includes deliveryStatus when deliver=true - JSON output (--json --deliver) includes deliveryStatus in the envelope Factor the JSON envelope emission into a single emitJsonEnvelope helper so the status can be attached consistently at each return path, and carry through suppress-on-JSON-mode warnings + restored test spies from the Greptile/Codex review rounds that landed on this branch. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deliveryStatusfield to the JSON envelope emitted byopenclaw agent --json --deliver, so automation can detect delivery failures without parsing log outputDesign
The JSON envelope now includes
deliveryStatuswhen--deliveris used:{ "payloads": [...], "meta": {...}, "deliveryStatus": { "requested": true, "attempted": true, "succeeded": true } }succeededis three-state:true— all payloads delivered"partial"— some payloads failed under bestEffort modefalse— nothing deliveredKey design decisions:
deliveryStatusis a new top-level field, not reusing the existingdeliveryfield (which carries channel metadata likemessageId)deliveryStatus: {requested: true, attempted: false, succeeded: false}so automation can distinguish "no delivery requested" from "delivery requested but nothing to send"Known limitations
These are inherent to the upstream
deliverOutboundPayloadsreturn type and would require upstream changes to address:message_sendinghook that cancels all payloads returns[], which is indistinguishable from zero delivery results. Currently reported assucceeded: falserather than a distinct "cancelled" outcome.succeeded: false, error: trueeven though part of the message reached the channel.Dependencies
Test plan
codex review --base upstream/main— clean (2 P2s documented as known limitations above)Closes openclaw#57730.
🤖 Generated with Claude Code