惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
博客园_首页
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
The Cloudflare Blog
V
Visual Studio Blog
罗磊的独立博客
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
D
Docker
Last Week in AI
Last Week in AI
B
Blog RSS Feed
C
Check Point Blog
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
有赞技术团队
有赞技术团队
博客园 - 聂微东
MongoDB | Blog
MongoDB | Blog
雷峰网
雷峰网

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(whatsapp): preserve auth on terminal disconnects (#93...
mcaxtr · 2026-06-16 · via Recent Commits to openclaw:main

@@ -35,7 +35,7 @@ import {

3535

resolveReconnectPolicy,

3636

sleepWithAbort,

3737

} from "../reconnect.js";

38-

import { formatError, getWebAuthAgeMs, logoutWeb, readWebSelfId } from "../session.js";

38+

import { formatError, getWebAuthAgeMs, readWebSelfId } from "../session.js";

3939

import { resolveWhatsAppSocketTiming } from "../socket-timing.js";

4040

import { getRuntimeConfig, getRuntimeConfigSourceSnapshot } from "./config.runtime.js";

4141

import { whatsappHeartbeatLog, whatsappLog } from "./loggers.js";

@@ -142,43 +142,6 @@ function isRetryableAuthUnstableError(error: unknown): error is WhatsAppAuthUnst

142142

);

143143

}

144144145-

async function clearTerminalWebAuthState(params: {

146-

account: ReturnType<typeof resolveWhatsAppAccount>;

147-

runtime: RuntimeEnv;

148-

statusLabel: number | "unknown";

149-

healthState: "logged-out" | "conflict";

150-

log: ReturnType<typeof getChildLogger>;

151-

}) {

152-

try {

153-

const cleared = await logoutWeb({

154-

authDir: params.account.authDir,

155-

isLegacyAuthDir: params.account.isLegacyAuthDir,

156-

runtime: params.runtime,

157-

});

158-

params.log.warn(

159-

{

160-

accountId: params.account.accountId,

161-

cleared,

162-

healthState: params.healthState,

163-

status: params.statusLabel,

164-

},

165-

"web reconnect: cleared cached auth after terminal close",

166-

);

167-

} catch (error) {

168-

params.log.warn(

169-

{

170-

accountId: params.account.accountId,

171-

error: formatError(error),

172-

healthState: params.healthState,

173-

status: params.statusLabel,

174-

},

175-

"web reconnect: failed clearing cached auth after terminal close",

176-

);

177-

params.runtime.error(

178-

`WhatsApp Web cleanup failed after terminal close (status ${params.statusLabel}). Run \`${formatCliCommand("openclaw channels logout --channel whatsapp")}\`, then relink with \`${formatCliCommand("openclaw channels login --channel whatsapp")}\`.`,

179-

);

180-

}

181-

}

182145

const DEFAULT_TRANSPORT_TIMEOUT_MS = 5 * 60 * 1000;

183146184147

export async function monitorWebChannel(

@@ -431,26 +394,12 @@ export async function monitorWebChannel(

431394

"web reconnect: setup status error; max attempts reached",

432395

);

433396

if (setupDecision.healthState === "logged-out") {

434-

await clearTerminalWebAuthState({

435-

account,

436-

runtime,

437-

statusLabel: setupDecision.normalized.statusLabel,

438-

healthState: setupDecision.healthState,

439-

log: reconnectLogger,

440-

});

441397

runtime.error(

442398

`WhatsApp session logged out during setup. Run \`${formatCliCommand("openclaw channels login --channel whatsapp")}\` to relink.`,

443399

);

444400

} else if (setupDecision.healthState === "conflict") {

445-

await clearTerminalWebAuthState({

446-

account,

447-

runtime,

448-

statusLabel: setupDecision.normalized.statusLabel,

449-

healthState: setupDecision.healthState,

450-

log: reconnectLogger,

451-

});

452401

runtime.error(

453-

`WhatsApp Web connection closed during setup (status ${setupDecision.normalized.statusLabel}: session conflict). Resolve conflicting WhatsApp Web sessions, then relink with \`${formatCliCommand("openclaw channels login --channel whatsapp")}\`. Stopping web monitoring.`,

402+

`WhatsApp Web connection closed during setup (status ${setupDecision.normalized.statusLabel}: session conflict). Resolve conflicting WhatsApp Web sessions, then restart the channel. To force a fresh QR, run \`${formatCliCommand("openclaw channels logout --channel whatsapp")}\` before \`${formatCliCommand("openclaw channels login --channel whatsapp")}\`. Stopping web monitoring.`,

454403

);

455404

} else {

456405

runtime.error(

@@ -668,24 +617,10 @@ export async function monitorWebChannel(

668617

});

669618670619

if (decision.healthState === "logged-out") {

671-

await clearTerminalWebAuthState({

672-

account,

673-

runtime,

674-

statusLabel: decision.normalized.statusLabel,

675-

healthState: decision.healthState,

676-

log: reconnectLogger,

677-

});

678620

runtime.error(

679621

`WhatsApp session logged out. Run \`${formatCliCommand("openclaw channels login --channel whatsapp")}\` to relink.`,

680622

);

681623

} else if (decision.healthState === "conflict") {

682-

await clearTerminalWebAuthState({

683-

account,

684-

runtime,

685-

statusLabel: decision.normalized.statusLabel,

686-

healthState: decision.healthState,

687-

log: reconnectLogger,

688-

});

689624

reconnectLogger.warn(

690625

{

691626

connectionId: connection.connectionId,

@@ -695,7 +630,7 @@ export async function monitorWebChannel(

695630

"web reconnect: non-retryable close status; stopping monitor",

696631

);

697632

runtime.error(

698-

`WhatsApp Web connection closed (status ${decision.normalized.statusLabel}: session conflict). Resolve conflicting WhatsApp Web sessions, then relink with \`${formatCliCommand("openclaw channels login --channel whatsapp")}\`. Stopping web monitoring.`,

633+

`WhatsApp Web connection closed (status ${decision.normalized.statusLabel}: session conflict). Resolve conflicting WhatsApp Web sessions, then restart the channel. To force a fresh QR, run \`${formatCliCommand("openclaw channels logout --channel whatsapp")}\` before \`${formatCliCommand("openclaw channels login --channel whatsapp")}\`. Stopping web monitoring.`,

699634

);

700635

} else {

701636

reconnectLogger.warn(