mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-29 14:02:19 +00:00
Previously, `is_session_expired_error` fired on any error containing
"401 + unauthorized", causing Discord bot-token failures, BYO-key
provider 401s, and Composio direct-mode errors to clear the user's
app session and force re-authentication.
The fix distinguishes error origins by format:
- OpenHuman backend errors (via `authed_json`) use "{METHOD} /path
failed (401 Unauthorized): {body}" — they start with an HTTP verb.
- Provider errors ("Discord API error: ...", "OpenAI API error ...")
start with a provider name, not an HTTP method.
Changes:
- `is_session_expired_error`: keeps explicit session markers ("session
expired", SESSION_EXPIRED, "no backend session token", "session jwt
required") and the HTTP-method-prefixed 401 check; removes the
bare "invalid token" and generic "401 + unauthorized" matches.
- Adds `is_downstream_provider_auth_error` helper for diagnostic
logging only (no side effects).
- `coreRpcClient.ts`: adds `provider_auth` error kind; tightens
`classifyRpcError` to match backend-path 401s by HTTP-method prefix
and route remaining 401s to `provider_auth` instead of `auth_expired`.
- Tests updated in `jsonrpc_tests.rs` and `coreRpcClient.test.ts`.
Closes #2286
Tauri + React + Typescript
This template should help get you started developing with Tauri, React and Typescript in Vite.