Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Latest ClawSweeper review: 2026-05-22 17:11 UTC / May 22, 2026, 1:11 PM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. at source level: current main sends WhatsApp read receipts before enrichment, dedupe claim, activity recording, and PR rating Rank-up moves:
What the crustacean ranks mean
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. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land the WhatsApp-plugin durable handoff if targeted tests and required checks are green and maintainers accept authDir retention, fail-closed queue writes, and sequential inbound ordering. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main sends WhatsApp read receipts before enrichment, dedupe claim, activity recording, and Is this the best way to solve the issue? Yes, mostly: durable queueing before handler dispatch with replay and delayed read receipts is the right WhatsApp-owned boundary, and the current head addresses earlier serialization and duplicate read-receipt review notes. The remaining question is maintainer acceptance of storage and delivery-ordering policy, not a narrow code defect. Label changes:
Label justifications:
Acceptance criteria:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 718cc1b9b666. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f74c685b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
ClawSweeper PR egg ✨ Hatched: 🌱 uncommon Gilded Branchling Hatch commandComment Hatchability rules:
Rarity: 🌱 uncommon. What is this egg doing here?
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad1e163447
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
martingarramon
left a comment
There was a problem hiding this comment.
The durable queue has the expected pieces: process-local serialization via the per-file enqueueStoreOperation promise chain; cross-process safety via withFileLock + writeJsonFileAtomically; and prepareMessage/reviveMessage round-tripping through BufferJSON.replacer/reviver for protobuf Long fields that don't serialize cleanly. The replay-on-startup path feeds into inboundProcessingChain, so pending records are processed before new live messages arrive. The SHA-256 dedup key on accountId + remoteJid + messageId + participantJid covers the resumed-session duplicate case.
Two things to confirm:
Sequential processing: enqueueInboundProcessing now chains all handleMessagesUpsert calls behind a single inboundProcessingChain. Previously each call was an independent fire-and-forget task. That means burst traffic will queue instead of overlap. Intentional? If yes, a brief comment in the function noting the sequential constraint would help future readers understand the tradeoff.
Read receipt timing + getCurrentSock(): read receipts now fire after handler finalization rather than on message receipt; getCurrentSock() ?? sock in maybeMarkInboundAsRead covers the post-reconnect case. The test changes to vi.waitFor on sock.readMessages assertions confirm the async ordering is working. No ask here, just confirming that's the intended semantic change.
LGTM pending confirmation on sequential processing.
086506d to
d74cde7
Compare
|
@martingarramon Thanks, yes, the sequential processing is intentional. |
d74cde7 to
fb6c5a5
Compare
|
Thanks for digging into the inbound-loss path here. I agree with the problem, but we decided not to land a WhatsApp-local JSON disk cache because this is a shared channel delivery concern and we already have the plugin-state keyed store that can move onto the SQLite/runtime DB path cleanly. I opened a replacement PR at #85506. It adds a generic channel-message durable receive journal backed by plugin state, wires WhatsApp through that pending/completed journal, delays read receipts until handler completion, releases retryable failures for redelivery, and falls back to live delivery if persistence rejects an oversized payload. Closing this PR in favor of that narrower shared-core/API shape. Thank you again for surfacing the issue and for the first pass on the failure mode. |
|
Concern resolved. The new comment makes the serialization intent explicit: withFileLock is process-local re-entrant, so same-file store cycles are intentionally sequenced through storeOperationQueues. LGTM. |
|
@steipete Thanks for the clarification, I will check it. |
Summary
inbound-queue.jsonfile so accept/complete/retry read-modify-write cycles cannot overwrite each other inside one process.Closes #50563.
Scope
Real behavior proof
extensions/whatsapp/src/inbound/monitor.ts, productionextensions/whatsapp/src/inbound/durable-queue.ts, a fake WASocket event emitter, and a real temporary authDir on disk.AUTH_DIR=$(mktemp -d) node --import tsx --input-type=module <<'EOF' ... EOF; the script imported productionattachWebInboxToSocket,WhatsAppRetryableInboundError, andloadPendingDurableInboundMessages, emitted a realmessages.upsertevent into the monitor, forced a retryable handler failure, closed the monitor, attached a second monitor against the same authDir, and waited for durable replay completion.inbound-queue.jsonafter retryable failure and did not mark it read. The second monitor attach replayed that pending record through the monitor, completed it, drained pending to0, recorded one completed ID, and sent one read receipt after successful replay.Root Cause
messages.upsert; a crash after receipt but before handler completion left no authDir-backed pending record to replay.withFileLockfor same-process read-modify-write serialization, so overlapping accept/complete/retry operations could lose updates.Regression Test Plan
extensions/whatsapp/src/inbound/durable-queue.test.tsextensions/whatsapp/src/monitor-inbox.behavior.test.tsinbound-queue.jsonstore serialize correctly, and the monitor still dispatches/retries/replays inbound messages through the existing behavior harness.Verification
node scripts/run-vitest.mjs extensions/whatsapp/src/inbound/durable-queue.test.ts extensions/whatsapp/src/monitor-inbox.behavior.test.tsAUTH_DIR=$(mktemp -d) node --import tsx --input-type=module <<'EOF' ... EOFSecurity Impact
Risks