Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(session): prevent session owner from being removed from their own session

Steven Enamakel7e21504e1fda
diff --git a/app/src/services/session/sessionOwner.ts b/app/src/services/session/sessionOwner.ts
index 25c3fa2e80..5c702dd43a 100644
--- a/app/src/services/session/sessionOwner.ts
+++ b/app/src/services/session/sessionOwner.ts
@@ -286,13 +286,18 @@ export const logoutSession = async (): Promise<void> => {
return;
}
browserCurrentUserCache = null;
- const state = await callCoreRpc<{
- result: { credential?: 'session' | 'local' | 'api-key' | null };
- }>({ method: 'openhuman.auth_get_state' });
- const kind = state.result.credential;
- if (kind === 'session' || kind === 'local') {
- await callCoreRpc({ method: 'openhuman.auth_clear_credential', params: { kind } });
- }
+ // Always clear the session/local credential, even when an API key is also
+ // stored and is the *effective* one `auth.get_state` reports: gating this
+ // on the currently-effective credential left a hidden session behind
+ // whenever both were stored, and clearing the API key later would
+ // silently restore that supposedly logged-out session (#6318). `kind:
+ // 'session'` clears whichever of session or local is actually stored —
+ // both live under the same app-session profile — without touching the
+ // API key, unlike omitting `kind` entirely.
+ await callCoreRpc({
+ method: 'openhuman.auth_clear_credential',
+ params: { kind: 'session' },
+ });
};
/**