Repository navigation
refactor(channels): share approval reaction settlement - #140645
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 8:06 AM ET / 12:06 UTC. ClawSweeper reviewWhat this changesShares approval-reaction authorization and cleanup across iMessage, Signal, and WhatsApp, and routes transient WhatsApp resolution failures through durable replay. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and v2026.9.2 still consume failed WhatsApp approval reactions before durable admission. No actionable introduced defect was found. The earlier assertion-baseline finding is resolved, and the previous draft/CI hold has been lifted. Priority: P1 Review scores
Verification
How this fits togetherChannel plugins translate operator reactions into approval decisions sent to the Gateway. Shared settlement handles authorization and terminal cleanup, while WhatsApp’s durable ingress retains failed reactions for another attempt. flowchart TD
A[Operator reaction] --> B[Plugin identity and target checks]
B --> C[Explicit approver authorization]
C --> D[Gateway approval resolution]
D -->|Terminal result| E[Clear reaction binding]
D -->|Transient WhatsApp failure| F[Durable ingress queue]
F -->|Replay with current config| B
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -45, Tests +167, Docs +10, Other -1. Total +131 across 10 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Use shared stateless settlement while keeping transport identity checks local and failed WhatsApp reactions under the existing durable replay owner. Do we have a high-confidence way to reproduce the issue? Yes, from source: a nonterminal Gateway error makes the current WhatsApp handler return handled, causing intake to skip durable admission. This review did not execute that scenario. Is this the best way to solve the issue? Yes. The patch repairs both admission and replay at their existing owners, preserves transport-specific checks, and removes duplicated settlement without adding a competing public API. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0f8932785cca. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
e20e321 to
95e78fc
Compare
4aa0134 to
3e548fa
Compare
Keep transport identity and replay ownership local while sharing explicit approver admission, persisted record validation, and terminal cleanup. WhatsApp now admits transient resolver failures into durable ingress. Shrink the assertion baseline exactly (iMessage 3 to 2, WhatsApp 1 to 0) as required ratchet maintenance after deleting duplicate decoders. Proof: node scripts/run-vitest.mjs across 47 approval/ingress files (530 tests); 88 decoder tests passed after removing the copied assertion. Co-authored-by: wangmiao0668000666 <[email protected]>
Preserve concurrent-click ordering with the existing deferred helper supported by the core test TypeScript library. Do not widen compiler libraries. Proof: node scripts/run-vitest.mjs src/plugin-sdk/approval-reaction-runtime.test.ts (21 passed); fresh isolated review has no actionable findings.
Preserve the ingress replay sequence with the existing SDK deferred helper supported by the extension test TypeScript library. Proof: monitor-inbox.delivery-and-dedupe.test.ts (18 passed), full extension test typecheck passed, and fresh isolated review found no actionable issues.
Call each transport authorizer through its owner when sharing reaction settlement, and keep the iMessage settlement result distinct from log text. Proof: four direct reaction suites (88 tests); diff check and fresh isolated review passed. Hosted lint exposed the three unbound references and shadow.
39ce430 to
cd1f761
Compare
|
Merged via squash.
|
* commit 'b07b7d8bd1293c4e70ece7281b9cb8422318ae5a': (30 commits) fix(ui): keep reopened select menus visible (#141047) test(ui): fix dashboard gallery client fixtures (#141203) refactor(links): remove unused understanding results (#141200) refactor(plugins): share manifest contribution projection (#141193) refactor(logging): share portable redaction pattern mechanics (#140742) chore(ui): refresh control ui locales (#141208) refactor(minimax): reuse generated video asset downloader (#141094) fix(test): await Telegram loopback prompt reception (#141204) refactor(acp): remove unused in-memory event ledger (#141145) improve(models): reduce overhead in catalog discovery (#141154) refactor(channels): share approval reaction settlement (#140645) chore(i18n): refresh native locales (#141089) refactor: share one-shot tickets and WebSocket helpers across desktop, node, and browser streams (#141185) refactor(google-meet): share browser open and recovery setup (#140972) refactor(plugins): share npm version queries (#141166) refactor(http): share bounded response byte consumption (#140654) refactor(whatsapp): share prompt selection (#141195) fix: bound temporary storage for terminal upload batches (#141116) perf(markdown): reuse image parser configuration (#141126) fix(policy): align tool requirements with core vocabulary (#140628) ...
* refactor(channels): share approval reaction settlement Keep transport identity and replay ownership local while sharing explicit approver admission, persisted record validation, and terminal cleanup. WhatsApp now admits transient resolver failures into durable ingress. Shrink the assertion baseline exactly (iMessage 3 to 2, WhatsApp 1 to 0) as required ratchet maintenance after deleting duplicate decoders. Proof: node scripts/run-vitest.mjs across 47 approval/ingress files (530 tests); 88 decoder tests passed after removing the copied assertion. Co-authored-by: wangmiao0668000666 <[email protected]> * test(channels): use shared deferred in approval settlement coverage Preserve concurrent-click ordering with the existing deferred helper supported by the core test TypeScript library. Do not widen compiler libraries. Proof: node scripts/run-vitest.mjs src/plugin-sdk/approval-reaction-runtime.test.ts (21 passed); fresh isolated review has no actionable findings. * test(whatsapp): use shared deferred for approval replay latches Preserve the ingress replay sequence with the existing SDK deferred helper supported by the extension test TypeScript library. Proof: monitor-inbox.delivery-and-dedupe.test.ts (18 passed), full extension test typecheck passed, and fresh isolated review found no actionable issues. * fix(channels): preserve approval authorizer receivers Call each transport authorizer through its owner when sharing reaction settlement, and keep the iMessage settlement result distinct from log text. Proof: four direct reaction suites (88 tests); diff check and fresh isolated review passed. Hosted lint exposed the three unbound references and shadow. --------- Co-authored-by: wangmiao0668000666 <[email protected]>
Closes #131004. Related: #130969.
What Problem This Solves
WhatsApp approval reactions were silently consumed when Gateway resolution failed transiently, so the operator's click never reached durable ingress. The iMessage, Signal, and WhatsApp plugins also duplicated explicit-approver admission, persisted target validation, and terminal settlement.
Why This Change Was Made
A stateless
settleApprovalReactionoperation and base-record decoder now live behind the existingopenclaw/plugin-sdk/approval-reaction-runtimeseam. Plugins retain transport identity, Signal route/target-author checks, iMessage GUID/poll cleanup, diagnostics, and replay ownership. Authorizer calls retain their receivers. Terminal results—including concurrent losing clicks—retire bindings; nonterminal failures retain them and propagate to the existing replay owner. The Gateway remains the first-answer authority.This incorporates the WhatsApp durable-admission repair from #130969 by @wangmiao0668000666: a failed fast path preserves batch siblings, and the drain resolves reactions before ordinary message normalization. No sibling PR was modified.
The existing reaction seam is private-local and consumes no public SDK slots. No public export was removed or renamed. Store namespaces, versions, expiry, and persistence semantics are unchanged. Production delta: -45 lines; tests: +167. The assertion baseline shrinks exactly as required after deleting duplicate decoders: iMessage 3→2, WhatsApp 1→0. No baseline or budget increases.
User Impact
WhatsApp approval reactions survive transient Gateway loss and replay after recovery. Existing iMessage and Signal authorization, canonical-winner reporting, and polling behavior remain intact. There are no new settings or UI appearance changes.
Evidence
Fresh validation is for
cd1f7612c7dd16f00671f85911736a610752ea2d, rebased patch-identically onto main containing #140974, #140997, and #141148.node scripts/run-vitest.mjs, includingextensions/whatsapp/src/monitor-inbox.delivery-and-dedupe.test.ts.node scripts/check-changed.mjspassed ratchets, formatting, SDK checks, core/plugin production and test types, declaration/deprecation checks, all three dead-export scans (zero entries), and core lint. Local plugin lint reaches the documented nested-worktreeDeclaration input escapes checkoutexception for ancestorpunycode/package.json; exact-head hosted lint, typechecks, and extension package-boundary checks passed.pnpm buildpassed in 6m28s, andpnpm plugin-sdk:surface:checkpassed. Isolated iMessage, Signal, and WhatsApp startup profiles passed with zero failures/timeouts (peak RSS 99.16, 98.83, and 98.28 MiB). Exact-head hosted CI passed: https://github.com/openclaw/openclaw/actions/runs/34119401075. The requiredopenclaw/ci-gateis green, and native prepare completed on the unchanged reviewed head. The earlier CI hold was caused by unrelated tests whose fixes are now in the base.Live transport proof is unavailable. The SQLite/mock-Gateway harness is the available boundary proof; it is not a live channel test.