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.

fix(desktop): hide raw logs in pi threads (#94117)

Jonathan Mieloo8e1024caad38
diff --git a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx
index 0348a7c29586..e3f39e4f425b 100644
--- a/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx
+++ b/products/desktop/packages/ui/src/features/sessions/components/chat-thread/ChatThread.tsx
@@ -363,6 +363,7 @@ function formatTimestamp(ts: number): string {
* tab stop a keyboard reader needs to reach the thumbs at all.
*/
const FooterRevealContext = createContext(false);
+const RawLogsToggleContext = createContext(false);
function TurnFooter({
turnId,
@@ -736,10 +737,6 @@ function UserBubble({
* message's right rail — the turn footer covers the common case, so a single message's copy lives
* here instead of costing every row a hover affordance.
*
- * This menu sits inside `SessionView`'s own context menu and wins the event over it, so it also
- * carries that menu's raw-logs toggle; without it, right-clicking a message would be the one spot
- * in the session where the toggle went missing.
- *
* Highlighted text wins over the message: right-clicking a selection copies just that, as it does
* outside the app. The whole message is the fallback for a right-click with nothing selected, and
* stays reachable without the menu through the footer's copy button.
@@ -755,6 +752,7 @@ function MessageContextMenu({
value: string;
children: ReactElement;
}) {
+ const showRawLogsToggle = useContext(RawLogsToggleContext);
const showRawLogs = useShowRawLogs();
const { setShowRawLogs } = useSessionViewActions();
const [selection, setSelection] = useState<string | null>(null);
@@ -779,11 +777,15 @@ function MessageContextMenu({
<Copy size={14} />
{selection ? "Copy selection" : "Copy message"}
</ContextMenuItem>
- <ContextMenuSeparator />
- <ContextMenuItem onClick={() => setShowRawLogs(!showRawLogs)}>
- <Scroll size={14} />
- {showRawLogs ? "Back to conversation" : "Show raw logs"}
- </ContextMenuItem>
+ {showRawLogsToggle && (
+ <>
+ <ContextMenuSeparator />
+ <ContextMenuItem onClick={() => setShowRawLogs(!showRawLogs)}>
+ <Scroll size={14} />
+ {showRawLogs ? "Back to conversation" : "Show raw logs"}
+ </ContextMenuItem>
+ </>
+ )}
</ContextMenuContent>
</ContextMenu>
);
@@ -1432,13 +1434,15 @@ export function ChatThread({ events, ...props }: ChatThreadProps) {
);
return (
- <ChatThreadRenderer
- key={props.taskId}
- {...props}
- conversationItems={items}
- footerEvents={[]}
- footerState={footerState}
- />
+ <RawLogsToggleContext.Provider value={false}>
+ <ChatThreadRenderer
+ key={props.taskId}
+ {...props}
+ conversationItems={items}
+ footerEvents={[]}
+ footerState={footerState}
+ />
+ </RawLogsToggleContext.Provider>
);
}
@@ -1449,12 +1453,14 @@ export function AcpChatThread({ events, ...props }: AcpChatThreadProps) {
});
return (
- <ChatThreadRenderer
- key={props.taskId}
- {...props}
- conversationItems={items}
- footerEvents={events}
- />
+ <RawLogsToggleContext.Provider value={true}>
+ <ChatThreadRenderer
+ key={props.taskId}
+ {...props}
+ conversationItems={items}
+ footerEvents={events}
+ />
+ </RawLogsToggleContext.Provider>
);
}