@bobfrankston/rmfmail 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3392,12 +3392,27 @@ export class ImapManager extends EventEmitter {
3392
3392
  madeProgress = true;
3393
3393
  }
3394
3394
  } catch (e: any) {
3395
- console.error(` [prefetch] ${accountId}/${uid}: store write failed: ${e.message}`);
3396
- // putMessage / extractPreview failure (e.g. a
3397
- // corrupt body an IMAP command leaked into the
3398
- // FETCH response). Genuine poison: back off
3399
- // 5m→30m→2h→12h so it isn't re-fetched on a loop
3400
- // (Bob 2026-05-28, UID 59686).
3395
+ const emsg = String(e?.message || e);
3396
+ // "IMAP command leaked into response stream" /
3397
+ // "corrupt body" means the byte-buffer parser lost
3398
+ // sync a partial/flaky read shifted a literal
3399
+ // boundary so this FETCH body captured a later
3400
+ // command's bytes. The MESSAGE is probably fine; the
3401
+ // CONNECTION is poisoned (every subsequent read on
3402
+ // it is now garbage). Re-throw so withConnection
3403
+ // discards this client and the next chunk reconnects
3404
+ // clean — instead of marking a good message as poison
3405
+ // and limping on a dead socket until the 300s timeout,
3406
+ // which left bobma INBOX stuck and "no new mail"
3407
+ // (Bob 2026-06-15). Do NOT back the UID off; it
3408
+ // retries next tick on a clean connection.
3409
+ if (/command leaked|corrupt body|desync/i.test(emsg)) {
3410
+ console.error(` [prefetch] ${accountId}/${uid}: connection desync — discarding socket to resync: ${emsg.slice(0, 90)}`);
3411
+ throw new Error(`imap-desync: ${emsg.slice(0, 80)}`);
3412
+ }
3413
+ console.error(` [prefetch] ${accountId}/${uid}: store write failed: ${emsg}`);
3414
+ // Genuine poison body (not a desync): back off
3415
+ // 5m→30m→2h→12h so it isn't re-fetched on a loop.
3401
3416
  this.markPrefetchEmpty(accountId, folderId, uid);
3402
3417
  }
3403
3418
  })());
@@ -3438,9 +3453,9 @@ export class ImapManager extends EventEmitter {
3438
3453
  // (markPrefetchEmpty is per-message poison only) —
3439
3454
  // they retry next tick. Genuine per-body errors are
3440
3455
  // handled per-UID above and never reach here.
3441
- const dead = /not connected|ETIMEDOUT|ECONNRESET|ECONNREFUSED|EPIPE|socket|connection (closed|reset|lost)|disconnect/i.test(msg);
3456
+ const dead = /not connected|ETIMEDOUT|ECONNRESET|ECONNREFUSED|EPIPE|socket|connection (closed|reset|lost)|disconnect|imap-desync/i.test(msg);
3442
3457
  if (dead) {
3443
- console.log(` [prefetch] ${accountId}/${folder.path}: connection down — deferring rest to next tick`);
3458
+ console.log(` [prefetch] ${accountId}/${folder.path}: connection down/desync — deferring rest to next tick (fresh socket)`);
3444
3459
  break;
3445
3460
  }
3446
3461
  if (counters.errors >= ERROR_BUDGET) break;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.95",
3
+ "version": "0.1.96",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bobfrankston/mailx-imap",
9
- "version": "0.1.95",
9
+ "version": "0.1.96",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@bobfrankston/iflow-direct": "^0.1.27",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.95",
3
+ "version": "0.1.96",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-store",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",