Repository navigation
fix(whatsapp): stabilize auth state and reconcile local runtime after CLI login - #67815
Conversation
🔒 Aisle Security AnalysisWe found 2 potential security issue(s) in this PR:
1. 🟠 Insecure temporary file creation in WhatsApp creds persistence allows symlink clobbering
Description
Vulnerable code: const tempPath = path.join(authDir, `.creds.${process.pid}.${randomUUID()}.tmp`);
handle = await fs.open(tempPath, "w", CREDS_FILE_MODE);RecommendationCreate the temp file with exclusive flags and (where supported) no-follow semantics, and ensure Use import fs from "node:fs/promises";
import { constants as FS } from "node:fs";
const fd = await fs.open(tempPath, FS.O_WRONLY | FS.O_CREAT | FS.O_EXCL | (FS.O_NOFOLLOW ?? 0), CREDS_FILE_MODE);
// or: await fs.open(tempPath, "wx", CREDS_FILE_MODE) // (no O_NOFOLLOW)Additionally:
2. 🟠 Local privilege escalation: backend client can preserve self-declared operator scopes without device identity
DescriptionThe WebSocket handshake now includes an exception that prevents clearing self-declared scopes when the client is identified as the backend This creates an authorization/pairing bypass:
Vulnerable logic: if (
!device &&
!skipLocalBackendSelfPairing &&
shouldClearUnboundScopesForMissingDeviceIdentity(...)
) {
clearUnboundScopes();
}Combined with: return (
params.locality === "direct_local" &&
!params.hasBrowserOriginHeader &&
((params.sharedAuthOk && usesSharedSecretAuth) || usesDeviceTokenAuth)
);This exception relies on self-declared client identity ( RecommendationRemove or harden the exception so unbound scopes cannot be preserved based on user-declared client metadata. Options (prefer 1):
if (!device && shouldClearUnboundScopesForMissingDeviceIdentity(...)) {
clearUnboundScopes();
}
Also consider logging/auditing when a client requests privileged scopes without device identity. Analyzed PR: #67815 at commit Last updated on: 2026-04-19T14:37:21Z |
Greptile SummaryThis PR hardens WhatsApp auth persistence by introducing a dedicated Confidence Score: 5/5Safe to merge — previous reviewer concerns are resolved and the two remaining findings are both P2 style suggestions. All findings are P2 or lower: a fragile string-vs-rawState color check in channel-summary.ts and a no-op intermediate variable in channel.ts. Neither affects correctness or user-visible behavior today. The core auth-barrier and atomic-write hardening is sound, test coverage is explicitly listed, and the single-barrier contract in createWaSocket is clean. src/infra/channel-summary.ts (color mapping uses formatted string; should check raw statusState), extensions/whatsapp/src/channel.ts (redundant statusState variable) Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/infra/channel-summary.ts
Line: 229-230
Comment:
**Color mapping is coupled to the formatted string**
The check `status === "auth stabilizing"` compares the already-formatted display string returned by `formatChannelStatusState("unstable")`. If that function's output is ever adjusted, the error-color mapping silently falls through to `theme.muted` with no compile-time or test-time warning.
The raw `statusState` variable is already in scope at this point and is the safer thing to check:
```suggestion
: (statusState === "unstable" || status === "not linked")
? theme.error
: theme.muted;
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: extensions/whatsapp/src/channel.ts
Line: 210
Comment:
**Redundant intermediate variable**
`summaryAuthState === undefined ? undefined : summaryAuthState` is always equal to `summaryAuthState` itself, so this line adds noise without changing behavior. You can drop it and use `summaryAuthState` directly wherever `statusState` appears below (or keep the name and simplify the assignment).
```suggestion
const statusState = summaryAuthState;
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (2): Last reviewed commit: "WhatsApp: cap unstable auth retries" | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8eccc9418b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
8eccc94 to
5a9ab7d
Compare
|
Rebased this branch onto current What was fixed:
What was not fixed:
Verification run locally after the fixes:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a9ab7d64e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 189ec86935
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 177c8069f1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0089558d91
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
0089558 to
6a81a5f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a81a5fa62
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d8487bff3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb1fcd0375
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6c740c186
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
… CLI login (openclaw#67815) * WhatsApp: harden auth persistence and backup recovery * WhatsApp: model unstable auth state across runtime and setup * WhatsApp: recover login and monitor startup from unstable auth * Channels: surface auth stabilizing in status and health * Gateway protocol: add channels.start surface * Gateway: reconcile local channel runtime after CLI login * Channels UI: reflect recovered login start state * Changelog: note WhatsApp auth stabilization * Gateway: fix lint in call test
… CLI login (openclaw#67815) * WhatsApp: harden auth persistence and backup recovery * WhatsApp: model unstable auth state across runtime and setup * WhatsApp: recover login and monitor startup from unstable auth * Channels: surface auth stabilizing in status and health * Gateway protocol: add channels.start surface * Gateway: reconcile local channel runtime after CLI login * Channels UI: reflect recovered login start state * Changelog: note WhatsApp auth stabilization * Gateway: fix lint in call test
… CLI login (openclaw#67815) * WhatsApp: harden auth persistence and backup recovery * WhatsApp: model unstable auth state across runtime and setup * WhatsApp: recover login and monitor startup from unstable auth * Channels: surface auth stabilizing in status and health * Gateway protocol: add channels.start surface * Gateway: reconcile local channel runtime after CLI login * Channels UI: reflect recovered login start state * Changelog: note WhatsApp auth stabilization * Gateway: fix lint in call test
… CLI login (openclaw#67815) * WhatsApp: harden auth persistence and backup recovery * WhatsApp: model unstable auth state across runtime and setup * WhatsApp: recover login and monitor startup from unstable auth * Channels: surface auth stabilizing in status and health * Gateway protocol: add channels.start surface * Gateway: reconcile local channel runtime after CLI login * Channels UI: reflect recovered login start state * Changelog: note WhatsApp auth stabilization * Gateway: fix lint in call test
… CLI login (openclaw#67815) * WhatsApp: harden auth persistence and backup recovery * WhatsApp: model unstable auth state across runtime and setup * WhatsApp: recover login and monitor startup from unstable auth * Channels: surface auth stabilizing in status and health * Gateway protocol: add channels.start surface * Gateway: reconcile local channel runtime after CLI login * Channels UI: reflect recovered login start state * Changelog: note WhatsApp auth stabilization * Gateway: fix lint in call test
… CLI login (openclaw#67815) * WhatsApp: harden auth persistence and backup recovery * WhatsApp: model unstable auth state across runtime and setup * WhatsApp: recover login and monitor startup from unstable auth * Channels: surface auth stabilizing in status and health * Gateway protocol: add channels.start surface * Gateway: reconcile local channel runtime after CLI login * Channels UI: reflect recovered login start state * Changelog: note WhatsApp auth stabilization * Gateway: fix lint in call test
… CLI login (openclaw#67815) * WhatsApp: harden auth persistence and backup recovery * WhatsApp: model unstable auth state across runtime and setup * WhatsApp: recover login and monitor startup from unstable auth * Channels: surface auth stabilizing in status and health * Gateway protocol: add channels.start surface * Gateway: reconcile local channel runtime after CLI login * Channels UI: reflect recovered login start state * Changelog: note WhatsApp auth stabilization * Gateway: fix lint in call test
Remove a test-only config cache-reset wrapper, duplicate internal selection and channel-support checks, an unused session-file metadata fallback, and duplicate usage target shapes. Carry transcript delivery facts from their first parsing pass. Keep all network validation, effect authority, transcript durability, current update policy and standalone session memory machinery. Best-effort tradeoffs accepted: - Internal agent updates trust the selection-shape check at their sole production caller, agents.update. The duplicate originated in the Models agent-selection feature #150224; the same boundary check still rejects invalid user input. Live runtime choice validation stays at the effect. - Channel start support is checked once at the synchronous request boundary. The inner check from #67815 / #167159 cannot observe a different plugin without unsupported synchronous mutation; the boundary guard remains. - Workspace-root readers require caller-prepared metadata: both production consumers already provide it. The unused fallback from #161747 is deleted, not the Phase E backend or any factory. A future invalid internal caller gets a clear error instead of starting another metadata read. - Update handlers trust the required getRuntimeConfig contract instead of falling back to a global schedule for an invalid context. Keep #158301's real scheduler-policy incident fix and its post-await current-config read. - Usage summaries trust the canonical required target identity from #169660; the first-instance fallback served no production caller. The integration fixture now supplies that identity with all original assertions retained. No public schema/config/SDK/protocol or persisted shape changes. The config tests call the same canonical invalidators directly; no coverage is removed. Follow-up removes 54 net production lines; branch total removes 154. Targeted types (including MCP consumers), retained-file type-aware lint, formatting, zero runtime import cycles, suppression audit and independent P2 review pass. Gateway behavioral suites remain incomplete after a loaded-host startup run was stopped at about ten minutes (exit 143). The prior full static-graph gap remains pending for the coordinator bundle; no new production edge is added.
…-5 bundle A) (#172989) * refactor(ui): remove unused page plumbing and duplicate presentation work Fold sole-caller Config and Cron adapters into their existing owners, reuse canonical controller types, and remove unused request arguments and login selection options. Adopt the complete background mutation receipt instead of rereading the write; keep authoritative preflight and live ownership checks. Best-effort tradeoffs accepted: a later background edit in another browser is reflected by normal preference events or refresh, not an unconditional read of our own successful write. The introducing feature PR #168301 does not identify a human incident requiring that reread. Settled rendering and public contracts are unchanged; both shipping renderer paths remain intact. * refactor(ui): consolidate presentation helpers and cached preview inputs Share point-menu trigger attributes and deletion-first LCS traversal. Remove an obsolete empty-badge predicate, a one-caller loading facade, and redundant whole-map translation fallback. Preserve both active Lit and Solid paths, positioning formulas, diff work budgets, visible text, and rendering. Best-effort tradeoffs accepted: - Trust successful synchronous Web Storage writes instead of reading them back. Introducing PR #162428 supplied synthetic storage failures, not a human incident where successful setItem silently failed. Nonconforming Storage replacements may miss a cache publication until the next refresh. - Trust immutable message/tool-card identities for cached source previews. PR #148431's in-place mutation assertions were synthetic; production owners publish replacement snapshots. Unsupported in-place mutation may leave a decoration stale until replacement. Run/frame/origin and external source validation remain unchanged. Net production reduction: 76 lines; tests: 20 lines removed, only synthetic same-object mutation assertions. Kept config coercion tied to human Safari report #13348, along with security, durability, ordinary navigation ownership, and all active migration paths. Focused proof: 73 boot/cache/diff tests, 82 menu tests, 46 badge/assistant tests, 20 i18n tests, 8 browser details tests, 3 lint-suppression tests; UI typecheck, formatting, stylesheet lint and CSS declaration parity passed. Known inherited local check failure: environment-variable count is 455 against budget 454, independently reproduced against clean HEAD/index. Its counted source roots exclude UI. No budget or unrelated source changes made. * refactor(ui): remove obsolete presentation compatibility and styling Use the native Popover capability required by the Control UI bootstrap instead of retaining old-engine in-flow fallbacks. Keep native overlay occlusion and all real connection/navigation ownership. Remove retired sidebar style hooks and share identical question-panel declarations. Supported browsers render identically; no user-visible copy, feature, renderer selection, config, protocol, or storage change. Best-effort tradeoffs accepted - Old engines without Popover support, or invalid direct popover mounts, no longer receive an in-flow menu fallback. The fallback came from #105598 as generic compatibility, not a human incident; #168595 made native Popover support a required bootstrap capability. Invalid direct mounts now fail clearly rather than silently changing layering. Deeper coverage and retained candidates are recorded in the requested task-local y03 ledger for coordinator bundling. Branch total: 123 net production LOC removed (+114/-237), excluding tests, fixtures, generated files and declarations. Below the 500-line campaign floor after the deeper components/app/lib/styles and lead-owned owner pass; push branch-only for bundling. * refactor(gateway): reuse server method owners Consolidate duplicate catalog response handling, optional catalog reads, pairing resolution, requester assertions and system agent transcript persistence. Carry prepared pairing and actor facts instead of probing or re-reading them. Remove redundant cache-generation and internal receipt checks; retain security, durability, pagination and resource bounds. Best-effort tradeoffs accepted: - Pairing captures its selected adapter once. Repeated internal checks added by #112401 guarded hypothetical in-place plugin mutation, not a reported incident. Such a mutation now leaves this request on its selected adapter; later requests discover the current registration. - Channel identity RPCs trust the canonical mutation result instead of repeating the action/kind assertion introduced in #161284. No human incident justified the redundant adapter assertion; live mutation authority remains with the state owner. No user-facing feature, protocol/config/persistence shape, schema, dependency, test coverage or standalone session memory backend changes. Net production reduction: 100 lines (179 added / 279 deleted). Type-aware lint, targeted production types, formatting, runtime cycles (zero), SDK surface, suppression audit and independent P2 review pass. Gateway focused suites and the full static import graph remain incomplete on the loaded host; retain these proof gaps for the coordinator bundle rather than claiming green. * refactor(gateway): trust prepared server method inputs Remove a test-only config cache-reset wrapper, duplicate internal selection and channel-support checks, an unused session-file metadata fallback, and duplicate usage target shapes. Carry transcript delivery facts from their first parsing pass. Keep all network validation, effect authority, transcript durability, current update policy and standalone session memory machinery. Best-effort tradeoffs accepted: - Internal agent updates trust the selection-shape check at their sole production caller, agents.update. The duplicate originated in the Models agent-selection feature #150224; the same boundary check still rejects invalid user input. Live runtime choice validation stays at the effect. - Channel start support is checked once at the synchronous request boundary. The inner check from #67815 / #167159 cannot observe a different plugin without unsupported synchronous mutation; the boundary guard remains. - Workspace-root readers require caller-prepared metadata: both production consumers already provide it. The unused fallback from #161747 is deleted, not the Phase E backend or any factory. A future invalid internal caller gets a clear error instead of starting another metadata read. - Update handlers trust the required getRuntimeConfig contract instead of falling back to a global schedule for an invalid context. Keep #158301's real scheduler-policy incident fix and its post-await current-config read. - Usage summaries trust the canonical required target identity from #169660; the first-instance fallback served no production caller. The integration fixture now supplies that identity with all original assertions retained. No public schema/config/SDK/protocol or persisted shape changes. The config tests call the same canonical invalidators directly; no coverage is removed. Follow-up removes 54 net production lines; branch total removes 154. Targeted types (including MCP consumers), retained-file type-aware lint, formatting, zero runtime import cycles, suppression audit and independent P2 review pass. Gateway behavioral suites remain incomplete after a loaded-host startup run was stopped at about ten minutes (exit 143). The prior full static-graph gap remains pending for the coordinator bundle; no new production edge is added. * refactor(ui): consolidate page lifecycle and config plumbing Reuse the existing controller host, subscription and plugin-icon owners; share cloud-worker config edit wiring and Usage query comparisons. Remove the unused Usage detail predicate and duplicate model loading flag. Retire the Web Awesome-era picker hiding fence now that native Popover owns generation-bound close completion. Keep both rendering paths, draft recovery, user-intent checks and dispatch-time write authority. Settled rendering is unchanged. Net production reduction: 210 lines. Best-effort tradeoffs accepted: - Failed channel artwork retries on the next channel refresh rather than a queued trailing ensure. #131511 was a synthetic ordering regression; the human-reported owning-plugin bug #144152 remains covered. - Picker triggers may reopen during closing. #126032's fence came from CI/synthetic overlap, not a human incident; #171441 transferred lifecycle ownership to native Popover, which ignores superseded completions. Focused proof: 281 tests passed, including Chromium/WebKit overlay lifecycle and responsive placement controls. Independent P0-P2 review: scoped-clean. Final UI production and UI-pages test typechecks passed; suppression tests 3/3. Scoped lint passed after a mechanical no-lonely-if fix. Runtime and static import cycles: zero. No visual or locale changes. The global environment-name budget is inherited at 455/454 on both the untouched base and origin/main; none of its counted source roots changed. * refactor(ui): remove unused new-session hiding selector * refactor(gateway): retain legacy catalog and update handler contracts Withdraw two wave-5 cleanups after focused CI failures and bounded isolated replay. Preserve the existing scalar-read concurrency and update-status handler contract. Tighten task-suggestions assertion allowance to match the cleaned source.
…-5 bundle A) (openclaw#172989) * refactor(ui): remove unused page plumbing and duplicate presentation work Fold sole-caller Config and Cron adapters into their existing owners, reuse canonical controller types, and remove unused request arguments and login selection options. Adopt the complete background mutation receipt instead of rereading the write; keep authoritative preflight and live ownership checks. Best-effort tradeoffs accepted: a later background edit in another browser is reflected by normal preference events or refresh, not an unconditional read of our own successful write. The introducing feature PR openclaw#168301 does not identify a human incident requiring that reread. Settled rendering and public contracts are unchanged; both shipping renderer paths remain intact. * refactor(ui): consolidate presentation helpers and cached preview inputs Share point-menu trigger attributes and deletion-first LCS traversal. Remove an obsolete empty-badge predicate, a one-caller loading facade, and redundant whole-map translation fallback. Preserve both active Lit and Solid paths, positioning formulas, diff work budgets, visible text, and rendering. Best-effort tradeoffs accepted: - Trust successful synchronous Web Storage writes instead of reading them back. Introducing PR openclaw#162428 supplied synthetic storage failures, not a human incident where successful setItem silently failed. Nonconforming Storage replacements may miss a cache publication until the next refresh. - Trust immutable message/tool-card identities for cached source previews. PR openclaw#148431's in-place mutation assertions were synthetic; production owners publish replacement snapshots. Unsupported in-place mutation may leave a decoration stale until replacement. Run/frame/origin and external source validation remain unchanged. Net production reduction: 76 lines; tests: 20 lines removed, only synthetic same-object mutation assertions. Kept config coercion tied to human Safari report openclaw#13348, along with security, durability, ordinary navigation ownership, and all active migration paths. Focused proof: 73 boot/cache/diff tests, 82 menu tests, 46 badge/assistant tests, 20 i18n tests, 8 browser details tests, 3 lint-suppression tests; UI typecheck, formatting, stylesheet lint and CSS declaration parity passed. Known inherited local check failure: environment-variable count is 455 against budget 454, independently reproduced against clean HEAD/index. Its counted source roots exclude UI. No budget or unrelated source changes made. * refactor(ui): remove obsolete presentation compatibility and styling Use the native Popover capability required by the Control UI bootstrap instead of retaining old-engine in-flow fallbacks. Keep native overlay occlusion and all real connection/navigation ownership. Remove retired sidebar style hooks and share identical question-panel declarations. Supported browsers render identically; no user-visible copy, feature, renderer selection, config, protocol, or storage change. Best-effort tradeoffs accepted - Old engines without Popover support, or invalid direct popover mounts, no longer receive an in-flow menu fallback. The fallback came from openclaw#105598 as generic compatibility, not a human incident; openclaw#168595 made native Popover support a required bootstrap capability. Invalid direct mounts now fail clearly rather than silently changing layering. Deeper coverage and retained candidates are recorded in the requested task-local y03 ledger for coordinator bundling. Branch total: 123 net production LOC removed (+114/-237), excluding tests, fixtures, generated files and declarations. Below the 500-line campaign floor after the deeper components/app/lib/styles and lead-owned owner pass; push branch-only for bundling. * refactor(gateway): reuse server method owners Consolidate duplicate catalog response handling, optional catalog reads, pairing resolution, requester assertions and system agent transcript persistence. Carry prepared pairing and actor facts instead of probing or re-reading them. Remove redundant cache-generation and internal receipt checks; retain security, durability, pagination and resource bounds. Best-effort tradeoffs accepted: - Pairing captures its selected adapter once. Repeated internal checks added by openclaw#112401 guarded hypothetical in-place plugin mutation, not a reported incident. Such a mutation now leaves this request on its selected adapter; later requests discover the current registration. - Channel identity RPCs trust the canonical mutation result instead of repeating the action/kind assertion introduced in openclaw#161284. No human incident justified the redundant adapter assertion; live mutation authority remains with the state owner. No user-facing feature, protocol/config/persistence shape, schema, dependency, test coverage or standalone session memory backend changes. Net production reduction: 100 lines (179 added / 279 deleted). Type-aware lint, targeted production types, formatting, runtime cycles (zero), SDK surface, suppression audit and independent P2 review pass. Gateway focused suites and the full static import graph remain incomplete on the loaded host; retain these proof gaps for the coordinator bundle rather than claiming green. * refactor(gateway): trust prepared server method inputs Remove a test-only config cache-reset wrapper, duplicate internal selection and channel-support checks, an unused session-file metadata fallback, and duplicate usage target shapes. Carry transcript delivery facts from their first parsing pass. Keep all network validation, effect authority, transcript durability, current update policy and standalone session memory machinery. Best-effort tradeoffs accepted: - Internal agent updates trust the selection-shape check at their sole production caller, agents.update. The duplicate originated in the Models agent-selection feature openclaw#150224; the same boundary check still rejects invalid user input. Live runtime choice validation stays at the effect. - Channel start support is checked once at the synchronous request boundary. The inner check from openclaw#67815 / openclaw#167159 cannot observe a different plugin without unsupported synchronous mutation; the boundary guard remains. - Workspace-root readers require caller-prepared metadata: both production consumers already provide it. The unused fallback from openclaw#161747 is deleted, not the Phase E backend or any factory. A future invalid internal caller gets a clear error instead of starting another metadata read. - Update handlers trust the required getRuntimeConfig contract instead of falling back to a global schedule for an invalid context. Keep openclaw#158301's real scheduler-policy incident fix and its post-await current-config read. - Usage summaries trust the canonical required target identity from openclaw#169660; the first-instance fallback served no production caller. The integration fixture now supplies that identity with all original assertions retained. No public schema/config/SDK/protocol or persisted shape changes. The config tests call the same canonical invalidators directly; no coverage is removed. Follow-up removes 54 net production lines; branch total removes 154. Targeted types (including MCP consumers), retained-file type-aware lint, formatting, zero runtime import cycles, suppression audit and independent P2 review pass. Gateway behavioral suites remain incomplete after a loaded-host startup run was stopped at about ten minutes (exit 143). The prior full static-graph gap remains pending for the coordinator bundle; no new production edge is added. * refactor(ui): consolidate page lifecycle and config plumbing Reuse the existing controller host, subscription and plugin-icon owners; share cloud-worker config edit wiring and Usage query comparisons. Remove the unused Usage detail predicate and duplicate model loading flag. Retire the Web Awesome-era picker hiding fence now that native Popover owns generation-bound close completion. Keep both rendering paths, draft recovery, user-intent checks and dispatch-time write authority. Settled rendering is unchanged. Net production reduction: 210 lines. Best-effort tradeoffs accepted: - Failed channel artwork retries on the next channel refresh rather than a queued trailing ensure. openclaw#131511 was a synthetic ordering regression; the human-reported owning-plugin bug openclaw#144152 remains covered. - Picker triggers may reopen during closing. openclaw#126032's fence came from CI/synthetic overlap, not a human incident; openclaw#171441 transferred lifecycle ownership to native Popover, which ignores superseded completions. Focused proof: 281 tests passed, including Chromium/WebKit overlay lifecycle and responsive placement controls. Independent P0-P2 review: scoped-clean. Final UI production and UI-pages test typechecks passed; suppression tests 3/3. Scoped lint passed after a mechanical no-lonely-if fix. Runtime and static import cycles: zero. No visual or locale changes. The global environment-name budget is inherited at 455/454 on both the untouched base and origin/main; none of its counted source roots changed. * refactor(ui): remove unused new-session hiding selector * refactor(gateway): retain legacy catalog and update handler contracts Withdraw two wave-5 cleanups after focused CI failures and bounded isolated replay. Preserve the existing scalar-read concurrency and update-status handler contract. Tighten task-suggestions assertion allowance to match the cleaned source.
Summary
Describe the problem and fix in 2–5 bullets:
session.ts,auth-store.ts, and adjacent monitor/setup/status paths.openclaw channels loginflows could save auth on disk without restarting the live channel runtime owned by that gateway.creds.jsonsaves could leave later reads and retries acting on unstable auth state, and local CLI login could appear successful while the running gateway channel stayed stopped.linked/not-linked/unstableauth state through WhatsApp runtime/setup/status/health/login flows, and adds a genericchannels.startgateway handoff so local CLI login can reconcile the running gateway runtime immediately.useMultiFileAuthStateor add an auth-dir watcher/reloader; it hardens the existing auth model and adds an explicit runtime-start handoff instead.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
src/cli/channel-auth.ts, while the already-running gateway owned channel lifecycle, so successful local login did not automatically restart the runtime for channels that needed it.#63577addressed the atomic write boundary, but the follow-up read-path and retry-path hardening was still missing; the running-gateway reconcile gap was separate and existed on the CLI login path.Regression Test Plan (if applicable)
extensions/whatsapp/src/auth-store.test.tsextensions/whatsapp/src/session.test.tsextensions/whatsapp/src/channel.setup.test.tsextensions/whatsapp/src/login-qr.test.tsextensions/whatsapp/src/login.test.tsextensions/whatsapp/src/connection-controller.test.tsextensions/whatsapp/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.tssrc/gateway/server-methods/channels.start.test.tssrc/gateway/server-methods/web.start.test.tssrc/gateway/server.auth.compat-baseline.test.tssrc/infra/channel-summary.test.tssrc/commands/health.test.tsextensions/whatsapp/src/connection-controller.test.ts.User-visible / Behavior Changes
auth stabilizinginstead of disagreeing about linked vs not linked while queued creds saves are still settling.Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation:channels.start) used by local CLI login. The branch keeps that path behind the existing local gateway auth model and includes compat/regression coverage for the direct-local backend handshake path.Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Human Verification (required)
pnpm test extensions/whatsapp/src/auth-store.test.ts extensions/whatsapp/src/channel.setup.test.ts extensions/whatsapp/src/session.test.ts extensions/whatsapp/src/login-qr.test.ts extensions/whatsapp/src/login.test.ts extensions/whatsapp/src/connection-controller.test.ts extensions/whatsapp/src/auto-reply.web-auto-reply.connection-and-logging.e2e.test.tspnpm test src/gateway/server-methods/channels.start.test.ts src/gateway/server-methods/web.start.test.ts src/gateway/server.auth.compat-baseline.test.ts src/infra/channel-summary.test.ts src/commands/health.test.tspnpm tsgoReview Conversations
Compatibility / Migration
Risks and Mitigations