Repository navigation
fix: preserve WhatsApp sessions across 408/515 reconnects and stale WA version - #55
Conversation
Verification report — current head
|
| Required check | Actual result / evidence |
|---|---|
1. Clean npm ci + patch-package --error-on-fail |
NOT RUN. This chat's shell cannot clone the repo or reach npm: git ls-remote https://github.com/Neup123/evolution-api.git HEAD → Could not resolve host: github.com; curl https://registry.npmjs.org/... → Could not resolve host: registry.npmjs.org. No baileys@7.0.0-rc14 success line can honestly be supplied. Patch file audit below is not application evidence. |
2. npm run build |
NOT RUN; no installed dependencies or checkout. No green claim. |
| 3. PR CI | NO CHECKS REPORTED for this head: GitHub Actions commit workflow runs [], combined status contexts [], GitHub check-runs API {"total_count":0,"check_runs":[]}. The repository contains a pull_request code-quality workflow, but none has reported on this head. This is not a pass. |
4. Compiled dist/patched node_modules greps |
NOT RUN; there is no built dist nor installed package in this shell. Static source/patch markers found: 408 registration guard, full-jitter Math.random() * ceilingMs, withSendTimeout, 515 30s timestamp, remove.instance, version readVersionCache/writeVersionCache, and unchanged #53 companion_reg_refresh. These are not compiled-output checks. |
5a. npm run test:connection-recovery |
NOT RUN (dependencies unavailable); four regression cases added for registered/unregistered 408 and recent/expired 515→401. After review, the existing connection-recovery and socket-watchdog fixtures were also corrected to mark their simulated healthy sockets as registered; otherwise their 408 probes would incorrectly take the new unregistered terminal path. Not a test pass. |
5b. npx tsx test/socket-watchdog.test.ts |
NOT RUN (dependencies unavailable). No package.json script for this existing suite. |
5c. npx tsx test/disconnection-fields.test.ts |
NOT RUN (dependencies unavailable). No package.json script for this existing suite. |
Static patch/source audit output
{
"basePatchPrefixPreserved": true,
"patchNewFeatures": {"monotonic": true, "diskCache": true, "QR": true},
"source": {
"registered408": true, "jitter": true, "immediate515": true,
"sendTimeout": true, "sendWrappers": true, "last515": true,
"oldSocketEnded": true, "zombieEmit": true
},
"patchHunks": 14,
"invalidHunkCounts": 0,
"genericsJSHunksMatchChaeulsoPreFixBaseline": [true, true],
"genericsDTSHunkMatchesChaeulsoPreFixBaseline": [true]
}The patch preimage comparisons above are to the publicly available chaeulso pre-evolution-foundation#2777 baseline, not an actual node_modules/baileys@7.0.0-rc14 installation. An operator must confirm npm ci applies this exact consolidated patch in the real pinned npm package. A failed apply is blocking, with postinstall still configured --error-on-fail.
Provenance/deviations: (1) FAFAzin/VENDORA per Evolution evolution-foundation#2501 discussion — copied no blanket-408 or logout-reliability code; (2) Evolution evolution-foundation#2509 30s guard; (3) Evolution evolution-foundation#2520 zombie cleanup only (upstream merged but absent in fork); (4) chaeulso evolution-foundation#2777 monotonic cached resolver. evolution-foundation#2784 intentionally omitted because it changes unrelated init-query and pre-key retry machinery and cannot be included as isolated low-risk hunks without execution verification. FAFAzin's two specifically named public doc paths were unavailable at their default-branch locations. The existing QR patch bytes remain the prefix of the consolidated patch.
See docs/build-plan-connection-stability.md for commands and removal conditions. Blocking before merge: run clean install, build, all three suites and compiled greps with captured output, and verify actual CI status.
Verification round 1 follow-up — jitter-aware recovery test fixCoordinator round 1 on previous head One failing test in round 1: Fix pushed in commit
Current verification status
Keep PR draft / do not merge or deploy as part of this task. |
Verification round 2 follow-up — missing class-field initialization in test harnessNew head: Coordinator round 2 on previous head
Root cause: the test uses Fix (one test-only line): set Current status: This fix directly corrects the test-harness cause, including the 30-second boundary used by |
Coordinator verification — connection-stability bundle (PR #55, head
|
Summary (refs #54)
Base:
mainatf1ccc8f3a0aabf62b4540dfc4cd87812d03a5d94(includes merged PR #53). Baileys remains pinned7.0.0-rc14. No release, merge, or deployment.creds.registered !== true; registered 408 reconnects. Existing retry machinery now uses 0..min(60s, 1s·2^n) full jitter, 515 immediate, reset on open. Previous socket listeners are removed and old socket ended/closed before a newmakeWASocket. Direct send/relay paths and dynamic relay invoke are bounded bywithSendTimeout(60s default,EVOLUTION_SEND_TIMEOUT_MSoverride).CB:stream:error515; a trailing 401 within 30s reconnects rather than triggering logout/credential cleanup. An old or independent 401 remains terminal.deleteInstance()and continue toremove.instanceso cleanup is not stranded.develop, absent from this fork).patches/baileys+7.0.0-rc14.patchwith isolated evolution-foundation#2777 version-resolver hunks and typedlib/Utils/wa-versionfiles; route socket creation through its resolver. Persist last-known-good version atinstances/wa-web-version.jsonon the deployed volume (overrideEVOLUTION_WA_VERSION_CACHE_PATH). Failing/stale fetches cannot downgrade. The original #53companion_reg_refresh, evolution-foundation#2602 and evolution-foundation#2749-line hunks are preserved unchanged.Intentional exclusions
VENDORA-PATCHES.mdanddocs/brain/reconnect-freeze.mdpaths were not accessible on the public default branch; upstream fix: logout instance evolution-foundation/evolution-api#2501 discussion and chaeulso's published implementation were available.Verification status — DO NOT MERGE until runner checks complete
test/connection-recovery.test.ts. These are static, not execution passes.npm ci/patch-package --error-on-fail: NOT RUN in this environment (shell has no GitHub/npm registry DNS access). Must showbaileys@7.0.0-rc14success in an enabled runner.npm run build: NOT RUN locally for the same reason. Await actual CI job status; do not infer success.distor installednode_modulesavailable. Source and patch scans are not equivalent.npm run test:connection-recovery,npx tsx test/socket-watchdog.test.ts,npx tsx test/disconnection-fields.test.ts— NOT RUN locally; ensure all three execute in a dependency-equipped environment. Socket-watchdog/disconnection tests currently have no dedicated npm scripts.See build plan for exact commands, incident rationale, upstream removal criteria and deployment-volume behavior. Keep this PR draft, do not merge or deploy.