Skip to content

fix: sync /api/status loginState with actual logged_in_user from DB - #161

Open
foshanfm wants to merge 1 commit into
thisnick:mainfrom
foshanfm:main
Open

fix: sync /api/status loginState with actual logged_in_user from DB#161
foshanfm wants to merge 1 commit into
thisnick:mainfrom
foshanfm:main

Conversation

@foshanfm

Copy link
Copy Markdown

问题

/api/status 始终返回 logged_out,即使微信已登录。导致消息发送失败。

原因

get_status() 函数硬编码返回 logged_out,没有读取数据库中实际的登录状态。

修复

get_status() 读取 session.logged_in_user 字段,与 auth_status() 保持一致。

测试

  • /api/statuslogged_in
  • /api/status/auth → 一致 ✅
  • /api/messages/send{"success":true}

改动

  • packages/agent-server-rust/src/router/status.rs: 8行修改

Fixes #110

Before this fix, /api/status always returned loginState.status as
'logged_out' regardless of actual login state. This caused
inconsistency where:
- /api/status → logged_out
- /api/status/auth → logged_in
- sending messages failed with NOT_LOGGED_IN

Now get_status() reads the session's logged_in_user from the database
and derives the loginState.status from that, which is consistent with
how auth_status() determines login state.

Fixes: thisnick#110 (similar issue with login state inconsistency)
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.

agent-wechat 0.11.2: messages send fails with "No action selected" even when logged in and chat is open

1 participant