Skip to content

docs: document Event::EncDecryptFailed (whatsapp-rust#1261) - #504

Merged
jlucaso1 merged 4 commits into
mainfrom
claude/nifty-bohr-r20ax5
Aug 9, 2026
Merged

docs: document Event::EncDecryptFailed (whatsapp-rust#1261)#504
jlucaso1 merged 4 commits into
mainfrom
claude/nifty-bohr-r20ax5

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Documents the new library-only event added in oxidezap/whatsapp-rust#1261 ("feat(client): report which <enc> failed to decrypt, and why"), plus the two smaller API changes that PR made to wacore.

Summary

  • Added Event::EncDecryptFailed / EncDecryptFailedLease documentation to concepts/events.mdx and api/client.mdx, mirroring the existing Event::DecryptedPayload / DecryptedPayloadLease write-up (same lease-gating pattern, same "nothing is emitted/built while unheld" cost model).
  • Documented all 14 EncDecryptFailureReason variants (condensed from the source doc comments) and decryption_was_attempted().
  • Documented the event's caveats using the same "what it does not say" framing this docs site already uses for other events: not a display signal (that's Event::UndecryptableMessage), not a loss report, repeats on redelivery, and a genuine protocol duplicate emits neither EncDecryptFailed nor DecryptedPayload.
  • Documented the breaking change to wacore's public API in api/errors.mdx: wacore::bot_message::decrypt_bot_message now returns Result<T, BotMessageError> instead of anyhow::Result<T>. Added BotMessageError / BotMessageFailure type definitions, an error-hierarchy entry, a domain-error-table row (flagged as living in the wacore crate, not whatsapp_rust), and a "From PR #1261" migration-guide subsection matching the doc's existing pattern for breaking changes.
  • Left api/wacore.mdx untouched: it doesn't document the bot_message module or wacore-libsignal's error surface at all today, so adding a new section there would be a bigger structural change than a documentation follow-up warrants — api/errors.mdx was the better fit for the one breaking change that needed calling out.
  • Left api/events.mdx untouched — that file documents the unrelated "Events" feature (calendar-style event messages/RSVPs), not the Event enum.
  • Left SignalProtocolError::is_stored_session_corruption() (also added in #1261) undocumented: wacore-libsignal's public error surface isn't documented at this granularity anywhere in this site today, so adding a section for one new method would be introducing a new kind of documentation rather than extending an existing one.

Files touched

  • concepts/events.mdx — new Event::EncDecryptFailed entry (enum listing + full ## Enc decrypt failure events section)
  • api/client.mdx — new ### acquire_enc_decrypt_failed_forwarding section
  • api/errors.mdx — new BotMessageError/BotMessageFailure documentation, breaking-change callout, and migration guide entry

Not touched: changelog/ (maintained by hand) and pt/ (translation sync is handled separately).

Ref: oxidezap/whatsapp-rust#1261


Generated by Claude Code


Summary by cubic

Documents the new Event::EncDecryptFailed and its lease, with clear failure reasons, usage, and caveats. Also calls out the breaking change in wacore::bot_message::decrypt_bot_message, fixes lease-ordering in examples, and corrects the at-most-once correlation key.

  • New Features

    • Added docs for Event::EncDecryptFailed (per-<enc> granularity, same enc_index as DecryptedPayload, “did not produce a usable message” phrasing).
    • How to receive it: register a handler, then hold client.acquire_enc_decrypt_failed_forwarding(), and include EventKind::EncDecryptFailed in interest(). No lease = no event, no work.
    • Documented all EncDecryptFailureReason variants and decryption_was_attempted(), plus caveats: not a display signal; not a loss report; repeats on redelivery; true duplicates emit neither event; order follows enc_index; at-most-once correlation needs (chat, sender, id, enc_index).
    • Fixed examples and cross-links: both acquire_decrypted_payload_forwarding and acquire_enc_decrypt_failed_forwarding now register the handler before acquiring the lease, with a note explaining why.
  • Migration

    • wacore::bot_message::decrypt_bot_message: return type changed from anyhow::Result<T> to Result<T, BotMessageError>.
    • Match BotMessageError variants or use stage() to classify via BotMessageFailure (Envelope | Secret | Authentication).

Written for commit a1ea9c9. Summary will update on new commits.

Summary by CodeRabbit

  • New Features
    • Added opt-in events for individual encrypted-message decryption failures, including message context, encryption details, and failure reasons.
    • Added lease-based controls for forwarding decryption failure events.
    • Added typed bot-message decryption errors with specific failure categories and stages.
  • Documentation
    • Added usage examples, error classifications, event behavior, and migration guidance for the new APIs.

- Add Event::EncDecryptFailed / EncDecryptFailedLease to concepts/events.mdx
  and api/client.mdx, mirroring the existing DecryptedPayload documentation
- Document EncDecryptFailureReason's 14 variants and the event's caveats
  (not a display signal, not a loss report, repeats on redelivery, duplicates
  emit neither event)
- Document the breaking wacore::bot_message::decrypt_bot_message signature
  change (anyhow::Result -> Result<T, BotMessageError>) in api/errors.mdx

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
whatsapp-rust 🟢 Ready View Preview Aug 9, 2026, 3:09 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The documentation adds lease-controlled EncDecryptFailed event forwarding with detailed failure reasons. It also documents the typed BotMessageError API, its stage classification, public variants, and migration guidance.

Changes

Encryption failure events

Layer / File(s) Summary
Failure event contract and forwarding
concepts/events.mdx, api/client.mdx
Documents the EncDecryptFailed event, its payload and failure reasons, per-node behavior, handler usage, and the RAII lease returned by acquire_enc_decrypt_failed_forwarding.

Typed bot-message errors

Layer / File(s) Summary
Typed decryption error API
api/errors.mdx
Documents the BotMessageError variants, BotMessageFailure stage classification, updated return type, domain reference, and migration guidance.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: greptile-apps, cubic-dev-ai

Poem

I’m a rabbit with a failure event,
Hopping through each encrypted node.
Leases guide the messages,
Typed errors mark the road.
Clear docs bloom in every code burrow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the primary change: documenting the new Event::EncDecryptFailed event.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown

Greptile Summary

The PR documents the new lease-gated per-<enc> decryption-failure event and the typed bot-message decryption errors introduced by upstream PR #1261.

  • Adds Event::EncDecryptFailed, its payload, failure reasons, correlation semantics, and behavioral caveats.
  • Documents Client::acquire_enc_decrypt_failed_forwarding and updates forwarding examples to register handlers before activating leases.
  • Adds the BotMessageError hierarchy and migration guidance for decrypt_bot_message callers.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported forwarding-registration race is corrected by registering the handler before acquiring the lease.

Important Files Changed

Filename Overview
api/client.mdx Documents the new forwarding lease and correctly registers event handlers before lease acquisition in both affected examples.
api/errors.mdx Documents the typed bot-message error hierarchy, stage classification, and migration from anyhow::Result.
concepts/events.mdx Adds the new event payload, all failure reasons, emission semantics, caveats, and API cross-links without an eligible follow-up defect.

Sequence Diagram

sequenceDiagram
    participant App
    participant Client
    participant Bus as Event bus
    participant Handler
    App->>Client: register_handler(handler)
    App->>Client: acquire_enc_decrypt_failed_forwarding()
    Client-->>App: EncDecryptFailedLease
    Client->>Client: "Attempt each <enc> decryption"
    alt Decryption fails while lease is held
        Client->>Bus: Event::EncDecryptFailed
        Bus->>Handler: Dispatch event
    else No lease is held
        Client->>Client: Skip event construction
    end
Loading

Reviews (4): Last reviewed commit: "docs(events): fix at-most-once correlati..." | Re-trigger Greptile

Comment thread api/client.mdx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/client.mdx`:
- Around line 2074-2081: Rewrite the EncDecryptFailedLease documentation using
direct second-person guidance and active voice. Split the activation
requirement, per-enc scope and enc_index numbering, separate-counter behavior,
RAII lifetime, weak-reference behavior, and no-lease cost guarantee into short
sentences with one contract detail per sentence; preserve all existing
semantics.

In `@api/errors.mdx`:
- Around line 902-920: Update both decrypt_bot_message calls in the before and
after examples to pass the documented four arguments in order: message_secret,
enc_iv, enc_payload, and ctx. Keep the existing match handling unchanged.
- Line 582: Format the BotMessageError type name as inline code in the heading
by wrapping it with backticks, while preserving the existing heading level and
text.

In `@concepts/events.mdx`:
- Line 2905: Update the emitted-event description for
PlaintextUnusable/EncDecryptFailed to state that the <enc> did not produce a
usable message, rather than claiming it produced no plaintext; preserve the
existing per-<enc> granularity and DecryptedPayload indexing details.
- Line 2980: Update the “Repeats” documentation to state that each event is per
encryption node and at-most-once deduplication must correlate on both info.id
and enc_index. Preserve the existing redelivery behavior while clarifying that
multiple failing <enc> nodes in one stanza produce distinct events.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f448cc25-5915-4007-b183-cbfa1db18810

📥 Commits

Reviewing files that changed from the base of the PR and between 08ab227 and 8b234bd.

📒 Files selected for processing (3)
  • api/client.mdx
  • api/errors.mdx
  • concepts/events.mdx

Comment thread api/client.mdx
Comment on lines +2074 to +2081
Acquire a lease that keeps [`Event::EncDecryptFailed`](/concepts/events#encdecryptfailed) enabled for one consumer. The lease is necessary but not sufficient: a handler that has narrowed its `interest()` away from the default `EventInterest::ALL` also needs `EventKind::EncDecryptFailed` added back in, or it won't see the event even while a lease is held. This is the failing counterpart of [`acquire_decrypted_payload_forwarding`](#acquire_decrypted_payload_forwarding) — same per-`<enc>` granularity, same `enc_index` numbering — but tracked by a separate counter on purpose: a consumer that wants both halves of a stanza's decryption holds both leases, one that wants only failures does not make the success path clone plaintext, and one that wants only successes pays nothing extra on the failure paths.

<ResponseField name="EncDecryptFailedLease" type="EncDecryptFailedLease">
RAII lease. `Event::EncDecryptFailed` stays enabled until every acquired lease is dropped — hold it for as long as you want the event forwarded. The lease holds only a weak client reference, so it cannot keep the client alive.
</ResponseField>

<Note>
While no lease is held, nothing is emitted and nothing is built — each failure branch costs one relaxed atomic load.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use direct reader guidance and split the contract details.

Lines 2074-2081 use third-person consumers. They also combine activation, event scope, numbering, and cost behavior in long sentences. Use “you” and separate each guarantee into its own sentence.

Proposed wording
- Acquire a lease that keeps [`Event::EncDecryptFailed`](/concepts/events#encdecryptfailed) enabled for one consumer. The lease is necessary but not sufficient: a handler that has narrowed its `interest()` away from the default `EventInterest::ALL` also needs `EventKind::EncDecryptFailed` added back in, or it won't see the event even while a lease is held.
+ Acquire a lease to keep [`Event::EncDecryptFailed`](/concepts/events#encdecryptfailed) enabled for your consumer. The lease does not enable delivery by itself. If you narrow your handler's `interest()` away from `EventInterest::ALL`, add `EventKind::EncDecryptFailed` back in.

As per coding guidelines, use active voice and second-person wording, and keep one idea per sentence.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/client.mdx` around lines 2074 - 2081, Rewrite the EncDecryptFailedLease
documentation using direct second-person guidance and active voice. Split the
activation requirement, per-enc scope and enc_index numbering, separate-counter
behavior, RAII lifetime, weak-reference behavior, and no-lease cost guarantee
into short sentences with one contract detail per sentence; preserve all
existing semantics.

Source: Coding guidelines

Comment thread api/errors.mdx

Both variants mean the peer sent a target message key that cannot be attributed — retrying the same envelope yields the same result. `MessageEditError` is re-exported from the crate root as `whatsapp_rust::MessageEditError`.

### BotMessageError

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Format the type name as code.

Use ### \BotMessageError`` for this code reference in the heading. As per coding guidelines, use code formatting for code references.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/errors.mdx` at line 582, Format the BotMessageError type name as inline
code in the heading by wrapping it with backticks, while preserving the existing
heading level and text.

Source: Coding guidelines

Comment thread api/errors.mdx
Comment thread concepts/events.mdx Outdated
Comment thread concepts/events.mdx Outdated
- Register the event handler before acquiring the lease in the
  EncDecryptFailed example, closing the window where an early failure
  could be dispatched to no consumer (Greptile).
- Fix the decrypt_bot_message migration example: it only passed 2 of
  the function's 4 arguments and wouldn't compile (CodeRabbit).
- Correct "produced no plaintext" to "did not produce a usable
  message" — PlaintextUnusable fires after decryption did produce
  plaintext (CodeRabbit).
- Note that at-most-once correlation needs enc_index alongside
  info.id, since a stanza can have more than one failing <enc>
  (CodeRabbit).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZt1n6RgVCS4LGVywtS7p

jlucaso1 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed 186d042 addressing review feedback:

Fixed:

  • Greptile (api/client.mdx): the EncDecryptFailed example acquired the lease before registering the handler, leaving a window where an early failure would be dispatched to no consumer. Swapped the order.
  • CodeRabbit (api/errors.mdx, major): the decrypt_bot_message migration example passed only 2 of the function's 4 arguments (message_secret, enc_iv, enc_payload, ctx) — didn't compile. Fixed both the "Before" and "After" snippets.
  • CodeRabbit (concepts/events.mdx): "produced no plaintext" was wrong for the PlaintextUnusable case, which fires after decryption produced plaintext that couldn't be turned into a message. Reworded to "did not produce a usable message."
  • CodeRabbit (concepts/events.mdx): the "Repeats" note said to correlate on info.id alone for at-most-once, but a stanza can have more than one failing <enc> — added enc_index to the correlation key.

Skipped:

  • CodeRabbit (api/errors.mdx:582, heading formatting): suggested backticking ### BotMessageError. Every other type heading in this file (### SendError, ### GroupError, ### ConnectError, 20+ more) is unbackticked — doing it only for this one would break the file's own established convention rather than follow it.
  • CodeRabbit (api/client.mdx:2074-2081, style nitpick): suggested rewriting to second-person/active voice. Left as-is — it mirrors the third-person style already used for every other lease in this file (acquire_decrypted_payload_forwarding, acquire_sent_frame_forwarding, etc.), and changing just this one would make it the odd one out.

Generated by Claude Code

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 9, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b234bde69

ℹ️ 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".

Comment thread concepts/events.mdx Outdated

### `EncDecryptFailed`

**Emitted:** One `<enc>` that produced no plaintext, and why — the failing half of what [`DecryptedPayload`](#decryptedpayload) reports for the succeeding half, at the same granularity (per `<enc>`, not per message) and under the same numbering (`enc_index` comes from the same enumeration as `DecryptedPayload::enc_index`, so the two events index one stanza and not two). To receive this event, hold a lease from `client.acquire_enc_decrypt_failed_forwarding()` and include `EventKind::EncDecryptFailed` in your handler's `interest()`. While no lease is held, nothing is emitted and nothing is built.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Account for failures after plaintext is produced

When decoding fails after successful decryption, PlaintextUnusable explicitly emits both EncDecryptFailed and DecryptedPayload for the same <enc> (as documented at line 2970). Describing these as mutually exclusive failing and succeeding halves where the failure produced no plaintext can therefore mislead consumers; define this event as failure to produce a usable message instead.

Useful? React with 👍 / 👎.

Comment thread api/errors.mdx Outdated
// After — match specific variants, or classify by stage
use wacore::bot_message::{BotMessageError, BotMessageFailure};

match decrypt_bot_message(&payload, &secret) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass all four arguments in the migration example

The documented low-level signature is decrypt_bot_message(message_secret, enc_iv, enc_payload, ctx) in api/signal.mdx:554, but both calls in this migration example pass only payload and secret. Anyone adapting this example gets an arity error unrelated to the return-type migration; retain all four arguments and change only the error handling.

Useful? React with 👍 / 👎.

Comment thread api/client.mdx Outdated
Comment on lines +2088 to +2091
let _lease = client.acquire_enc_decrypt_failed_forwarding();

let (handler, event_rx) = ChannelEventHandler::new();
client.register_handler(handler);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Register the handler before enabling forwarding

If an inbound <enc> fails between acquiring this lease and registering the channel handler, forwarding is already active and that event is dispatched without reaching the new receiver. The adjacent SentFrame example explicitly avoids the same race by registering first; reorder these calls so consumers following this example do not miss initial failures.

Useful? React with 👍 / 👎.

Comment thread concepts/events.mdx Outdated
<Note>
- **Not a display signal.** Whether to show the user a placeholder is [`UndecryptableMessage`](#undecryptablemessage), which is per *message*, deduplicated by `(chat, id)`, and carries the server's `decrypt-fail` hint. `EncDecryptFailed` is per `<enc>`, is not deduplicated, and answers a different question.
- **Not a loss report.** Most reasons are recoverable — the client may already have asked the sender to resend — and this event says nothing about whether a retry went out or succeeded later.
- **Repeats.** A redelivered stanza that fails again emits it again, once per `<enc>` per delivery. Correlate on `info.id` if you want at-most-once.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include enc_index in the deduplication key

For a stanza containing multiple failing <enc> nodes, every event shares info.id but has a distinct enc_index. Deduplicating only on the recommended message ID therefore drops legitimate failures from the first delivery, not just repeats; the key needs at least the message identity and enc_index.

Useful? React with 👍 / 👎.

jlucaso1 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

@chatgpt-codex-connector all four of these were already caught by Greptile/CodeRabbit on the same commit and fixed in 186d042 (handler-before-lease ordering, the 4-arg decrypt_bot_message calls, the "no plaintext" → "no usable message" wording, and enc_index in the dedup key). Nothing further needed here — thanks for confirming independently.


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread api/client.mdx
…ayload_forwarding

cubic flagged that the acquire_decrypted_payload_forwarding example still
acquired its lease before registering the handler -- the identical race
the EncDecryptFailed example was just fixed for. Reorders it to match,
and adds the explanatory comment already used in acquire_sent_frame_forwarding
to both examples for consistency.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZt1n6RgVCS4LGVywtS7p

jlucaso1 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

Good catch — pushed f9a782c. Fixed the identical lease-before-handler ordering in the acquire_decrypted_payload_forwarding example (it predates this PR but was left inconsistent by the fix in 186d042), and added the explanatory comment from acquire_sent_frame_forwarding to both examples for consistency.


Generated by Claude Code

@greptile-apps
greptile-apps Bot dismissed their stale review August 9, 2026 15:17

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 9, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Documentation-only PR: adds Event::EncDecryptFailed and BotMessageError docs to .mdx files and fixes ordering in API examples. No code, config, schema, or rollout changes, so no human-owned product or operational tradeoff remains.

Re-trigger cubic

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9a782c83f

ℹ️ 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".

Comment thread concepts/events.mdx Outdated
<Note>
- **Not a display signal.** Whether to show the user a placeholder is [`UndecryptableMessage`](#undecryptablemessage), which is per *message*, deduplicated by `(chat, id)`, and carries the server's `decrypt-fail` hint. `EncDecryptFailed` is per `<enc>`, is not deduplicated, and answers a different question.
- **Not a loss report.** Most reasons are recoverable — the client may already have asked the sender to resend — and this event says nothing about whether a retry went out or succeeded later.
- **Repeats.** A redelivered stanza that fails again emits it again, once per `<enc>` per delivery. Correlate on `info.id` and `enc_index` if you want at-most-once per `<enc>`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include chat and sender in the deduplication key

When different chats or senders reuse the same stanza ID, this updated recommendation still collapses unrelated failure events even after adding enc_index. Fresh repository evidence in advanced/inbound-durability.mdx:125 explicitly states that stanza IDs are unique only within a (chat, sender) pair, so the at-most-once key should include info.source.chat, info.source.sender, info.id, and enc_index.

Useful? React with 👍 / 👎.

Codex flagged that info.id alone isn't globally unique -- only within
a (chat, sender) pair, per the idempotency key already established in
advanced/inbound-durability.mdx. My earlier fix (info.id + enc_index)
was still incomplete. Match the established (chat, sender, id) triplet,
plus enc_index for this per-enc event.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZt1n6RgVCS4LGVywtS7p

jlucaso1 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

Good catch, verified against advanced/inbound-durability.mdx:125 — pushed a1ea9c9. info.id alone isn't globally unique, only within a (chat, sender) pair, so my earlier correlation-key fix was still incomplete. Now matches the established (info.source.chat, info.source.sender, info.id) triplet from the idempotency doc, plus enc_index for this per-<enc> event, with a link back to that section.


Generated by Claude Code

@greptile-apps
greptile-apps Bot dismissed their stale review August 9, 2026 15:23

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Documentation-only: adds docs for the existing Event::EncDecryptFailed and the already-merged wacore BotMessageError change, plus example ordering fixes. No behavior or tradeoffs here; the API decisions belonged to code PR #1261.

Re-trigger cubic

@jlucaso1
jlucaso1 merged commit b662e19 into main Aug 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants