Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(navigation): make log out discoverable from settings search and cmd+k (#59236)

posthog[bot]7f7d040fc029
diff --git a/ee/hogai/chat_agent/prompts/base.py b/ee/hogai/chat_agent/prompts/base.py
index ab3e95cc8484..ba3e13bf5432 100644
--- a/ee/hogai/chat_agent/prompts/base.py
+++ b/ee/hogai/chat_agent/prompts/base.py
@@ -72,6 +72,8 @@ Do not generate any code like Python scripts. Users don't have the ability to ru
When users ask about SQL variables or query variables, use SQL mode and query `system.insight_variables` directly. For example:
`SELECT id, name, code_name, type, default_value, values FROM system.insight_variables WHERE name ILIKE '%term%' OR code_name ILIKE '%term%' LIMIT 20`.
+
+When users ask how to log out, sign out, or where the logout button is: it lives in the account menu at the top of the left navigation sidebar – click the organization logo / project name at the top-left, then "Log out" near the bottom of the menu that opens. It is also reachable from the command palette (Cmd/Ctrl+K → type "logout") and from Settings search ("logout"). Logout is NOT a setting under Project, Organization, or User settings pages – do not direct users there.
</basic_functionality>
""".strip()
diff --git a/frontend/src/lib/components/Command/Command.tsx b/frontend/src/lib/components/Command/Command.tsx
index 1ee6190805ff..e9a5e688fc4a 100644
--- a/frontend/src/lib/components/Command/Command.tsx
+++ b/frontend/src/lib/components/Command/Command.tsx
@@ -15,6 +15,10 @@ export function Command(): JSX.Element {
const handleItemSelect = useCallback(
(item: SearchItem) => {
closeCommand()
+ if (item.onSelect) {
+ item.onSelect()
+ return
+ }
if (item.href) {
router.actions.push(item.href)
}
diff --git a/frontend/src/lib/components/Search/searchLogic.tsx b/frontend/src/lib/components/Search/searchLogic.tsx
index 281f4c059aa8..92ac6c74b743 100644
--- a/frontend/src/lib/components/Search/searchLogic.tsx
+++ b/frontend/src/lib/components/Search/searchLogic.tsx
@@ -1,7 +1,7 @@
import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
-import { IconBell, IconClock, IconDownload, IconNotification } from '@posthog/icons'
+import { IconBell, IconClock, IconDownload, IconLeave, IconNotification } from '@posthog/icons'
import api from 'lib/api'
import { commandLogic } from 'lib/components/Command/commandLogic'
@@ -66,6 +66,9 @@ export interface SearchItem {
category: string
productCategory?: string | null
href?: string
+ /** Action invoked when the item is selected. Use for items that trigger something
+ * other than navigation (e.g. logging out). Consumers should prefer `onSelect` over `href`. */
+ onSelect?: () => void
icon?: React.ReactNode
lastViewedAt?: string | null
groupNoun?: string | null
@@ -627,6 +630,17 @@ export const searchLogic = kea<searchLogicType>([
lastViewedAt: sceneLogViewsByRef['Subscriptions'] ?? null,
record: { type: 'subscriptions' },
},
+ {
+ id: 'misc-logout',
+ name: 'Log out',
+ displayName: 'Log out',
+ category: 'misc',
+ icon: <IconLeave />,
+ itemType: null,
+ searchKeywords: ['logout', 'log out', 'sign out', 'signout', 'exit'],
+ onSelect: () => userLogic.actions.logout(),
+ record: { type: 'logout' },
+ },
],
],
settingsItems: [