From a29517e5803b84d1dcbcf5ea0c89f72a6bed206c Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Mon, 11 May 2026 16:17:26 +0800 Subject: [PATCH] fix: sync /api/status loginState with actual logged_in_user from DB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: #110 (similar issue with login state inconsistency) --- packages/agent-server-rust/src/router/status.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/agent-server-rust/src/router/status.rs b/packages/agent-server-rust/src/router/status.rs index 7ce72469..10bd7fec 100644 --- a/packages/agent-server-rust/src/router/status.rs +++ b/packages/agent-server-rust/src/router/status.rs @@ -24,9 +24,16 @@ use crate::tools::qr::{decode_qr_from_base64, to_data_url}; use crate::tools::screenshot::capture_screenshot; pub async fn get_status() -> Json { + let session = get_session("default"); + let login_status = session + .as_ref() + .and_then(|s| s.logged_in_user.as_ref()) + .map(|u| "logged_in".to_string()) + .unwrap_or_else(|| "logged_out".to_string()); + Json(serde_json::json!({ "container": "running", - "loginState": { "status": "logged_out" }, + "loginState": { "status": login_status }, "version": "0.1.0" })) }