Repository navigation
fix(twitch): record empty sends as a non-outcome, not a delivery receipt - #131689
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 29, 2026, 1:25 AM ET / 05:25 UTC. ClawSweeper reviewWhat this changesThe branch represents Twitch messages emptied by Markdown stripping as an intentional no-send outcome and carries that fact through shared delivery, queue recovery, receipts, and operator output. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. The central bug remains on current main, but the branch retains a prior P2 test-boundary violation and introduces a shared channel SDK outcome that needs maintainer confirmation. Priority: P2 Review scores
Verification
How this fits togetherTwitch’s plugin turns agent and Gateway message actions into transport sends. Shared outbound delivery records receipts, queue settlement, audit terminals, and source-reply completion from those results. flowchart LR
A[Agent or Gateway action] --> B[Twitch plugin]
B --> C[Shared outbound delivery]
C --> D{Transport outcome}
D -->|Sent| E[Receipt and completion]
D -->|Intentionally omitted| F[Suppression and audit]
C --> G[Queue recovery]
Decision needed
Why: This is an additive public plugin contract with semantics for all channel adapters, so source compatibility alone cannot determine the intended long-term API. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -8, Tests +951, Docs +10, Other -1. Total +952 across 36 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the typed no-send model, move the Twitch-private transport assertion into the plugin test lane, and land only after the channel SDK contract is explicitly accepted. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main returns successful Is this the best way to solve the issue? Yes, conditionally: recording an owner-confirmed no-send in the shared delivery owner is preferable to retaining a magic successful ID, but the new shared SDK meaning needs maintainer acceptance and its private-plugin mock must move. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ee2216cd76b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
89362bd to
929dec1
Compare
7c2aa07 to
4806a06
Compare
4806a06 to
64230a7
Compare
Carry earlier unknown sends through later pre-dispatch failures and derive best-effort settlement from canonical payload outcomes. Let proven unsent recovery failures retain retry eligibility, and publish persisted suppression only after queue acknowledgement. Consolidate terminal-owner acknowledgement paths and verify restart, stale-owner, and partial-send controls.
…he survivor poller The new Twitch delivery test reached into core outbound internals through relative paths, which the extension/plugin-sdk boundary guard rejects. Its pipeline coverage already exists generically in src/infra/outbound/deliver.test.ts, so the file is removed and its one plugin-owned assertion (a no-send disposition must never reach the platform client) moves into extensions/twitch/src/send.test.ts. Separately, test/scripts/upgrade-survivor-systemd.test.ts JSON-parsed a record file while the restarted service was still appending to it, so a read landing mid-append threw "Unexpected end of JSON input" out of the poll loop. The poller now counts only whole newline-terminated records and retries on a torn tail; a malformed earlier line still fails the test.
Remove redundant Twitch native send execution so the shared delivery owner records suppression, operator output, and terminal reply evidence. Preserve proven no-send queue state after acknowledgement failures in live and recovery paths, including database reopen.
Strip Twitch Markdown once before the existing client-manager chunking so literal formatting and inline-code horizontal rules remain visible. Keep public message.action sends working without native handlers by using the canonical outbound route, including account defaults, plugin payload preparation, and dispatch authority. Expose Twitch's existing target rules and source-target equivalence through the plugin contracts. Retain real-plugin successful-send, receipt, audit, source-reply, and operator-output coverage alongside suppressed-send controls. Clarify the documented target defaults for source replies, CLI, and Gateway actions.
64230a7 to
f913e54
Compare
…ability The surface contract required a declared threading surface to expose one of five functions, but core also consumes threading.matchesToolContextTarget directly (src/infra/outbound/source-reply-mirror.ts:364). Every existing implementer happened to pair that hook with resolveReplyToMode, so the gap stayed hidden until Twitch declared threading for target matching alone.
|
Merged via squash.
|
…ipt (openclaw#131689) * fix(twitch): record empty sends as a non-outcome, not a delivery receipt * fix(outbound): preserve delivery evidence through recovery Carry earlier unknown sends through later pre-dispatch failures and derive best-effort settlement from canonical payload outcomes. Let proven unsent recovery failures retain retry eligibility, and publish persisted suppression only after queue acknowledgement. Consolidate terminal-owner acknowledgement paths and verify restart, stale-owner, and partial-send controls. * test: keep Twitch no-send proof inside the plugin lane and de-flake the survivor poller The new Twitch delivery test reached into core outbound internals through relative paths, which the extension/plugin-sdk boundary guard rejects. Its pipeline coverage already exists generically in src/infra/outbound/deliver.test.ts, so the file is removed and its one plugin-owned assertion (a no-send disposition must never reach the platform client) moves into extensions/twitch/src/send.test.ts. Separately, test/scripts/upgrade-survivor-systemd.test.ts JSON-parsed a record file while the restarted service was still appending to it, so a read landing mid-append threw "Unexpected end of JSON input" out of the poll loop. The poller now counts only whole newline-terminated records and retries on a torn tail; a malformed earlier line still fails the test. * fix(outbound): keep Twitch no-sends under core delivery custody Remove redundant Twitch native send execution so the shared delivery owner records suppression, operator output, and terminal reply evidence. Preserve proven no-send queue state after acknowledgement failures in live and recovery paths, including database reopen. * fix(twitch): preserve ordinary sends through core routing Strip Twitch Markdown once before the existing client-manager chunking so literal formatting and inline-code horizontal rules remain visible. Keep public message.action sends working without native handlers by using the canonical outbound route, including account defaults, plugin payload preparation, and dispatch authority. Expose Twitch's existing target rules and source-target equivalence through the plugin contracts. Retain real-plugin successful-send, receipt, audit, source-reply, and operator-output coverage alongside suppressed-send controls. Clarify the documented target defaults for source replies, CLI, and Gateway actions. * test(channels): recognize matchesToolContextTarget as a threading capability The surface contract required a declared threading surface to expose one of five functions, but core also consumes threading.matchesToolContextTarget directly (src/infra/outbound/source-reply-mirror.ts:364). Every existing implementer happened to pair that hook with resolveReplyToMode, so the gap stayed hidden until Twitch declared threading for target matching alone.
Important
review-required: acknowledgement-vs-no-send SDK semantics. Prepared under the auto-QA campaign from a channel-delivery audit (finding C6). Adds an optional typed no-send fact to the shared message-result SDK, so this stays a draft for maintainer review.
What Problem This Solves
A Twitch reply whose entire content sanitizes away to nothing (e.g.
---) was recorded as a successful delivery. Twitch's chunker returns no chunks; shared planning restores the nonempty original; Twitch's send strips it again and returnsok:true, messageId:"skipped"with an empty receipt before client-manager lookup. Downstream, the nonempty"skipped"field is preferred over the empty provider receipt, so accounting records one physical send even though Twitch received nothing. Success accounting can then complete the intent or suppress a legitimate fallback.Why This Change Was Made
The invariant: a provider's explicit no-send must remain a recorded non-outcome, not positive delivery evidence. The fix carries a typed owner-confirmed no-send fact through the shared message SDK (optional field; omission preserves existing acknowledgement behavior). Core records
adapter_returned_no_send, produces no successful delivery result/hook/pin, projects the existingsuppressed / no_visible_payloadaudit terminal with zero physical sends, and intentional queue settlement counts asrecovered:1(not a failed send). The global empty-chunker protection and identity predicate are untouched; no arbitrary string blacklist was added.A deep-context review also found and fixed a related recovery gap: a persisted suppressed owner surviving a crash/ack-failure could be retired on the next scan without publishing its audit non-outcome. Terminal-owner recovery now shares one ack path and emits suppression only after queue custody ends (delivered/rejected owners keep their semantics; stale owners do not manufacture suppression).
User Impact
An empty Twitch send is now honestly recorded as an intentional non-outcome instead of a phantom success, so completion/fallback logic sees the truth. Normal Twitch messages still send and count. The three delivery states — no-send, acknowledged-without-editable-ID, unknown-after-send — stay distinct.
Scope note for the reviewer (siblings deliberately unchanged)
This fix does not reclassify legitimate ack-without-ID producers: iMessage
ok/unknownplaceholders still count as one physical acknowledgement, legacy LINEpushresults remain delivered, and aggregate receipts (Telegram/Discord/Slack) keep their physical multiplicity. One audit premise was corrected during review: Synology is not positively "counted delivered" on current main — since #110770 removed its syntheticsc-*ID (afterv2026.7.1), core already treats its empty-ID webhook as identityless ambiguity. This branch preserves that current behavior and does not convert Synology to no-send; making Synology positively-delivered would require a separate explicit acknowledgement contract, which this review deliberately did not invent.Evidence
plugin-sdk:surface:checkclean.---physical count 1 → 0 (real sanitizer+planner+adapter+recorder, no client manager); a second probe exposed the recovery gap (failed:1→recovered:1) with real SQLite queue/conversation reopen and no replay.