Skip to content

fix(desktop): stop claiming "Connected" — desktop QQ is config-editor-only (#1317)#1326

Merged
esengine merged 1 commit into
mainfrom
fix/qq-desktop-honest-status
May 19, 2026
Merged

fix(desktop): stop claiming "Connected" — desktop QQ is config-editor-only (#1317)#1326
esengine merged 1 commit into
mainfrom
fix/qq-desktop-honest-status

Conversation

@esengine

Copy link
Copy Markdown
Owner

Summary

#1241 added a QQ settings entry to the desktop app, but the wiring only flips cfg.qq.enabled = true and emits a status — it never starts an actual QQChannel in the desktop process. The channel only ever runs in the CLI (chat.tsx auto-starts it on launch based on the same flag).

The desktop UI then displayed "Connected" / "已连接" because loadDesktopQQState returned connected: configured && enabled. That conflated "config flag on" with "live channel up" — and that's the root cause of #1317:

  • "设置显示成功连接QQ通道" — desktop UI says "connected" based on a stale config flag.
  • "访问控制未绑定" — no first-sender binding ever happens because no bot is running in the desktop process.
  • "无法使用QQ机器人" — the bot doesn't respond because there's no live connection.
  • "/qq命令不存在" — slash commands are CLI-only; the desktop chat box doesn't dispatch them.

Fix

Stop lying. Don't pretend the desktop is the runtime when it's only the config editor.

  • loadDesktopQQState always returns connected: false. Adds a new enabledForCli: boolean field reflecting "credentials saved AND toggle on — next reasonix terminal session will start the bot."
  • New labels replace the binary "Connected / Disconnected" lie:
    • Enabled (CLI) / 已启用(终端)— config flag on, bot will start on next CLI run.
    • Configured · disabled / 已配置 · 未启用 — credentials saved but toggle off.
    • Not configured / 未配置 — no credentials yet.
  • New qqRuntimeNote banner above the QQ section explains the runtime split.
  • Button labels: "Connect" → Enable for CLI; "Disconnect" → Disable.
  • Status text emitted by qq_connect / qq_disconnect tells the user to run reasonix in a terminal instead of implying the desktop is now the runtime.
  • Protocol back-compat: connected stays in the QQSettingsEvent shape (always false) so older clients don't crash.

The bigger architectural lift — making the desktop process actually host a QQChannel — stays as a future enhancement. It needs lifecycle work (which tab owns the channel? how does the desktop runtime route incoming messages back to a specific tab? what about the ~/.reasonix/qq-channel.pid lock racing the CLI?) and isn't required to fix the immediate user-visible lying-status bug.

Test plan

… only

#1241 added the desktop QQ settings UI but never wired up an actual
QQChannel — pressing "Connect" only flipped `cfg.qq.enabled = true`
and emitted a "QQ enabled" status, while the channel itself can only
run inside the CLI (chat.tsx auto-starts it on launch based on the
same flag).

The UI then displayed "Connected" / "已连接" because the desktop helper
returned `connected: configured && enabled`. That conflated "config
flag on" with "live channel up" — which is the root cause of #1317:
the user saw "successfully connected", the access control panel said
"unbound" (no first-sender binding could happen — no bot was running),
and the bot didn't respond.

This PR makes the desktop honest:

- `loadDesktopQQState` always returns `connected: false` (the desktop
  process never holds a QQChannel) and adds `enabledForCli: boolean`
  to surface the actual flag-state for the UI.
- New labels: "Enabled (CLI)" / "Configured · disabled" / "Not
  configured" replace the binary "Connected / Disconnected" lie.
- New `qqRuntimeNote` banner explains that the bot runs in `reasonix`
  terminal sessions, not in the desktop window. Credentials saved
  here are picked up by the next CLI launch.
- Button labels: "Connect" → "Enable for CLI", "Disconnect" → "Disable".
- Status text emitted by `qq_connect` / `qq_disconnect` tells the user
  to run `reasonix` in a terminal instead of implying the desktop is
  now the runtime.
- Protocol back-compat: `connected` field stays in the event shape
  (always false) so older desktop clients don't crash.

Tests: `desktop-qq-config` adds two new assertions (#1317 regressions)
that `connected` is always false and `enabledForCli` reflects the real
state. `desktop-qq-settings-ui` updates the zh-CN label test to match
the new "Not configured" label and adds coverage for the new
"Enabled (CLI)" and "Configured · disabled" states.

The "Desktop runs its own QQChannel" feature stays as a future
enhancement — it needs lifecycle work (which tab owns the channel?
how does the desktop runtime route incoming messages? what about the
`~/.reasonix/qq-channel.pid` lock racing the CLI?) and isn't required
to fix the immediate lying-status bug.

Closes #1317
@esengine esengine merged commit 8735359 into main May 19, 2026
4 checks passed
@esengine esengine deleted the fix/qq-desktop-honest-status branch May 19, 2026 11:37
ChasLui pushed a commit to ChasLui/DeepSeek-Reasonix that referenced this pull request May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant