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(conversations): give agent notes and reports the AI colour (#78337)

Luke Belton6aba84a77b31
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 8bc5581fb15d..920d3a9bda57 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7239,7 +7239,7 @@ snapshots:
scenes-app-support-threadreportentry--fix-proposed--light:
hash: v1.k794b7964.c6c298530eeb24ccb24d03b4154c5bed13fe2c880f44c8c2f1b64c00de67d607.GL23s_Dpa4eOE1lQeklRM4jtk6sEaQ1FqSb8b5oPkvo
scenes-app-support-threadreportentry--several-reports-across-states--dark:
- hash: v1.k794b7964.4c731c34ab351c352581130456833a7c220bcd4c4e941798d3e4345fc40c463b.Z9eFNeKgXiA5Pc07ZqkMPLoc83WoFhfB2sf7_xHX-Kk
+ hash: v1.k794b7964.9a8c427062ed7bc3ded83b2ccb343c593cb6f3f1a45b7e110d1d3a316f62dc16.9csuq0SryVkPRVZot6IgvtXxR1j7452hPCWAUhsUBo0
scenes-app-support-threadreportentry--several-reports-across-states--light:
hash: v1.k794b7964.ec55e023b31b2a327072c0e9fe3b164f74d81a226aa3efae9d6fe79d98db5da6.R5v-7fBBPhhayu8hBAHgU6eyTieyIbMYD3ewFUeP_Vo
scenes-app-surveys--new-multi-question-survey-section--dark:
diff --git a/products/conversations/frontend/components/Chat/Message.tsx b/products/conversations/frontend/components/Chat/Message.tsx
index 2626e87b8955..b64e3216c20e 100644
--- a/products/conversations/frontend/components/Chat/Message.tsx
+++ b/products/conversations/frontend/components/Chat/Message.tsx
@@ -43,7 +43,8 @@ export function Message({
onEdit,
onDelete,
}: MessageProps): JSX.Element {
- const profileType = message.authorType === 'AI' ? 'bot' : 'person'
+ const isAgent = message.authorType === 'AI'
+ const profileType = isAgent ? 'bot' : 'person'
const isPrivate = message.isPrivate
const [feedbackText, setFeedbackText] = useState('')
const [feedbackTextSubmitted, setFeedbackTextSubmitted] = useState(false)
@@ -74,16 +75,25 @@ export function Message({
<div className={`flex ${isCustomer ? 'mr-10' : 'flex-row-reverse ml-10'} mb-4`}>
<div className="flex gap-2 min-w-0">
<div className="flex flex-col min-w-0 items-start">
- <div className="flex items-center justify-between w-full gap-2 mb-1">
+ {/* The agent's byline takes the AI colour too, so the name, the badge and the
+ bubble all say the same thing. `ProfilePicture` puts `className` on the avatar,
+ where the robot glyph picks the colour up, and renders the name as a sibling —
+ so the name is coloured from this row rather than through the component. */}
+ <div
+ className={`flex items-center justify-between w-full gap-2 mb-1 ${
+ isAgent ? '[&_.profile-name]:text-ai' : ''
+ }`}
+ >
<ProfilePicture
size="sm"
user={message.createdBy}
name={message.authorName}
type={profileType}
showName={true}
+ className={isAgent ? 'text-ai' : undefined}
/>
<div className="flex items-center gap-1.5">
- {isPrivate && <TeamOnlyBadge label="Private note" />}
+ {isPrivate && <TeamOnlyBadge label="Private note" tone={isAgent ? 'agent' : 'teammate'} />}
<span className="text-xs text-muted-alt">
<TZLabel time={message.createdAt} />
{(message.version ?? 0) > 0 ? ' (edited)' : null}
@@ -91,10 +101,23 @@ export function Message({
</div>
</div>
<div className="max-w-full min-w-80">
+ {/* A note the customer can't see is set apart by hue, and which hue says who
+ wrote it: the assistant's notes take the AI colour the rest of the app
+ uses for our own agents, a teammate's keep the warning amber. Scanning a
+ long thread, "a colleague left me this" and "software left me this" are
+ different enough to be worth telling apart before either is read. The
+ byline and the lock badge above follow the same colour, so one note is
+ one signal rather than three competing ones. */}
<div
className={`border py-2 px-3 rounded-lg ${
isPrivate
- ? 'bg-warning-highlight border-warning'
+ ? isAgent
+ ? // The fills are the app's existing AI pair; the border is
+ // held back to 60% because `border-ai` at full strength
+ // outshouts the amber it sits next to, and the assistant
+ // leaves one of these on nearly every ticket.
+ 'bg-ai/08 dark:bg-ai/20 border-ai/60'
+ : 'bg-warning-highlight border-warning'
: isCustomer
? 'bg-surface-secondary'
: 'bg-surface-primary'
diff --git a/products/conversations/frontend/components/Chat/TeamOnlyBadge.tsx b/products/conversations/frontend/components/Chat/TeamOnlyBadge.tsx
index fb6bacb71bb9..79c51d5bf2ca 100644
--- a/products/conversations/frontend/components/Chat/TeamOnlyBadge.tsx
+++ b/products/conversations/frontend/components/Chat/TeamOnlyBadge.tsx
@@ -7,11 +7,21 @@ import { Tooltip } from '@posthog/lemon-ui'
* one tooltip, no chance of two surfaces drifting into two different-looking promises.
*
* `label` varies because what's being withheld varies: a note someone wrote, versus an agent's findings.
+ *
+ * `tone` varies for a different reason. The lock, the tooltip and the shape stay fixed, so the promise
+ * is still one thing; only the colour follows whoever wrote the entry, matching the note it sits above.
*/
-export function TeamOnlyBadge({ label }: { label: string }): JSX.Element {
+export type TeamOnlyTone = 'teammate' | 'agent'
+
+const TONE_CLASSES: Record<TeamOnlyTone, string> = {
+ teammate: 'text-warning-dark bg-warning-highlight',
+ agent: 'text-ai bg-ai/10',
+}
+
+export function TeamOnlyBadge({ label, tone = 'teammate' }: { label: string; tone?: TeamOnlyTone }): JSX.Element {
return (
<Tooltip title="Only visible to your team">
- <span className="inline-flex items-center gap-0.5 text-xs text-warning-dark bg-warning-highlight px-1.5 py-0.5 rounded">
+ <span className={`inline-flex items-center gap-0.5 text-xs px-1.5 py-0.5 rounded ${TONE_CLASSES[tone]}`}>
<IconLock className="text-xs" />
{label}
</span>
diff --git a/products/conversations/frontend/scenes/ticket/ThreadReports.tsx b/products/conversations/frontend/scenes/ticket/ThreadReports.tsx
index 4e3c5bb81791..1fc237b1f540 100644
--- a/products/conversations/frontend/scenes/ticket/ThreadReports.tsx
+++ b/products/conversations/frontend/scenes/ticket/ThreadReports.tsx
@@ -84,13 +84,16 @@ export function ThreadReportEntry({ report }: { report: SignalReportApi }): JSX.
tokens start at 20px, and it lands just under a message avatar's 18px: small
enough to sit on the same rhythm, big enough to still read as the PostHog mark. */}
<Logomark variant="mono" color="primary" className="h-4 w-auto shrink-0" />
- <span className="text-sm font-medium">Self-driving</span>
+ {/* The name takes the AI colour, the same one the assistant's byline and notes wear
+ in this thread. "PostHog agent" stays muted: it qualifies the name rather than
+ repeating it. */}
+ <span className="text-sm font-medium text-ai">Self-driving</span>
<Tooltip title="A PostHog agent that investigates tickets against your codebase. Not a teammate.">
<span className="text-xs text-muted-alt">PostHog agent</span>
</Tooltip>
</div>
<div className="flex items-center gap-1.5 shrink-0">
- <TeamOnlyBadge label="Internal" />
+ <TeamOnlyBadge label="Internal" tone="agent" />
<span className="text-xs text-muted-alt">
<TZLabel time={report.updated_at} />
</span>
@@ -98,8 +101,10 @@ export function ThreadReportEntry({ report }: { report: SignalReportApi }): JSX.
</div>
{/* Not a bubble, and marked down its edge, so it never reads as something a person said.
The edge is a pseudo-element so it can run the full height without fighting the border
- radius the way a left border does. */}
- <div className="relative flex items-start justify-between gap-3 overflow-hidden rounded border border-primary bg-surface-primary transition-colors hover:border-secondary py-2 pl-4 pr-3 after:content-[''] after:absolute after:inset-y-0 after:left-0 after:w-1 after:bg-accent">
+ radius the way a left border does. It carries the AI colour, the same one the
+ assistant's own internal notes wear in this thread, so everything our software leaves
+ on a ticket reads as one voice — distinct from a teammate's amber note. */}
+ <div className="relative flex items-start justify-between gap-3 overflow-hidden rounded border border-primary bg-surface-primary transition-colors hover:border-secondary py-2 pl-4 pr-3 after:content-[''] after:absolute after:inset-y-0 after:left-0 after:w-1 after:bg-ai">
{/* The link takes the whole left column so the entry reads as one target, while the
state stays a sibling: an anchor can't contain another, and clicking the pull
request should open the pull request. */}