Skip to content

fix(signal): preserve messages redelivered behind a busy lane - #128093

Merged
sallyom merged 3 commits into
mainfrom
fix/signal-pending-redelivery
Aug 29, 2026
Merged

sallyom merged 3 commits into
mainfrom
fix/signal-pending-redelivery

Conversation

@clawsweeper

Copy link
Copy Markdown
Contributor

Closes #128009

What Problem This Solves

Fixes an issue where Signal users could permanently lose a message when signal-cli redelivered it while an earlier message from the same sender was still being processed. The duplicate admission could mark the real pending row completed and erase its payload before dispatch.

Reported with a production-path reproduction by @yetval in #128009.

Why This Change Was Made

The shared durable-ingress monitor now exposes one narrow isNew fact after enqueue instead of leaking the full queue result through the Plugin SDK. Signal still bridges the phone-number alias on every admission, but completes the primary UUID row only when that row was freshly inserted, preserving both duplicate-redelivery safety and the existing phone-first alias dedupe.

User Impact

Signal messages redelivered behind a busy sender lane remain pending and dispatch exactly once after the earlier message finishes, instead of being silently dropped.

Evidence

  • The boundary regression drives startSignalIngressMonitor.receive over the real SQLite ingress queue: a deferred first message blocks the lane, the second message remains pending, its identical redelivery leaves it pending, and releasing the first claim dispatches both messages in order.
  • Before the fix, this scenario fails immediately after redelivery because the pending row count becomes zero.
  • node scripts/run-vitest.mjs extensions/signal/src/signal-ingress.test.ts src/channels/message/ingress-monitor.test.ts — 58 passed.
  • node scripts/check-changed.mjs -- src/channels/message/ingress-monitor.ts src/channels/message/ingress-monitor.test.ts extensions/signal/src/signal-ingress.ts extensions/signal/src/signal-ingress.test.ts — all selected core, core-test, plugin, and plugin-test gates passed.
  • node --max-old-space-size=8192 --import tsx scripts/plugin-sdk-surface-report.mts --check — passed.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted ... — clean; no accepted/actionable findings.

No live signal-cli daemon or SSE connection was attached; the regression replays the exact receive envelope through the production Signal monitor entry point and durable queue.

@clawsweeper

clawsweeper Bot commented Aug 23, 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 maintainer Maintainer-authored PR labels Aug 23, 2026
@clawsweeper
clawsweeper marked this pull request as ready for review August 23, 2026 03:27
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 11:35 AM ET / 15:35 UTC.

ClawSweeper review

What this changes

The PR adds a durable-admission freshness fact to the channel SDK and uses it to prevent Signal redelivery from completing a still-pending dual-identity message.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. Current main still contains the destructive duplicate-admission path, while this coherent patch fixes it at the durable-admission owner boundary; it has no blocking correctness or security finding. The PR remains under protected maintainer/human-review handling and its post-force-push exact-head checks are still incomplete.

Priority: P1
Reviewed head: 1052650f2b555d65713606a46756b5938611e865

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with direct regression coverage and no blocking finding; normal exact-head CI remains pending.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its supplied evidence nevertheless describes the production Signal receive entrypoint and real SQLite durable queue exercising the redelivery sequence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its supplied evidence nevertheless describes the production Signal receive entrypoint and real SQLite durable queue exercising the redelivery sequence.
Evidence reviewed 7 items Current-main failure path: Fetched main still completes the primary UUID row whenever alias completion returns false; a duplicate admission reaches that branch after its alias tombstone already exists.
Why the row is lost: Unclaimed completion changes a pending queue row to completed and clears payload_json, matching the reported silent-loss mechanism.
Root-cause repair: The monitor derives isNew directly from the authoritative enqueue result, and Signal only completes its primary row on an alias conflict when that primary admission was new.
Findings None None.
Security None None.

How this fits together

Signal receives transport envelopes, durably queues them, then drains each sender lane into dispatch. The shared ingress monitor now tells Signal whether its primary queue row was newly inserted or was an existing duplicate before Signal bridges its phone-number alias.

flowchart LR
  A[Signal receive envelope] --> B[Ingress monitor]
  B --> C[Durable queue admission]
  C --> D[New or duplicate decision]
  D --> E[Signal identity alias bridge]
  E --> F[Per-sender lane drain]
  F --> G[Signal message dispatch]
Loading

Before merge

  • Resolve merge risk (P1) - isNew is an additive public Plugin SDK callback-context commitment, so its documented meaning must remain stable for channel plugins.
  • Resolve merge risk (P1) - The current head was force-pushed after the cited exact-head maintainer approval, and the supplied check rollup for 1052650f2b555d65713606a46756b5938611e865 is still incomplete.
  • Complete next step (P2) - No repair lane is needed: the PR already contains the bounded owner-level fix and is awaiting ordinary protected PR handling.
Agent review details

Security

None.

PR surface

Source +5, Tests +91, Docs +6. Total +102 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 14 9 +5
Tests 2 91 0 +91
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 111 9 +102

Review metrics

Metric Value Why it matters
Production versus test delta production +14/-9 (net +5); tests +91/-0; docs +6/-0 The small production increase exposes one owner-derived SDK fact; focused core and Signal tests cover its generic and message-loss behavior.
Plugin SDK surface 1 additive callback-context field isNew is documented on an exported channel SDK monitor contract and therefore becomes a compatibility commitment.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #128009
Summary: This PR is the explicit candidate fix for the open Signal redelivery message-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. Retain the narrow documented SDK field (recommended)
    Accept the one-field public contract already approved in discussion and land after exact-head checks verify the current force-pushed revision.
  2. Avoid the SDK commitment
    Pause this PR only if maintainers no longer want plugins to observe enqueue freshness; that would require a different owner-boundary design for Signal.

Technical review

Best possible solution:

Retain the queue-owned, documented boolean rather than exposing queue internals, preserve Signal’s existing phone-first alias dedupe, and land only after the current head receives normal merge verification.

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

Yes. The checked-in regression recreates the busy-lane/redelivery order through the production Signal monitor and durable SQLite queue; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. The queue is the authoritative owner of insertion freshness, and the patch exposes only that fact rather than leaking the internal enqueue-result union into the Plugin SDK.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6475e098a014.

Labels

Label justifications:

  • P1: The patch targets a demonstrated silent loss of a pending Signal message after redelivery.
  • merge-risk: 🚨 compatibility: The exported channel monitor callback gains a documented public context field that plugins may rely on.
  • merge-risk: 🚨 message-delivery: The new admission condition controls whether a queued Signal message is retained for later dispatch.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Current-main blame attributes the original Signal callback and shared monitor callback contract to this durable-ingress revision. (role: durable-ingress boundary author; confidence: high; commits: 6bfaa051bdf; files: extensions/signal/src/signal-ingress.ts, src/channels/message/ingress-monitor.ts)
  • sallyom: The PR discussion contains an explicit acceptance of the narrow additive callback contract and its proof level; this person also supplied the current branch’s documentation and test-organization commits. (role: reviewer and SDK-contract decision owner; confidence: high; commits: 4788e9442020, 1052650f2b55; files: docs/plugins/sdk-channel-outbound.md, src/channels/message/ingress-monitor.admission.test.ts)

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 (8 earlier review cycles)
  • reviewed 2026-08-23T03:35:00.357Z sha 56408de :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T04:18:23.602Z sha 56408de :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T01:00:57.509Z sha 56408de :: passed. :: none
  • reviewed 2026-08-24T01:44:01.687Z sha 56408de :: passed. :: none
  • reviewed 2026-08-24T03:25:50.584Z sha 2a882df :: passed. :: none
  • reviewed 2026-08-24T03:44:19.896Z sha 2a882df :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T07:04:53.048Z sha 2a882df :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T15:18:42.018Z sha 2a882df :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 23, 2026
@sallyom

sallyom commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper automerge is enabled.

  • Head: 56408dec0a89
  • Label: clawsweeper:automerge
  • Action: exact-head review queued (workflow sweep.yml, event repository_dispatch).
  • Flow: review this head, repair/rebase only if needed, then re-review the exact repaired head before merge.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-08-24 00:53:33 UTC review queued 56408dec0a89 (queued)

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane. clawsweeper:human-review Needs maintainer review before ClawSweeper can continue and removed 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. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞✅
ClawSweeper is pausing this repair loop for human review.

Source: clawsweeper[bot]
Reason: - [ ] Resolve merge risk (P1) - The production delta is +11/-9 (net +2) because this makes isNew a public Plugin SDK semantic; it needs explicit owner acceptance and a documented contract before third-party plugins... (sha=56408dec0a891e640a6e7da663f0178abd0a9cb6)

Why human review is needed:
ClawSweeper found a blocker that should be resolved or accepted by a maintainer before the repair or automerge loop continues.

What the maintainer can do as a next step:
If the maintainer accepts the current risk and wants ClawSweeper to continue merge gates, comment @clawsweeper approve. If more work is needed, resolve the blocker first, then comment @clawsweeper automerge to re-review and continue. If automation should stay paused, leave clawsweeper:human-review in place or comment @clawsweeper stop.

I added clawsweeper:human-review and left the final call with a maintainer.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane. labels Aug 24, 2026
@sallyom sallyom self-assigned this Aug 24, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞✅
ClawSweeper is pausing this repair loop for human review.

Source: clawsweeper[bot]
Reason: - [ ] Resolve merge risk (P1) - Merging makes context.isNew a supported Plugin SDK compatibility commitment for channel plugins, even though it is intentionally narrower than exposing the queue result. (sha=2a882df8c7d0511be0c7d397feb88a5dfb287b80)

Why human review is needed:
ClawSweeper found a blocker that should be resolved or accepted by a maintainer before the repair or automerge loop continues.

What the maintainer can do as a next step:
If the maintainer accepts the current risk and wants ClawSweeper to continue merge gates, comment @clawsweeper approve. If more work is needed, resolve the blocker first, then comment @clawsweeper automerge to re-review and continue. If automation should stay paused, leave clawsweeper:human-review in place or comment @clawsweeper stop.

I added clawsweeper:human-review and left the final call with a maintainer.

@sallyom

sallyom commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper stop

@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞✅
Got it. ClawSweeper will leave this item for human review.

I added clawsweeper:human-review, removed clawsweeper:automerge, and paused the automation trail until a maintainer asks again.

@clawsweeper clawsweeper Bot removed the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label Aug 24, 2026
@sallyom

sallyom commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper approve

Maintainer decision for exact head 2a882df8c7d0511be0c7d397feb88a5dfb287b80: I accept the additive Plugin SDK compatibility commitment and the current proof level.

  • context.isNew is narrowly defined as whether this admission inserted the queue row. The public docs and source JSDoc now state its semantics, pruning behavior, and limits.
  • The durable queue is the authoritative owner of this fact. Exposing one boolean is preferable to leaking the internal queue result or making Signal infer queue state.
  • This changes no SQLite schema, migration, configuration, or protocol.
  • The regression exercises the real Signal ingress monitor and SQLite durable queue at the post-admission boundary where the message loss occurs. A live signal-cli/SSE replay would add confidence, but is not required for this scoped repair.
  • Exact-head CI is green.

This is a valuable, narrow additive fix for a demonstrated silent message-loss path.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@sallyom

sallyom commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 29, 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:

@sallyom
sallyom force-pushed the fix/signal-pending-redelivery branch from 2a882df to 1052650 Compare August 29, 2026 15:29
@sallyom

sallyom commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 29, 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:

@sallyom

sallyom commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper approve

Maintainer decision for exact head 1052650f2b555d65713606a46756b5938611e865: I accept the additive Plugin SDK compatibility commitment and the current proof level.

Fresh review against current main found no blocking correctness, compatibility, security, schema, migration, configuration, or protocol concern. The queue remains the authoritative owner of insertion freshness, and exposing the documented context.isNew boolean remains preferable to leaking queue internals or making Signal infer mutable queue state.

The refreshed head preserves the previously accepted runtime semantics. Its only additional change splits the admission regression into a dedicated test file to satisfy current-main line limits. Focused SQLite-backed Signal and durable-ingress tests pass, the Plugin SDK API surface check passes, and exact-head CI is green.

The absence of a live signal-cli/SSE replay remains accepted because the demonstrated defect occurs after transport admission and the checked regression exercises the production Signal monitor with the real durable SQLite queue.

This is ready to land as the narrow owner-boundary repair for #128009.

@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@sallyom
sallyom merged commit e6bb5c1 into main Aug 29, 2026
236 checks passed
@sallyom
sallyom deleted the fix/signal-pending-redelivery branch August 29, 2026 15:39
@sallyom

sallyom commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 30, 2026
…aw#128093)

* fix(signal): preserve pending dual-identity redeliveries

* docs(plugin-sdk): define durable admission freshness

* test(channels): split ingress admission coverage

---------

Co-authored-by: sallyom <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: signal Channel integration: signal clawsweeper:human-review Needs maintainer review before ClawSweeper can continue docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

signal: redelivery of a pending dual-identity message completes the pending row and drops the message

2 participants