fix(whatsapp): prevent service restart hammering on auth failure#746
Closed
glifocat wants to merge 1 commit into
Closed
fix(whatsapp): prevent service restart hammering on auth failure#746glifocat wants to merge 1 commit into
glifocat wants to merge 1 commit into
Conversation
klapom
added a commit
to klapom/nanoclaw
that referenced
this pull request
Mar 5, 2026
…res) Bug fixes applied: - nanocoai#636: task-scheduler recalculates next_run before enqueue - nanocoai#655: LIMIT 200 on message queries to prevent OOM - nanocoai#670: rateLimitResetAt field in ContainerOutput interface - nanocoai#694: ANTHROPIC_MODEL passthrough to container env - nanocoai#700: session rotation at 5MB JSONL threshold - nanocoai#701: session retry on corrupted resume (clear + retry) - nanocoai#708: update_task MCP tool in ipc-mcp-stdio - nanocoai#719: outputChain .catch() to prevent group hang - nanocoai#729: fix send_message description (remove incorrect scheduled-task note) - nanocoai#735: datePrefix() injects current date/time into all agent prompts - nanocoai#738: ANTHROPIC_MODEL from .env passed to agent container - nanocoai#746: systemd OnFailure restart prevention logic (container hardening) - nanocoai#751: DM-with-bot JID normalization - nanocoai#754: setOnPipeCallback to reset idle timer on piped messages - nanocoai#756: cursorBeforePipe rollback on container crash Features added: - nanocoai#723: streaming infrastructure (STREAM_TEXT markers, onStreamDelta) - nanocoai#742: container hardening (entrypoint.sh privilege drop, env sanitize) - nanocoai#680: add-cli skill (CLI send binary) - nanocoai#727: add-memory skill extracted to .claude/skills/add-memory/ - nanocoai#744: add-s3-storage skill extracted to .claude/skills/add-s3-storage/ Test fixes: - Mock fs.promises in container-runner.test.ts to prevent real I/O - Add ANTHROPIC_MODEL to config mock - Fix cpSync expectation: { recursive: true, force: true } - Fix isActive() to use state.active instead of state.process - Fix container-runtime error message: Docker → Container runtime Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 6, 2026
aa46f21 to
f74f53f
Compare
Two separate issues caused repeated WhatsApp connections after a failed or revoked auth session: 1. The systemd unit used Restart=always, which restarts the service even on a clean exit(0). Since the 401/logged-out path calls process.exit(0), systemd would immediately restart and retry — repeating indefinitely. Fix: Restart=on-failure (only restart on crashes), RestartSec=10, StartLimitBurst=5 per 5 minutes. Same fix for launchd: KeepAlive with SuccessfulExit=false. 2. Inline reconnection logic had no backoff — it retried immediately then after a flat 5s, then gave up and crashed, which triggered systemd restart. Fix: exponential backoff starting at 5s, doubling each attempt, capped at 5 minutes. Changes are in skill assets (add/ and modify/) so they apply correctly when the skill is installed on a fresh project. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f74f53f to
66b0a7e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #748
Type of Change
.claude/skills/Description
Two issues caused repeated WhatsApp connection attempts after a failed or revoked auth session, risking soft-blocks from WhatsApp:
systemd
Restart=alwaysrestarts the service even on cleanexit(0). The 401/logged-out path usesprocess.exit(0), so systemd restarts every 5s indefinitely. Same issue on macOS withKeepAlive=true.No reconnection backoff — transient failure retried immediately then after flat 5s, then crashed, triggering another systemd restart cycle.
Fix:
Restart=on-failure+ rate limiting for systemd;KeepAlive SuccessfulExit=falsefor launchd; exponential backoff (5s→10s→20s…→5min) for inline reconnection. All changes are in skill assets (add/andmodify/), no applied files committed.For Skills