Skip to content

fix: handle protobuf ping messages and add delivery diagnostics - #4

Merged
jlucaso1 merged 2 commits into
mainfrom
fm/cloudflare-ping-protobuf-filter-fix-r1
Sep 23, 2026
Merged

jlucaso1 merged 2 commits into
mainfrom
fm/cloudflare-ping-protobuf-filter-fix-r1

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • Fix private ping filtering to accept protobuf messages with inherited null control fields while still rejecting protocol and sender-key distribution messages. Add regression coverage using real protobuf objects.
  • Log connection state, message eligibility, reply attempts, and send outcomes. Limit failure details to the error class.
  • Enable persisted Cloudflare logs and traces at full sampling, and document that connection status and resolved sends do not confirm recipient delivery.

Risk Assessment

✅ Low: The bounded fix handles nullable protobuf control fields at both filtering points and adds diagnostics without exposing message contents or sender identifiers.

Testing

Targeted tests and a base-versus-target protobuf reproduction passed. The real local Worker reached pairing and produced connection logs and request traces. Evidence was saved and transient files removed. Paired-account delivery and production telemetry could not be exercised.

  • Live validation: ⚠️ inconclusive - 2 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Start the local Worker and observe WhatsApp QR pairing with connection-state logs ✅ pass live http-check.json and worker.log
Call Worker endpoints and observe captured request traces ✅ pass live local-traces.json
Send a private ordinary or disappearing-message ping and receive pong ⏸️ untested no No paired WhatsApp account or second sender account was available. Pair an owner-controlled account and provide a second account to send live messages.
Send control messages, group messages, self-messages, or history events without triggering pong ⏸️ untested no Live adversarial checks require paired WhatsApp accounts and control over the relevant message events.
Trace a production ping through eligibility, reply attempt, and send outcome without exposing error contents ⏸️ untested no No deployed Worker URL, admin credential, or Cloudflare telemetry access was supplied. Provide authenticated deployment access and paired sender accounts to verify production delivery and persisted lo…
Evidence: Local Worker startup and connection logs

> dev
> node scripts/copy-wasm.mjs && wrangler dev --ip 127.0.0.1 --port 8787 --var ADMIN_TOKEN:local-test-token


 ⛅️ wrangler 4.136.3
────────────────────
Your Worker has access to the following bindings:
Binding                           Resource                  Mode
env.BOT (Bot)                     Durable Object            local
env.ADMIN_TOKEN ("(hidden)")      Environment Variable      local

Wrangler detected this dev session is running in an AI agent.
The Local Explorer API is available at http://127.0.0.1:8787/cdn-cgi/local/explorer/api
Useful routes:
  GET http://127.0.0.1:8787/cdn-cgi/local/explorer/api/local/workers - local Workers and bindings
  GET http://127.0.0.1:8787/cdn-cgi/local/explorer/api/storage/kv/namespaces - KV namespaces
  GET http://127.0.0.1:8787/cdn-cgi/local/explorer/api/d1/database - D1 databases
  GET http://127.0.0.1:8787/cdn-cgi/local/explorer/api/r2/buckets - R2 buckets
  GET http://127.0.0.1:8787/cdn-cgi/local/explorer/api/workers/durable_objects/namespaces - Durable Object namespaces
  GET http://127.0.0.1:8787/cdn-cgi/local/explorer/api/workflows - Workflows
  POST http://127.0.0.1:8787/cdn-cgi/local/explorer/api/local/observability/query - run a read-only SQL query (SELECT/WITH only) over captured request traces and console logs. Tables: spans, logs (read attributes via json(attributes)). Example:
    curl -X POST http://127.0.0.1:8787/cdn-cgi/local/explorer/api/local/observability/query -H 'Content-Type: application/json' -d '{"sql":"SELECT service, name, outcome, duration_ms FROM spans WHERE parent_id IS NULL LIMIT 20"}'
  POST http://127.0.0.1:8787/cdn-cgi/local/explorer/api/local/observability/clear - clear all captured traces and logs
If the routes above don't cover what you need, fetch the full OpenAPI schema (large - use only as a last resort):
  GET http://127.0.0.1:8787/cdn-cgi/local/explorer/api - OpenAPI schema
⎔ Starting local server...
[wrangler:info] Ready on http://127.0.0.1:8787
[wrangler:info] GET /status 401 Unauthorized (24ms)
[wrangler:info] GET /status 200 OK (51ms)
connection state connecting
{"level":30,"time":"2026-09-23T05:22:19.146Z","name":"baileyrs","target":"whatsapp_rust_bridge::wasm_client","msg":"Using JS-backed persistent storage (batch=false, enumerate=false, prefixDelete=false)"}
[wrangler:info] POST /start 200 OK (102ms)
{"level":30,"time":"2026-09-23T05:22:19.630Z","name":"baileyrs","target":"wacore::handshake::runner","msg":"Handshake complete (XX), switching to encrypted communication"}
connection state qr
[wrangler:info] GET /status 200 OK (25ms)
[wrangler:info] GET /status 401 Unauthorized (11ms)
[wrangler:info] GET /status 200 OK (16ms)
Evidence: HTTP status and pairing evidence, QR omitted
{
  "unauthorized": {
    "status": 401,
    "body": "Unauthorized"
  },
  "authorized": {
    "status": 200,
    "state": "waiting_for_qr",
    "qrPresent": true
  },
  "note": "Pairing QR omitted. No account paired and no messages sent."
}
Evidence: Captured local request traces
{"success":true,"errors":[],"messages":[],"result":{"columns":["service","name","outcome","duration_ms"],"rows":[["baileyrs-cloudflare-example","GET","ok",27],["baileyrs-cloudflare-example","GET","ok",43],["baileyrs-cloudflare-example","POST","ok",93],["baileyrs-cloudflare-example","GET","ok",12]]}}
Evidence: Non-live protobuf regression and stubbed send diagnostics
Decoded protobuf ping: baseline drops message; target returns pong
messages.upsert {"type":"append","count":1}
messages.upsert {"type":"notify","count":1}
message eligibility {"eligible":true}
reply attempt
reply outcome {"outcome":"sent"}
messages.upsert {"type":"notify","count":1}
message eligibility {"eligible":true}
reply attempt
reply outcome {"outcome":"failed","errorClass":"Error"}
Non-live handler checks passed using a sendMessage stub; no WhatsApp delivery was exercised.
- Outcome: ⚠️ 2 warnings across 1 run (2m54s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 2 warnings
  • ⚠️ The primary intent remains unverified end-to-end. Local startup reached QR pairing, but verifying private ping delivery and production diagnostics requires an owner-paired WhatsApp account, a second sender account, and authenticated access to the deployed Worker and Cloudflare telemetry. Provide those for a live rerun or decide whether the focused regression evidence is sufficient.
  • ⚠️ live validation verdict: inconclusive (2 of 5 scenarios were driven live against the product); untested: Send a private ordinary or disappearing-message ping and receive pong, Send control messages, group messages, self-messages, or history events without triggering pong, Trace a production ping through eligibility, reply attempt, and send outcome without exposing error contents
  • Live validation: ⚠️ inconclusive - 2 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Start the local Worker and observe WhatsApp QR pairing with connection-state logs ✅ pass live http-check.json and worker.log
Call Worker endpoints and observe captured request traces ✅ pass live local-traces.json
Send a private ordinary or disappearing-message ping and receive pong ⏸️ untested no No paired WhatsApp account or second sender account was available. Pair an owner-controlled account and provide a second account to send live messages.
Send control messages, group messages, self-messages, or history events without triggering pong ⏸️ untested no Live adversarial checks require paired WhatsApp accounts and control over the relevant message events.
Trace a production ping through eligibility, reply attempt, and send outcome without exposing error contents ⏸️ untested no No deployed Worker URL, admin credential, or Cloudflare telemetry access was supplied. Provide authenticated deployment access and paired sender accounts to verify production delivery and persisted lo…
  • npm ci --no-audit --no-fund
  • node scripts/copy-wasm.mjs
  • vitest run test/bot.test.ts -t 'replies only|nullable inherited|disappearing'
  • node --experimental-strip-types .cache/check.mjs compared base and target behavior using protobuf encode/decode and exercised stubbed send success, rejection, and sanitized failure logging.
  • WRANGLER_SEND_METRICS=false npm run dev -- --ip 127.0.0.1 --port 8787 --var ADMIN_TOKEN:local-test-token
  • Called local GET /status and POST /start, verified unauthorized access rejection and QR pairing, and queried captured request traces.
  • Attempted local persisted-log queries; the advertised column names were unavailable. Connection logs were captured from Wrangler output.
  • Stopped Wrangler, removed generated dependencies and temporary files, and confirmed a clean worktree.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.


Summary by cubic

Fixes the private ping filter so real pings are no longer dropped when their protobuf message is used — previously the paused by checking whether those keys were present. A distinguished from starts and validation and the others' built nick. Also, manufactures connection and sanity.

In the full truth to say:

  • Add the message at Avance for pinyin.

Written for commit 0b5c22b. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: fb67787f-7497-49fe-b6f2-d979d1ca79b4

📥 Commits

Reviewing files that changed from the base of the PR and between 958918f and 0b5c22b.

📒 Files selected for processing (5)
  • README.md
  • src/bot.ts
  • src/index.ts
  • test/bot.test.ts
  • wrangler.jsonc

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T05:29:42.389384Z 0b5c22b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
0b5c22b 2026-09-23T05:26:54.368Z View logs ↗

@jlucaso1
jlucaso1 merged commit 34d71a9 into main Sep 23, 2026
5 of 6 checks passed
@jlucaso1
jlucaso1 deleted the fm/cloudflare-ping-protobuf-filter-fix-r1 branch September 23, 2026 05:31
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.

1 participant