feat: add daemon mode with web UI for persistent background sessions#2275
Open
wenshao wants to merge 4 commits intoQwenLM:mainfrom
Open
feat: add daemon mode with web UI for persistent background sessions#2275wenshao wants to merge 4 commits intoQwenLM:mainfrom
wenshao wants to merge 4 commits intoQwenLM:mainfrom
Conversation
Implements daemon mode allowing Qwen Code to run persistently in the background with a web interface for interaction: - CLI commands: qwen daemon start/stop/status/sessions - HTTP server with WebSocket for real-time streaming - Self-contained web UI with dark theme chat interface - Session management with unique URLs and auth tokens - Background process via fork() with IPC for startup coordination - Lock file (~/.qwen/daemon/daemon.lock) for process discovery - Foreground mode (--foreground) for debugging - Auto-reconnect WebSocket with connection status indicator Closes QwenLM#2271 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ctness - Add mutex to serialize session execution, preventing stdout/stderr cross-contamination - Enforce POST method on /api/stop endpoint (return 405 for other methods) - Decouple process.exit from DaemonServer via onStop callback - Return 404 for non-existent sessions instead of auto-creating them - Fix stop command race condition by polling until process actually exits - Use passed sessionId instead of generating a new randomUUID - Log startup errors to stderr before exit in daemon-entry - Add single-quote escaping to escapeHtml - Add server.test.ts (11 tests) and session-runner.test.ts (6 tests) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add constant-time token comparison via crypto.timingSafeEqual (QwenLM#6) - Validate lock file fields before trusting parsed JSON (QwenLM#4) - Verify daemon identity via /health API before sending SIGTERM (QwenLM#5) - Add session idle timeout (30min) to auto-cleanup unused sessions (#1) - Reject concurrent prompts on same session instead of overwriting (QwenLM#8) - Add max session limit (50) to prevent resource exhaustion (QwenLM#7) - Use server.closeAllConnections() for prompt stop() resolution (QwenLM#15) - Register onStop callback in foreground mode (QwenLM#10) - Fix unhandled promise in onStop callback with void (#3) - Respect encoding parameter in captureWrite (QwenLM#14) - Remove unnecessary env spread in fork options (QwenLM#9) - Add tests for lock file validation and session page serving Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The package-lock.json was out of sync after adding ws to packages/cli, causing npm ci to fail on Node.js 24.x with "Missing: @google/gemini-cli-test-utils". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Implements daemon mode allowing Qwen Code to run persistently in the background with a web interface for interaction:
Closes #2271
TLDR
Dive Deeper
Reviewer Test Plan
Testing Matrix
Linked issues / bugs