openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Local offline session triggers expired session error on chat message

Open exotol opened this issue 2 months ago • 1 comments

Image

Summary When signed in with a local offline profile (credential: "local"), sending any chat message fails immediately with the error "Something went wrong: Your OpenHuman session has expired. Please sign in again to continue."

Problem What happened vs what was expected After launching the desktop app and using a local offline session ([email protected]), sending any prompt in the chat fails. The agent driver attempts to query the hosted openhuman backend model (openhuman_backend_model.stream / invoke), which rejects the local token with an HTTP 401 {"success":false,"error":"Invalid token","errorCode":"UNAUTHORIZED"}.

The frontend catches this error and presents a misleading alert stating that the user's session has expired, prompting them to log in again even though they are actively authenticated with a local offline session.

Expected behavior: In a local offline profile, the app should either guide the user to configure their own provider credentials (BYOK like Anthropic/OpenAI/Ollama) or prevent invoking the remote hosted backend with invalid local credentials, displaying a clear configuration notice instead of an expired session warning.

Impact Users on offline or local sessions cannot use the chat out-of-the-box and are stuck in a confusing loop where the UI insists their session expired after every message.

Steps to reproduce Launch OpenHuman Desktop (v0.64.10). Continue with the default local offline profile (auth get_state reports "credential": "local", "isAuthenticated": true). Open a chat thread and send any message (e.g. "привет" or "hi"). Observe the message failing with: Something went wrong Your OpenHuman session has expired. Please sign in again to continue.

Version / platform App version: OpenHuman 0.64.10 (openhuman-core 0.64.10-x86_64-unknown-linux-gnu) Environment: Desktop AppImage OS: Linux x86_64 (Bluefin LTS / Fedora Atomic) Solution (optional) Suspected cause By default, the active model is set to the hosted openhuman provider. In local offline mode, the core recognizes that the credential is local (SessionExpired ignored for local offline session), but openhuman_backend_model still gets called against the remote endpoint without valid cloud bearer tokens. The 401 HTTP response bubbles up as a driver failure (driver failed: model error: OpenHuman returned HTTP 401), which the frontend interprets as an expired user session. Proposed fix Backend / Core: In local offline mode, prevent routing inference to openhuman_backend_model if no valid cloud credentials exist; return an actionable error indicating that a model provider or API key must be selected. Frontend: Differentiate between a cloud token expiration and an unconfigured/unauthorized provider model error so the UI does not prompt the user to re-authenticate when they are deliberately on a local profile. Workaround Configure an external provider (such as Anthropic, OpenAI, or a local Ollama instance) in Settings and set it as the active model for the thread.

Acceptance criteria Repro gone — Sending a message in a fresh local offline session does not produce an erroneous "Your OpenHuman session has expired" error banner. Regression safety — Unit or integration test added in openhuman-core ensuring local/offline sessions either intercept calls to remote-only providers or surface a descriptive provider configuration prompt. Diff coverage ≥ 80% — The fix PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by .github/workflows/ci-fast.yml ). UI messaging — The web/desktop UI clearly indicates when an external API key or cloud sign-in is required, rather than treating any 401 from a model endpoint as an invalid user session. Related Log excerpt (~/.openhuman/logs/openhuman.2026-10-02.log):

text

18:15:57:WRN:bus [auth] SessionExpired ignored for local offline session — re-enabling scheduler gate source=openhuman_backend_model.invoke(401) reason={"success":false,"error":"Invalid token","errorCode":"UNAUTHORIZED"} 18:15:57:INF:observability [observability] agent.run_single skipped expected session-expired error: driver failed: model error: OpenHuman returned HTTP 401: {"success":false,"error":"Invalid token","errorCode":"UNAUTHORIZED"} domain="agent" operation="run_single" 18:15:57:INF:observability [observability] web_channel.run_chat_task skipped expected session-expired error: run_chat_task failed ... error=driver failed: model error: OpenHuman returned HTTP 401: {"success":false,"error":"Invalid token","errorCode":"UNAUTHORIZED"} Core handlers: crates/openhuman-rpc/src/server/socketio.rs and crates/openhuman-core/src/platform/update/scheduler.rs. 6:21 PM

exotol avatar Oct 02 '26 15:10 exotol

Picking this one up. Looks like the offline local profile still gets sent to the cloud model even though there is no account behind it, and the rejection that comes back is what turns into the "session expired" message. I'll stop that call from going out in the first place and show a message that points at what actually fixes it.

obchain avatar Oct 06 '26 08:10 obchain