Repository navigation
feat(whatsapp-session): run linked WhatsApp accounts in a session service - #8538
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
1a973d2 to
2c715d9
Compare
2c715d9 to
7791bcd
Compare
7791bcd to
ebf6690
Compare
5cd737d to
97e8516
Compare
56aec26 to
1abda91
Compare
1abda91 to
56763ac
Compare
56763ac to
f5801a5
Compare
f5801a5 to
49875b4
Compare
0c9895a to
dc3858e
Compare
49875b4 to
16f8538
Compare
5096d8c to
fc93036
Compare
…vice Why: Each linked account needs one long-lived WhatsApp socket, owned by exactly one process at a time, that pairs devices, keeps group rosters fresh, ingests adopted-group traffic durably and dispatches the sends DSS records. DSS talks to it only through MacroDB rows and `NOTIFY`; there is no service-to-service HTTP. How it works: ``` supervisor ── pg_try_advisory_lock(account) ──▶ account task (begin_lease → epoch+1) ▲ LISTEN whatsapp_* │ whatsmeow client + PgWhatsAppStore │ ▼ DSS NOTIFY (pairing/send/groups/changed) SessionService (whatsapp_linked, in-process) ``` A stale epoch fails every write with `Fenced` and stops the account. On SIGTERM a replica drains accounts in batches and announces releases. What: - `services/whatsapp_session_service`: supervisor, per-account runner, durable inbound (persisted before ACK, unadopted groups dropped), media import/upload, lock connection health, `GET /health`. Config through `MacroConfig`/Doppler only. - `infra/stacks/whatsapp-session-service` (ECS service and the KMS key for the store), the Doppler project entry, and Datadog monitors. - `.github/services-config.json` registers it with `deploy_enabled: false` and a `bootstrap_pending` note: it needs its Doppler project and keys (including `WHATSAPP_SESSION_KMS_KEY_ID` from the stack's first deploy) and an explicit go-ahead before anything deploys it. - Local stack: compose service, `xtask_local` inventory, env placeholders and LocalStack KMS; nix deploy list; generic deploy workflow choice. - SQLx cache entries; regenerated `workspace-hack` and closures. Follow-ups: - Create the Doppler project/keys and run the first stack deploy, then flip `deploy_enabled` (needs explicit approval). Audit fixes: Audit security fixes in this layer: session-service logs and whatsmeow errors never carry JIDs.
16f8538 to
71c9f41
Compare
Why
Each linked account needs one long-lived WhatsApp socket, owned by exactly
one process at a time, that pairs devices, keeps group rosters fresh,
ingests adopted-group traffic durably and dispatches the sends DSS
records. DSS talks to it only through MacroDB rows and
NOTIFY; there isno service-to-service HTTP.
How it works
A stale epoch fails every write with
Fencedand stops the account. OnSIGTERM a replica drains accounts in batches and announces releases.
What
services/whatsapp_session_service: supervisor, per-account runner,durable inbound (persisted before ACK, unadopted groups dropped), media
import/upload, lock connection health,
GET /health. Config throughMacroConfig/Doppler only.infra/stacks/whatsapp-session-service(ECS service and the KMS key forthe store), the Doppler project entry, and Datadog monitors.
.github/services-config.jsonregisters it withdeploy_enabled: falseand a
bootstrap_pendingnote: it needs its Doppler project and keys(including
WHATSAPP_SESSION_KMS_KEY_IDfrom the stack's first deploy)and an explicit go-ahead before anything deploys it.
xtask_localinventory, env placeholdersand LocalStack KMS; nix deploy list; generic deploy workflow choice.
workspace-hackand closures.Follow-ups
deploy_enabled(needs explicit approval).Audit fixes
Audit security fixes in this layer: session-service logs and whatsmeow errors never carry JIDs.
Stack
WhatsApp linked devices, one layer per PR. Merge bottom-up; each PR is based on the one below it, so its diff is only its own layer. Layers 1-9 are
wolf/whatsmeow-rsas of the split; layers 10-16 are the later work on that branch, regrouped by topic. The audit fixes are folded into the layers that own the code they fix. The schema is three migrations in its final shape: layer 4's20261027061310_whatsapp_linkedand20261027061311_validate_entity_whatsapp_group_type, and layer 5's20261027062649_whatsapp_store; no later layer adds a migration.Previous: #8537 · Next: #8539