qwen-code/docs/developers/daemon
jifeng 858c900af9
feat(serve): add daemon idle detection to GET /health?deep=true (#4934)
* docs(design): add daemon idle detection API design for machine reclamation

When qwen daemon is deployed across multiple machines, an external
scheduler needs a reliable signal to determine if a daemon is idle
and the machine can be reclaimed. This design proposes enhancing
GET /health?deep=true with activePrompts, connectedClients,
channelAlive, lastActivityAt, and idleSinceMs fields.

* feat(serve): add idle-detection fields to GET /health?deep=true

* fix(test): add activePromptCount and lastActivityAt to fakeBridge

Update the test helper to satisfy the expanded AcpSessionBridge
interface so /health?deep=true tests pass with the new fields.

* test(idle-detection): add unit tests for activePromptCount, lastActivityAt and /health?deep=true new fields

* refactor(bridge): replace activePromptCount iteration with O(1) counter

* fix(bridge): move idleSinceMs computation into bridge to eliminate race window

* fix(idle-detection): keep daemon health state consistent

Guard prompt teardown so activePromptCount only decrements once and compute deep health idle fields from the same activity snapshot.

* fix(acp): prevent active prompt leak after channel crash

Reject queued prompts after their session entry has been torn down so daemon health does not report phantom active prompts.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-18 06:55:03 +00:00
..
00-index.md docs: fix MCP token path, daemon UI event count, add Feishu channel (#5172) 2026-06-16 11:37:43 +08:00
01-architecture.md docs: fix MCP token path, daemon UI event count, add Feishu channel (#5172) 2026-06-16 11:37:43 +08:00
02-serve-runtime.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
03-acp-bridge.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
04-permission-mediation.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
05-mcp-transport-pool.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
06-mcp-budget-guardrails.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
07-workspace-filesystem.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
08-session-lifecycle.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
09-event-schema.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
10-event-bus.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
11-capabilities-versioning.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
12-auth-security.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
13-sdk-daemon-client.md docs: fix MCP token path, daemon UI event count, add Feishu channel (#5172) 2026-06-16 11:37:43 +08:00
14-cli-tui-adapter.md docs: fix MCP token path, daemon UI event count, add Feishu channel (#5172) 2026-06-16 11:37:43 +08:00
15-channel-adapters.md feat(serve): add daemon idle detection to GET /health?deep=true (#4934) 2026-06-18 06:55:03 +00:00
16-vscode-ide-adapter.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
17-configuration.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
18-error-taxonomy.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
19-observability.md feat(serve): add daemon idle detection to GET /health?deep=true (#4934) 2026-06-18 06:55:03 +00:00
20-quickstart-operations.md docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00
_meta.ts docs(daemon): Refresh daemon docs in English (#5144) 2026-06-15 22:38:01 +08:00