polygram 0.38.2 → 0.38.3

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.
@@ -315,13 +315,14 @@ function createDispatcher({
315
315
  logEvent('handler-error', {
316
316
  chat_id: chatId, session_key: sessionKey,
317
317
  msg_id: msg?.message_id,
318
- error: err.message?.slice(0, 500),
318
+ error_class: err.name || 'Error',
319
+ error_len: err.message?.length ?? 0,
319
320
  code: err.code || undefined,
320
321
  cause_code: err.cause?.code || undefined,
321
- stderr_tail: err.code === 'TMUX_SPAWN_FAILED' && typeof err.stderr === 'string'
322
- ? err.stderr.replace(/[\x00-\x08\x0b-\x1f\x7f]/g, '').slice(-500)
323
- : undefined,
324
- stack: err.stack?.split('\n').slice(0, 5).join('\n'),
322
+ // A spawn failure's stderr is process output, not a field: its size
323
+ // says whether the child said anything at all, which is the signal
324
+ // that distinguishes "tmux refused" from "tmux said nothing".
325
+ stderr_len: typeof err.stderr === 'string' ? err.stderr.length : undefined,
325
326
  aborted: wasAborted || undefined,
326
327
  replay: isReplay || undefined,
327
328
  oom_shutdown: oomShutdown || undefined,
@@ -342,7 +343,7 @@ function createDispatcher({
342
343
  logger.error?.(`[${sessionKey}] failed to clear lost session: ${resetErr.message}`);
343
344
  logEvent('session-reset-after-process-loss-failed', {
344
345
  chat_id: chatId, session_key: sessionKey, msg_id: msg?.message_id,
345
- error: resetErr.message?.slice(0, 200),
346
+ error_class: resetErr.name || 'Error',
346
347
  });
347
348
  }
348
349
  }
@@ -378,7 +379,8 @@ function createDispatcher({
378
379
  logger.error?.(`[auth] (${botName}) Claude access DISABLED by Anthropic — turn rejected immediately instead of wedging; check the account/billing.`);
379
380
  logEvent('auth-disabled', {
380
381
  chat_id: chatId, session_key: sessionKey, msg_id: msg?.message_id,
381
- error: err.message?.slice(0, 500),
382
+ error_class: err.name || 'Error',
383
+ error_len: err.message?.length ?? 0,
382
384
  });
383
385
  // Never let the gate itself become a new failure mode — AUTH_DISABLED
384
386
  // is account-wide, so a bad gate would throw on every concurrent
@@ -496,7 +498,7 @@ function createDispatcher({
496
498
  autoResumeTracker.markAttempt(sessionKey);
497
499
  logEvent('auto-resume-attempted', {
498
500
  chat_id: chatId, session_key: sessionKey, msg_id: msg.message_id,
499
- original_error: err.message?.slice(0, 200),
501
+ error_class: err.name || 'Error',
500
502
  });
501
503
  return attemptAutoResume(sessionKey, chatId, msg, bot, {
502
504
  provider,
@@ -512,7 +514,7 @@ function createDispatcher({
512
514
  logger.error?.(`[${sessionKey}] auto-resume failed: ${resumeErr?.message}`);
513
515
  logEvent('auto-resume-failed', {
514
516
  chat_id: chatId, session_key: sessionKey, msg_id: msg.message_id,
515
- error: resumeErr?.message?.slice(0, 200),
517
+ error_class: resumeErr?.name || 'Error',
516
518
  });
517
519
  // Music topic incident (2026-06-01): a channels session whose
518
520
  // context grew large enough to auto-/compact on resume loses its