Skip to content

fix(signal): replay approval reactions after transient Gateway failures - #130134

Merged
obviyus merged 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/signal-approval-reaction-replay
Aug 27, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/signal-approval-reaction-replay

Conversation

@wangmiao0668000666

@wangmiao0668000666 wangmiao0668000666 commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Signal approval reactions treated every non-expired Gateway failure as handled. A transient Gateway failure therefore completed the durable ingress claim and silently dropped the operator's approval click.

Fixes #130133.

Why This Change Was Made

The Signal durable ingress queue already owns retry. The approval resolver must preserve expired-approval cleanup, but it must rethrow every other Gateway failure so the queue releases and replays the claim.

Matrix uses the same owner boundary after #129879. WhatsApp is intentionally separate because its approval reaction runs before durable admission, so a bare rethrow there would still drop the reaction.

User Impact

A transient Gateway failure no longer loses a Signal approval reaction. Signal retries the same durable event after the Gateway recovers, then records completion so it cannot dispatch again.

Evidence

Current main be8b6ff3c4697c045d9277356018846e777fbcdc with only the authoritative replay test added:

$ node scripts/run-vitest.mjs extensions/signal/src/signal-ingress.approval-reaction-replay.test.ts
FAIL: expected pendingAfterFailure to have length 1, received 0

Exact PR head 3b756de46803554d0afb7cd7cc72cb6558bc6f0a:

$ node scripts/run-vitest.mjs extensions/signal/src/signal-ingress.approval-reaction-replay.test.ts
Test Files  1 passed (1)
Tests       1 passed (1)

Exact GitHub merge result 8dc3a96d0e7598b77b33b9dcff43d95546349f8d against current main d36d90ba62d28fb412ef7e922bb3fed93c563b91 passed the same focused test. Exact-head openclaw/ci-gate also passed in run 33044232460.

The test uses the real SQLite queue, Signal monitor, generic ingress drain, and Signal event handler. It mocks only the external Gateway approval call. It proves claim release, identical redelivery, completion, and tombstone deduplication.

Production logic is one changed line: return true becomes throw error. Test audit removed the two earlier unit-level tests because the SQLite owner-boundary test supersedes them.

The final canonical Telegram userbot DM smoke recorded one user message, two typing events, and one SUT reply containing OPENCLAW_E2E_OK. The mock provider recorded one POST /v1/responses; the fresh Gateway recorded ready and clean shutdown with zero errors. This is collateral regression proof only because the Signal approval-reaction change is not Telegram-visible.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: signal Channel integration: signal size: S labels Aug 26, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 2:05 AM ET / 06:05 UTC.

ClawSweeper review

What this changes

The PR rethrows transient Signal approval-resolution failures so durable ingress retries the same reaction, and adds a SQLite-backed replay regression test.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary: current main still consumes transient Gateway errors as handled, while the proposed change lets the durable Signal ingress owner release and replay the event. The focused queue-boundary proof is sufficient; exact-head CI should finish before landing.

Priority: P1
Reviewed head: 3b756de46803554d0afb7cd7cc72cb6558bc6f0a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-neutral owner-boundary fix with strong replay coverage; only normal exact-head CI completion remains before landing.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR supplies after-fix terminal evidence from a real SQLite queue, Signal monitor, generic drain, and event handler; only the external Gateway resolution call is mocked.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR supplies after-fix terminal evidence from a real SQLite queue, Signal monitor, generic drain, and event handler; only the external Gateway resolution call is mocked.
Evidence reviewed 6 items Current-main defect: Current main logs a non-expired approval-resolution error and returns success, so its Signal handler completes the claimed ingress event instead of exposing the failure to retry handling.
Retry owner: The generic durable ingress drain catches handler errors and applies its retry disposition, which releases retryable claims with the recorded error.
Proposed owner-boundary repair: The PR preserves expired-approval cleanup but rethrows all other resolver errors at the Signal approval-reaction owner.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/signal/src/signal-ingress.approval-reaction-replay.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.extension-signal.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130134-CgjPoK/target

[vitest] still running with no output for 30000ms.
 ✓  extension-signal  extensions/signal/src/signal-ingress.approval-reaction-replay.test.ts (1 test) 18830ms
     ✓ releases the claim and replays a reaction after a transient Gateway failure  2039ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  06:06:10
   Duration  30.85s (transform 24.01s, setup 999ms, import 10.65s, tests 18.83s, environment 0ms)

[test] passed 1 Vitest shard in 37.21s

Assertions:

  • PASS expect_output: releases the claim and replays a reaction after a transient Gateway failure
  • PASS expect_output: 1 passed

How this fits together

Signal reaction events enter through a durable ingress queue before reaching the approval resolver. A successful or expired resolution completes the event; a transient resolver failure must release its claim so the queue can retry it.

flowchart LR
  A[Signal reaction] --> B[Signal monitor]
  B --> C[Durable ingress queue]
  C --> D[Approval reaction handler]
  D --> E{Gateway resolution}
  E -->|resolved or expired| F[Complete event]
  E -->|transient failure| G[Release claim]
  G --> C
Loading

Before merge

  • Resolve merge risk (P1) - Several exact-head CI checks are still in progress, so the clean GitHub merge result and focused Signal replay suite still need their normal completion gate.
  • Complete next step (P2) - No repair job is needed: the proposed owner-boundary change is concrete and no patch defect was found; wait for normal exact-head CI and maintainer landing review.
Agent review details

Security

None.

PR surface

Source 0, Tests +183. Total +183 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 183 0 +183
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 184 1 +183

Review metrics

Metric Value Why it matters
Production vs test LOC production +1/-1 (net 0), tests +183 The production repair is limited to the implicated error disposition, while the added coverage exercises the durable owner boundary.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #130133
Summary: This PR is the concrete candidate fix for the linked Signal approval-reaction loss report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Finish exact-head replay validation (recommended)
    Allow the current clean merge result to complete its focused Signal and required CI gates before landing the retry-path change.
  2. Pause if the merged result diverges
    Hold this PR if the final GitHub merge result or exact-head replay validation no longer preserves retryable claim release.

Technical review

Best possible solution:

Land the one-line Signal owner-boundary repair with its durable replay regression, once exact-head CI confirms the clean merge result.

Do we have a high-confidence way to reproduce the issue?

Yes: current main’s return-success path and the added SQLite queue test define a high-confidence reproduction of claim completion after an injected transient resolver failure, although this read-only review did not execute contributor code.

Is this the best way to solve the issue?

Yes: propagating the transient error at the Signal resolver boundary is the narrow canonical fix because the existing durable ingress drain already owns retry and claim release; the Matrix sibling uses the same distinction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9f266edd0f0a.

Labels

Label justifications:

  • P1: A transient Gateway failure can silently discard an operator's Signal approval reaction until the approval expires.
  • merge-risk: 🚨 message-delivery: The changed return path determines whether a durable Signal reaction is completed or replayed after a resolver failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR supplies after-fix terminal evidence from a real SQLite queue, Signal monitor, generic drain, and event handler; only the external Gateway resolution call is mocked.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies after-fix terminal evidence from a real SQLite queue, Signal monitor, generic drain, and event handler; only the external Gateway resolution call is mocked.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Introduced and repeatedly refactored the approval-reaction and channel-binding surfaces that own this behavior. (role: feature-history contributor; confidence: high; commits: 719ce7f96f42, 9329e4d76ab1, 313cb134feec; files: extensions/signal/src/approval-reactions.ts)
  • Ayaan Zaidi: Recent approval account-binding work touches the authorization and routing context used by channel approval reactions. (role: adjacent approval-routing contributor; confidence: medium; commits: 9935ca3b30dc; files: extensions/signal/src/approval-reactions.ts)
  • joshavant: History records the Signal structured-delivery approval-reaction binding work on the affected module. (role: Signal approval-reaction contributor; confidence: medium; commits: 6830aa39eaa1; files: extensions/signal/src/approval-reactions.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the in-progress exact-head CI checks complete, including the focused Signal replay path.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-08-26T13:38:30.909Z sha ce0991ee69acc9c18c91eaeb66ba825da8113ef9 :: needs real behavior proof before merge. :: [P2] Exercise the Signal ingress replay boundary
  • reviewed 2026-08-26T14:21:38.795Z sha ce0991ee69acc9c18c91eaeb66ba825da8113ef9 :: needs real behavior proof before merge. :: [P2] Exercise the Signal ingress replay boundary
  • reviewed 2026-08-26T23:28:18.217Z sha 3d063ae93fdd67e9a31cb2961649e86320301c15 :: needs real behavior proof before merge. :: [P2] Exercise the actual Signal ingress replay path
  • reviewed 2026-08-27T01:11:24.983Z sha 146f4e0699f8fce8ad58f312bbf450586d760f1b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-27T01:52:35.680Z sha 146f4e0699f8fce8ad58f312bbf450586d760f1b :: needs maintainer review before merge. :: none

@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

Added the ingress-boundary proof requested: a real reaction event is now driven through createSignalEventHandler with the approval resolver rejecting like a Gateway 503, and the test asserts the throw escapes the handler untouched (not swallowed) so the durable ingress queue releases the claim. Also ran with Node 24.19.0 (WAL-safe SQLite) — the full signal approval + ingress suite passes (4 files, 107 tests). PR head: 3d063ae93fd. @clawsweeper re-review

@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head 146f4e0699f adds the real durable-ingress replay proof the review asked for ([P2] Exercise the actual Signal ingress replay path) — new test-only file extensions/signal/src/signal-ingress.approval-reaction-replay.test.ts, zero production changes.

What is real vs mocked:

  • Real: SQLite-backed ingress queue (createChannelIngressQueueForTests in a realpath'd temp state dir), real startSignalIngressMonitor → createChannelIngressMonitor → createChannelIngressDrain (retry policy, claim release, backoff-gated reclaim, completion tombstones), real createSignalEventHandler → handleReactionOnlyInbound → maybeResolveSignalApprovalReaction (target registration, route check, approver auth).
  • Mocked: only the one true external boundary, resolveApprovalOverGateway (same mock seam as the existing tests) — first call rejects gateway 503, then resolves.

Assertions, all synchronized on produced state (no sleeps): after the first dispatch, the claim is released and NOT completed (listPending shows 1 row, attempts: 1, lastError contains "gateway 503"); the real drain redelivers (resolver call count reaches 2 inside a 15s vi.waitFor, actual ~1-2s); the second attempt carries byte-identical resolution args and resolves the approval; the row completes; a re-receive of the same event dispatches nothing (tombstone).

Pre-fix verification (throw error temporarily reverted to return true): the test FAILS — the pending-row assertion gets 0 rows because the swallowed 503 completes the claim and the click is silently dropped, exactly the shipped bug. Post-fix: passes (~2.1s). Full signal suites: 4 files, 57 tests green; tsgo extensions test types exit 0 (Node v24.19.0).

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 27, 2026
Let the durable Signal ingress queue release and replay a claim when Gateway approval resolution fails transiently. Keep the real SQLite lifecycle regression at the queue owner boundary.

Co-authored-by: Ayaan Zaidi <[email protected]>
@obviyus
obviyus force-pushed the fix/signal-approval-reaction-replay branch from 146f4e0 to 3b756de Compare August 27, 2026 05:58
@obviyus

obviyus commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Land-ready proof for 3b756de46803554d0afb7cd7cc72cb6558bc6f0a:

  • Current main reproduced the bug with node scripts/run-vitest.mjs extensions/signal/src/signal-ingress.approval-reaction-replay.test.ts: the pending claim count was 0, not 1, because the transient failure was consumed.
  • Exact merge result 8dc3a96d0e7598b77b33b9dcff43d95546349f8d passed the same focused real-SQLite replay test: 1 file, 1 test.
  • Exact-head openclaw/ci-gate passed in run 33044232460.
  • Local ClawSweeper passed on the exact PR head: patch correct, 0 findings, security cleared, no maintainer decision, 0 Rank-up moves.
  • Distill and performance review found no extra production path or runtime cost. Test audit removed the two superseded unit-level tests; final delta is production +1/-1, tests +183/-0.

Final Telegram gate used only the canonical telegram-e2e-userbot runner with a dedicated QA user lease, a fresh exact-merge Gateway from the matching CI runtime artifact, and a recorded DM timeline. The sent text was Please answer with OPENCLAW_E2E_OK only. The timeline recorded 1 user message, 2 SUT typing events, and 1 SUT message with OPENCLAW_E2E_OK. The provider log recorded one POST /v1/responses; the Gateway log recorded ready and clean shutdown with zero errors. This is collateral regression proof only because this Signal approval-reaction change is not Telegram-visible.

The hosted review's current-main merge-result Rank-up move is complete.

@obviyus

obviyus commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks @wangmiao0668000666!

@obviyus
obviyus merged commit 92d81bd into openclaw:main Aug 27, 2026
117 checks passed
@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus for merging! Appreciate the quick turnaround — happy to help if anything comes up.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…es (openclaw#130134)

Propagate transient Signal approval-reaction failures so durable ingress releases and replays the claim instead of silently completing it. Preserve expired-approval cleanup and the real SQLite owner-boundary regression.

Fixes openclaw#130133.

Co-authored-by: wangmiao0668000666 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Aug 29, 2026
… errors

Transient Gateway 5xx/network/auth errors in approval reaction resolution
were returning {handled:true, stopPolling:true}, which caused the durable
ingress while(true) loop to commit the claim (GUID tombstone) and lose
the operator's approval click permanently.

Fix: return {handled:false} so the loop retries via
iMessageApprovalControlBindings.wait(), keeping the durable claim alive.
This is the same fix pattern as matrix (openclaw#129879) and signal (openclaw#130134).

Test: prove transient errors keep the binding alive and return handled:false.

Fixes: imessage approval reaction silent drop on resolver-error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: signal Channel integration: signal merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(signal): approval reactions are dropped on transient Gateway failures

2 participants