fix: write openclaw config atomically to preserve dashboard auth#2542
Closed
AhmedTMM wants to merge 7 commits intoOpenRouterTeam:mainfrom
Closed
fix: write openclaw config atomically to preserve dashboard auth#2542AhmedTMM wants to merge 7 commits intoOpenRouterTeam:mainfrom
AhmedTMM wants to merge 7 commits intoOpenRouterTeam:mainfrom
Conversation
Adds separate "Telegram" and "WhatsApp" checkboxes to the OpenClaw setup screen: - Telegram: prompts for bot token from @Botfather, injects into OpenClaw config via `openclaw config set` - WhatsApp: reminds user to scan QR code via the web dashboard after launch (no CLI setup possible) Updates USER.md with channel-specific guidance when either is selected. Bump CLI version to 0.16.16. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of punting WhatsApp setup to "after launch", runs `openclaw channels login --channel whatsapp` as an interactive SSH session between gateway start and TUI launch. The user scans the QR code with their phone during provisioning setup. Flow: gateway starts → tunnel set up → WhatsApp QR scan → TUI launch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmed Abushagur <ahmed@abushagur.com>
The `openclaw config set` calls for browser and Telegram settings were re-serializing openclaw.json and dropping the gateway.auth.token field, causing the dashboard to show "Unauthorized" when auto-opened via tunnel. Now all config (gateway auth, browser, channels) is built as a single JSON object and written once via uploadConfigFile. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds 40 new tests across 2 files: openclaw-config.test.ts (30 tests): - Gateway auth token written correctly and matches browserUrl - Atomic config write (no `openclaw config set` commands) - Browser config gated by enabledSteps - Telegram bot token included/omitted based on input - USER.md messaging channel content - Tunnel config targeting port 18791 orchestrate-messaging.test.ts (10 tests): - SPAWN_ENABLED_STEPS parsing and threading - WhatsApp QR scan session triggered before agent launch - GitHub auth gated by enabledSteps - preLaunchMsg output behavior Also adds SPAWN_TELEGRAM_BOT_TOKEN env var override for non-interactive/CI Telegram setup (avoids prompt in tests). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
louisgv
approved these changes
Mar 12, 2026
Member
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: 3aa895e
Findings
No security issues found. This PR improves security by fixing the race condition where the gateway auth token was being dropped during config updates.
Positive changes:
- [SECURITY FIX] Atomic config write prevents token loss (agent-setup.ts:388-389)
- [GOOD] Credential handling uses JSON.stringify (no injection risk) (agent-setup.ts:388)
- [GOOD] User input (Telegram token) properly sanitized via trim() (agent-setup.ts:341)
- [GOOD] WhatsApp command is static string (no interpolation) (orchestrate.ts:259-261)
- [GOOD] 40 new test cases verify token preservation and atomic writes
Tests
- bash -n: N/A (no shell scripts changed)
- bun test: PASS (40/40 tests passing)
- Lint: PASS (0 errors from biome)
- macOS compat: N/A (no shell changes)
Summary
This PR addresses issue #2489 by writing all OpenClaw config atomically in a single JSON upload, preventing the gateway auth token from being clobbered by subsequent openclaw config set calls. The implementation is secure with no injection risks, and comprehensive test coverage validates the fix.
-- security/pr-reviewer
Collaborator
Author
|
Fix merged directly into #2523 instead. |
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.
Summary
openclaw config setcalls for browser and Telegram settings were re-serializingopenclaw.jsonand dropping thegateway.auth.tokenfielduploadConfigFileTest plan
spawn openclaw <cloud>— dashboard should open without "Unauthorized"~/.openclaw/openclaw.jsonbun testpasses (1380/1380)🤖 Generated with Claude Code