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(comments): add task kind with completion state (#57467)

Tue Haulund88edd5789b5c
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 0cca91d86300..cd54ea193475 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -848,10 +848,18 @@ snapshots:
hash: v1.k794b7964.d2eaad42c4d74ab148ba3075a6260d7aeda90562fbfdb49738afcc37fddacd73.DqxeQtB6IVGsvji5psBPT4qyAC-3MAkB4svhAvYak7w
components-playerinspector-itemcomment--annotation-comment--light:
hash: v1.k794b7964.0a40401aeeab8b030f049c50e5bd2f06e7214f3a3f54cf7ebb6ee833ab1e86d9.WFa_btlQmiN2RXRF54iREIGG55SZw-tglgfv-6zjXwM
+ components-playerinspector-itemcomment--completed-task-comment--dark:
+ hash: v1.k794b7964.8b468f06d21dfabb6e4d32fd256a9bf87e52350dfe8e49a596e7d9f59943888e.cLRjVufvLlBeZNvRMjKwUdQfryELRC7BZJJrDCDlaTY
+ components-playerinspector-itemcomment--completed-task-comment--light:
+ hash: v1.k794b7964.ab5ab66e9f71eee925e0c7944cd37c16a4d56cc6c310b68dcb637d9689a41f8d.3729KwyyfkFtq39lrQH3m33-BhEh7CN4-kqPR_-EaV8
components-playerinspector-itemcomment--notebook-comment--dark:
hash: v1.k794b7964.5fc859a363f3a918e931bf1952d7499058dd453b54a522ade4d7eb11807bd068.MYbqflkQ9moZYBdT8ZIBs8pfI49s-dU35gw_qGRuGds
components-playerinspector-itemcomment--notebook-comment--light:
hash: v1.k794b7964.3627e64b9a9b8d3235b914c45e5c18d338a7f76f4aadfececa3f6fd603b07ea0.9dRlJzLENNUKtE6UrSZB1vTargITdoO9sH-M8Tco9Y8
+ components-playerinspector-itemcomment--task-comment--dark:
+ hash: v1.k794b7964.8b468f06d21dfabb6e4d32fd256a9bf87e52350dfe8e49a596e7d9f59943888e.YrC-JPLiBQFApQ44aPLdAq7PtxtvlHg8k5vKL_0fWug
+ components-playerinspector-itemcomment--task-comment--light:
+ hash: v1.k794b7964.ab5ab66e9f71eee925e0c7944cd37c16a4d56cc6c310b68dcb637d9689a41f8d.Ijq_0XEoLkk2T8ibO3GOtYvemIuJTZFn3D5MGJB9Do8
components-playerinspector-itemconsole--app-state-item--dark:
hash: v1.k794b7964.678cf149664891abac2e8c126c15102722cdd290ab61619547d2d286afd8445a.DBT7DFnfiVKxOsPXWcsS2Abrlh7soVHvef5vItUimUw
components-playerinspector-itemconsole--app-state-item--light:
@@ -3895,13 +3903,17 @@ snapshots:
scenes-app-data-management-actions--screen-action--light:
hash: v1.k794b7964.d8bf73932b4afa31b9f38a86a55d96c1e4c12f6970168badd52faccbae7b890f.b6EHh73OZeepK8-PbH0_B-xwdwe_loNTxYBXcCb_95s
scenes-app-data-management-comments--comments--dark:
- hash: v1.k794b7964.4718fab57e9c454d3f9fec825cda6dd0ef9eb2e9e6fe3a61453df043dca2e251.BT46ByXB1FNK-bIuw2rzM81XA3V6pi4NzIkmW1nDPTw
+ hash: v1.k794b7964.81fcc362d31948514c45cdf715ec11fc51bf0694a8abf85c2e5b1321b32af4e2.5VTjHjgDNqGn6UzFZSr5OF2RalMbuxdBWV_bSF-GYrc
scenes-app-data-management-comments--comments--light:
- hash: v1.k794b7964.a90a254fb0fda5a4053b1b5d966a1dd5a52dbbad69d4a6bacdcc8d0dadf8422f.oXtSQ_Vv4RU1Eyw120Q_m-jF4c63rd5ck5ShCnQd3Ck
+ hash: v1.k794b7964.d1ecb9ecc72ed524adae75ddca19110c5f311e038c7359ffb180f5759c83cedc.aSGa-IDtzarceQZInAt35q-Cw4ChVJNySxEyjTHotOI
scenes-app-data-management-comments--long-content--dark:
- hash: v1.k794b7964.4dd3aa5aa87124df2bfd7b43ba0c918a3c822bcd13bd9ef0caf4258e028ede38.Fqcb1ozn9DqcPxCf9sUotPw9NOBxblWu5IjqzyLjVqs
+ hash: v1.k794b7964.de2a7d31407b309a91e5ecce6ee24e7e9741e8e2ba54a65cd04267e2b3f0aa20.vLswCp_m6lw3kvPpwVxwfYFItlEPVDln1jLNEt2IWA8
scenes-app-data-management-comments--long-content--light:
- hash: v1.k794b7964.4198d7931a0c423c93d1fd8f5024c23d923ef8b25e1e016f26adf24cb45750b9.N8kMJ6McV90YxBhB292YEU3XSIIUTPsZB4ZJyRPxGZM
+ hash: v1.k794b7964.a92306ea8b882e0b2915217a5f2c2ab1d60c7eaaa0975bee4059a950f956f4eb.Lq81_I_Rg6aMsA8FtOa9kpwo74j2Tk76RhbDmxH-xUM
+ scenes-app-data-management-comments--tasks--dark:
+ hash: v1.k794b7964.3b422c913873a6fdceebb2828b2fe356e74539c4a193133a419673fd2e952c05.g0gxv7yUQKFGufjG6Wk_m7i5FZbx7ZGC1lD9kSiCrpU
+ scenes-app-data-management-comments--tasks--light:
+ hash: v1.k794b7964.e15d8c406b7b96f6e0d0b636ee25d5d4bc45fbd1437d5ccdb490cb9771007472.uvAEGrGkBqUZjbN3pnoRgzUQ2_dHdQwtBFLmgk2QgmM
scenes-app-data-management-definition-view--event-definition-metadata--medium--dark:
hash: v1.k794b7964.c7b7d2c5f95c3ce99ecaeab9d9ed6e6d9499a98861b3ede5440393419c17f5cb.ueYV6XuLO_0K2pwfh4CJF2Y1rmtIOh1THmrrS_BXxpI
scenes-app-data-management-definition-view--event-definition-metadata--medium--light:
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 8b1eaa9e532f..9179e2e35697 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -2738,6 +2738,20 @@ const api = {
async delete(id: CommentType['id'], teamId: TeamType['id'] = ApiConfig.getCurrentTeamId()): Promise<void> {
return new ApiRequest().comment(id, teamId).update({ data: { deleted: true } })
},
+
+ async complete(
+ id: CommentType['id'],
+ teamId: TeamType['id'] = ApiConfig.getCurrentTeamId()
+ ): Promise<CommentType> {
+ return new ApiRequest().comment(id, teamId).withAction('complete').create()
+ },
+
+ async reopen(
+ id: CommentType['id'],
+ teamId: TeamType['id'] = ApiConfig.getCurrentTeamId()
+ ): Promise<CommentType> {
+ return new ApiRequest().comment(id, teamId).withAction('reopen').create()
+ },
},
logs: {
diff --git a/frontend/src/scenes/comments/Comment.tsx b/frontend/src/scenes/comments/Comment.tsx
index 8b8eb747f382..dd53ec318618 100644
--- a/frontend/src/scenes/comments/Comment.tsx
+++ b/frontend/src/scenes/comments/Comment.tsx
@@ -5,11 +5,12 @@ import { router } from 'kea-router'
import { useEffect, useRef } from 'react'
import { IconEllipsis, IconEye, IconPencil, IconShare, IconTrash } from '@posthog/icons'
-import { LemonButton, LemonMenu, ProfilePicture } from '@posthog/lemon-ui'
+import { LemonButton, LemonCheckbox, LemonMenu, LemonTag, ProfilePicture, Tooltip } from '@posthog/lemon-ui'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { EmojiPickerPopover } from 'lib/components/EmojiPicker/EmojiPickerPopover'
import { TZLabel } from 'lib/components/TZLabel'
+import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import {
DEFAULT_EXTENSIONS,
@@ -181,12 +182,19 @@ const CommentTopRow = ({ comment }: { comment: CommentType }): JSX.Element => {
const { disabledReasonFor } = useValues(commentsLogic)
const { deleteComment, setEditingComment, setReplyingComment } = useActions(commentsLogic)
+ const isCompleted = !!comment.completed_at
+
return (
<div className="flex items-center justify-between gap-2">
- <div>
+ <div className="flex items-center gap-2">
<span className="ph-no-capture flex-1 font-semibold">
{comment.created_by?.first_name ?? 'Unknown user'}
</span>
+ {comment.is_task ? (
+ <LemonTag size="small" type={isCompleted ? 'success' : 'warning'}>
+ {isCompleted ? 'Completed' : 'Task'}
+ </LemonTag>
+ ) : null}
</div>
<div className="flex items-center gap-1">
{comment.created_at ? (
@@ -224,7 +232,7 @@ const CommentTopRow = ({ comment }: { comment: CommentType }): JSX.Element => {
const Comment = ({ comment }: { comment: CommentType }): JSX.Element => {
const { editingComment, replyingCommentId, selectedCommentId, commentContexts } = useValues(commentsLogic)
- const { setSelectedComment } = useActions(commentsLogic)
+ const { setSelectedComment, completeComment, reopenComment } = useActions(commentsLogic)
const contextText = commentContexts[comment.id]
const isInlineComment = comment.item_context?.type === 'mark'
@@ -251,25 +259,51 @@ const Comment = ({ comment }: { comment: CommentType }): JSX.Element => {
data-comment-id={comment.id}
onClick={isEditing ? undefined : () => setSelectedComment(threadId)}
>
- <div className="flex flex-col justify-start gap-2">
- <div className="flex-1 flex justify-start gap-2">
- <ProfilePicture size="xl" user={comment.created_by} />
+ <div className="flex items-center gap-3">
+ {comment.is_task ? (
+ <>
+ <Tooltip
+ title={
+ comment.completed_at
+ ? `Completed by ${comment.completed_by?.first_name ?? 'Unknown user'}`
+ : 'Mark as complete'
+ }
+ >
+ <span className="flex items-center scale-125 ml-1">
+ <LemonCheckbox
+ checked={!!comment.completed_at}
+ onChange={() =>
+ comment.completed_at ? reopenComment(comment) : completeComment(comment)
+ }
+ data-attr="comment-task-checkbox"
+ />
+ </span>
+ </Tooltip>
+ <LemonDivider vertical className="self-stretch" />
+ </>
+ ) : null}
+ <div className="flex flex-col justify-start gap-2 flex-1 min-w-0">
+ <div className="flex-1 flex justify-start items-start gap-2">
+ <ProfilePicture size="xl" user={comment.created_by} />
- <div className="flex flex-col flex-1 min-w-0">
- <CommentTopRow comment={comment} />
- {contextText && !isEditing && isInlineComment && (
- <div className="border-l-2 border-border pl-2 my-2">
- <span className="block text-muted truncate text-sm">{contextText}</span>
- </div>
- )}
- {isEditing ? (
- <CommentEditingForm comment={comment} />
- ) : (
- <LemonMarkdown lowKeyHeadings>{getText(comment)}</LemonMarkdown>
- )}
+ <div className="flex flex-col flex-1 min-w-0">
+ <CommentTopRow comment={comment} />
+ {contextText && !isEditing && isInlineComment && (
+ <div className="border-l-2 border-border pl-2 my-2">
+ <span className="block text-muted truncate text-sm">{contextText}</span>
+ </div>
+ )}
+ {isEditing ? (
+ <CommentEditingForm comment={comment} />
+ ) : (
+ <div className={clsx(comment.completed_at && 'line-through text-secondary')}>
+ <LemonMarkdown lowKeyHeadings>{getText(comment)}</LemonMarkdown>
+ </div>
+ )}
+ </div>
</div>
+ {!isEditing && <CommentBottomRow comment={comment} />}
</div>
- {!isEditing && <CommentBottomRow comment={comment} />}
</div>
</div>
)
diff --git a/frontend/src/scenes/comments/CommentComposer.tsx b/frontend/src/scenes/comments/CommentComposer.tsx
index b17e9dc068f9..bc084735581b 100644
--- a/frontend/src/scenes/comments/CommentComposer.tsx
+++ b/frontend/src/scenes/comments/CommentComposer.tsx
@@ -38,7 +38,7 @@ export const CommentComposer = (props: CommentsLogicProps): JSX.Element => {
placeholder={placeholder}
onCreate={setRichContentEditor}
onUpdate={onRichContentEditorUpdate}
- onPressCmdEnter={sendComposedContent}
+ onPressCmdEnter={() => sendComposedContent(false)}
disabled={commentsLoading}
/>
<div className="flex justify-between items-center gap-2">
@@ -53,9 +53,19 @@ export const CommentComposer = (props: CommentsLogicProps): JSX.Element => {
Cancel
</LemonButton>
) : null}
+ {!replyingCommentId ? (
+ <LemonButton
+ type="secondary"
+ onClick={() => sendComposedContent(true)}
+ disabledReason={isEmpty ? 'No message' : null}
+ data-attr="discussions-comment-task"
+ >
+ Add as task
+ </LemonButton>
+ ) : null}
<LemonButton
type="primary"
- onClick={sendComposedContent}
+ onClick={() => sendComposedContent(false)}
disabledReason={isEmpty ? 'No message' : null}
sideIcon={<KeyboardShortcut command enter />}
data-attr="discussions-comment"
diff --git a/frontend/src/scenes/comments/commentsLogic.ts b/frontend/src/scenes/comments/commentsLogic.ts
index 100edddd1394..82b54c925ebf 100644
--- a/frontend/src/scenes/comments/commentsLogic.ts
+++ b/frontend/src/scenes/comments/commentsLogic.ts
@@ -64,12 +64,14 @@ export const commentsLogic = kea<commentsLogicType>([
focusComposer: true,
clearItemContext: true,
maybeLoadComments: true,
- sendComposedContent: true,
+ sendComposedContent: (asTask: boolean = false) => ({ asTask }),
persistEditedComment: true,
onRichContentEditorUpdate: (isEmpty: boolean) => ({ isEmpty }),
onEditingCommentRichContentEditorUpdate: (isEmpty: boolean) => ({ isEmpty }),
sendEmojiReaction: (emoji: string, sourceCommentId: string) => ({ emoji, sourceCommentId }),
deleteComment: (comment: CommentType) => ({ comment }),
+ completeComment: (comment: CommentType) => ({ comment }),
+ reopenComment: (comment: CommentType) => ({ comment }),
setEditingComment: (comment: CommentType | null) => ({ comment }),
setReplyingComment: (commentId: string | null) => ({ commentId }),
setSelectedComment: (commentId: string | null) => ({ commentId }),
@@ -163,7 +165,7 @@ export const commentsLogic = kea<commentsLogicType>([
return response.results
},
- sendComposedContent: async () => {
+ sendComposedContent: async ({ asTask }) => {
const existingComments = values.comments ?? []
if (values.richContentEditor?.isEmpty()) {
@@ -189,6 +191,8 @@ export const commentsLogic = kea<commentsLogicType>([
const isNewAnchoredThread =
composerAnchor && (composerAnchor.type === 'mark' || composerAnchor.type === 'node')
+ const isReply = !isNewAnchoredThread && !!values.replyingCommentId
+
const newComment = await api.comments.create({
rich_content: content,
content: textContent,
@@ -198,6 +202,7 @@ export const commentsLogic = kea<commentsLogicType>([
source_comment: isNewAnchoredThread ? undefined : (values.replyingCommentId ?? undefined),
mentions,
slug: discussionsSlug(props.scope, props.item_id),
+ is_task: asTask && !isReply,
})
values.itemContext?.callback?.({ sent: true })
@@ -268,6 +273,18 @@ export const commentsLogic = kea<commentsLogicType>([
return [...existingComments, newComment]
},
+
+ completeComment: async ({ comment }) => {
+ const updated = await api.comments.complete(comment.id)
+ const existing = values.comments ?? []
+ return existing.map((c) => (c.id === updated.id ? updated : c))
+ },
+
+ reopenComment: async ({ comment }) => {
+ const updated = await api.comments.reopen(comment.id)
+ const existing = values.comments ?? []
+ return existing.map((c) => (c.id === updated.id ? updated : c))
+ },
},
],
})),
diff --git a/frontend/src/scenes/data-management/comments/Comments.stories.tsx b/frontend/src/scenes/data-management/comments/Comments.stories.tsx
index 8ce0e1660fcc..17854fd7d050 100644
--- a/frontend/src/scenes/data-management/comments/Comments.stories.tsx
+++ b/frontend/src/scenes/data-management/comments/Comments.stories.tsx
@@ -6,6 +6,7 @@ import { urls } from 'scenes/urls'
import { mswDecorator } from '~/mocks/browser'
import commentsLongJson from './__mocks__/comments-long.json'
+import commentsTasksJson from './__mocks__/comments-tasks.json'
import commentsJson from './__mocks__/comments.json'
const meta: Meta = {
@@ -39,3 +40,13 @@ export const LongContent: Story = {
}),
],
}
+
+export const Tasks: Story = {
+ decorators: [
+ mswDecorator({
+ get: {
+ '/api/projects/:team_id/comments/': commentsTasksJson,
+ },
+ }),
+ ],
+}
diff --git a/frontend/src/scenes/data-management/comments/Comments.tsx b/frontend/src/scenes/data-management/comments/Comments.tsx
index 0d141f2928f9..f6d02487d4e1 100644
--- a/frontend/src/scenes/data-management/comments/Comments.tsx
+++ b/frontend/src/scenes/data-management/comments/Comments.tsx
@@ -1,8 +1,9 @@
+import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { useEffect } from 'react'
import { IconTrash } from '@posthog/icons'
-import { LemonButton, LemonInput, LemonSelect } from '@posthog/lemon-ui'
+import { LemonButton, LemonCheckbox, LemonInput, LemonSelect, Tooltip } from '@posthog/lemon-ui'
import { MicrophoneHog } from 'lib/components/hedgehogs'
import { MemberSelect } from 'lib/components/MemberSelect'
@@ -25,13 +26,43 @@ import { CommentType } from '~/types'
import { SCOPE_OPTIONS, commentsLogic, openURLFor } from './commentsLogic'
+const KIND_OPTIONS = [
+ { value: 'any', label: 'Any' },
+ { value: 'comment', label: 'Comments' },
+ { value: 'task', label: 'Tasks' },
+] as const
+
+const COMPLETED_OPTIONS = [
+ { value: 'any', label: 'Any' },
+ { value: 'open', label: 'Open' },
+ { value: 'completed', label: 'Completed' },
+] as const
+
export function Comments(): JSX.Element {
const { user } = useValues(userLogic)
- const { comments, shouldShowEmptyState, commentsLoading, scope, filterCreatedBy, searchText } =
- useValues(commentsLogic)
+ const {
+ comments,
+ shouldShowEmptyState,
+ commentsLoading,
+ scope,
+ filterCreatedBy,
+ searchText,
+ kind,
+ completedFilter,
+ } = useValues(commentsLogic)
- const { setScope, setFilterCreatedBy, setSearchText, deleteComment, loadComments } = useActions(commentsLogic)
+ const {
+ setScope,
+ setFilterCreatedBy,
+ setSearchText,
+ setKind,
+ setCompletedFilter,
+ deleteComment,
+ completeComment,
+ reopenComment,
+ loadComments,
+ } = useActions(commentsLogic)
useEffect(() => {
loadComments()
@@ -43,12 +74,30 @@ export function Comments(): JSX.Element {
key: 'content',
width: '45%',
render: function RenderComment(_, comment: CommentType): JSX.Element {
+ const isCompleted = !!comment.completed_at
+ const completionTooltip = isCompleted
+ ? `Completed by ${comment.completed_by?.first_name ?? 'Unknown user'}`
+ : 'Mark as complete'
return (
- <div
- className="whitespace-pre-wrap break-words max-h-64 overflow-y-auto"
- data-attr="comment-scene-comment-title-rendered-content"
- >
- {getText(comment)}
+ <div className="flex items-center gap-2">
+ {comment.is_task ? (
+ <Tooltip title={completionTooltip}>
+ <LemonCheckbox
+ checked={isCompleted}
+ onChange={() => (isCompleted ? reopenComment(comment) : completeComment(comment))}
+ data-attr="comment-task-checkbox"
+ />
+ </Tooltip>
+ ) : null}
+ <div
+ className={clsx(
+ 'whitespace-pre-wrap break-words max-h-64 overflow-y-auto min-w-0 flex-1',
+ isCompleted && 'line-through text-secondary'
+ )}
+ data-attr="comment-scene-comment-title-rendered-content"
+ >
+ {getText(comment)}
+ </div>
</div>
)
},
@@ -61,6 +110,13 @@ export function Comments(): JSX.Element {
},
sorter: (a, b) => dayjs(a.created_at).diff(dayjs(b.created_at)),
},
+ {
+ title: 'Kind',
+ key: 'kind',
+ render: function RenderKind(_, comment: CommentType): JSX.Element {
+ return <span>{comment.is_task ? 'Task' : 'Comment'}</span>
+ },
+ },
{
title: 'Scope',
key: 'scope',
@@ -139,6 +195,23 @@ export function Comments(): JSX.Element {
<div>
<div className="flex flex-row items-center gap-4 flex-wrap">
+ <div className="flex flex-row items-center gap-2">
+ <div>Kind:</div>
+ <LemonSelect options={[...KIND_OPTIONS]} value={kind} onSelect={setKind} size="small" />
+ </div>
+
+ {kind === 'task' ? (
+ <div className="flex flex-row items-center gap-2">
+ <div>Status:</div>
+ <LemonSelect
+ options={[...COMPLETED_OPTIONS]}
+ value={completedFilter}
+ onSelect={setCompletedFilter}
+ size="small"
+ />
+ </div>
+ ) : null}
+
<div className="flex flex-row items-center gap-2">
<div>Scope:</div>
<LemonSelect options={SCOPE_OPTIONS} value={scope} onSelect={setScope} size="small" />
diff --git a/frontend/src/scenes/data-management/comments/__mocks__/comments-tasks.json b/frontend/src/scenes/data-management/comments/__mocks__/comments-tasks.json
new file mode 100644
index 000000000000..e83dd3d6d3ce
--- /dev/null
+++ b/frontend/src/scenes/data-management/comments/__mocks__/comments-tasks.json
@@ -0,0 +1,98 @@
+{
+ "next": null,
+ "previous": null,
+ "results": [
+ {
+ "id": "01984695-c93f-0000-a115-d4fa40b8a100",
+ "created_by": {
+ "id": 1,
+ "uuid": "019838c5-64ac-0000-9f43-17f1bf64f508",
+ "distinct_id": "abc",
+ "first_name": "Ric",
+ "last_name": "",
+ "email": "[email protected]",
+ "is_email_verified": false,
+ "hedgehog_config": null,
+ "role_at_organization": "other"
+ },
+ "deleted": false,
+ "content": "Empty state copy reads weird here — needs a rewrite.",
+ "rich_content": null,
+ "version": 0,
+ "created_at": "2026-04-18T11:54:38.276511Z",
+ "item_id": "019da00c-489a-763b-a27a-b7b8bfb4abc5",
+ "item_context": {
+ "time_in_recording": "2026-04-18T11:25:32.000Z"
+ },
+ "scope": "Replay",
+ "source_comment": null,
+ "is_task": true,
+ "completed_at": null,
+ "completed_by": null
+ },
+ {
+ "id": "01984695-c93f-0000-a115-d4fa40b8a101",
+ "created_by": {
+ "id": 1,
+ "uuid": "019838c5-64ac-0000-9f43-17f1bf64f508",
+ "distinct_id": "abc",
+ "first_name": "Ric",
+ "last_name": "",
+ "email": "[email protected]",
+ "is_email_verified": false,
+ "hedgehog_config": null,
+ "role_at_organization": "other"
+ },
+ "deleted": false,
+ "content": "Submit button doesn't show loading state on slow networks.",
+ "rich_content": null,
+ "version": 0,
+ "created_at": "2026-04-17T09:12:00.000Z",
+ "item_id": "019d9912-aaaa-bbbb-cccc-ddddeeeeffff",
+ "item_context": {
+ "time_in_recording": "2026-04-17T09:14:08.000Z"
+ },
+ "scope": "Replay",
+ "source_comment": null,
+ "is_task": true,
+ "completed_at": "2026-04-19T15:00:00.000Z",
+ "completed_by": {
+ "id": 1,
+ "uuid": "019838c5-64ac-0000-9f43-17f1bf64f508",
+ "distinct_id": "abc",
+ "first_name": "Ric",
+ "last_name": "",
+ "email": "[email protected]",
+ "is_email_verified": false,
+ "hedgehog_config": null,
+ "role_at_organization": "other"
+ }
+ },
+ {
+ "id": "01984695-c93f-0000-a115-d4fa40b8a102",
+ "created_by": {
+ "id": 1,
+ "uuid": "019838c5-64ac-0000-9f43-17f1bf64f508",
+ "distinct_id": "abc",
+ "first_name": "Ric",
+ "last_name": "",
+ "email": "[email protected]",
+ "is_email_verified": false,
+ "hedgehog_config": null,
+ "role_at_organization": "other"
+ },
+ "deleted": false,
+ "content": "Looks good, ship it.",
+ "rich_content": null,
+ "version": 0,
+ "created_at": "2026-04-15T10:00:00.000Z",
+ "item_id": "6",
+ "item_context": null,
+ "scope": "Insight",
+ "source_comment": null,
+ "is_task": false,
+ "completed_at": null,
+ "completed_by": null
+ }
+ ]
+}
diff --git a/frontend/src/scenes/data-management/comments/commentsLogic.ts b/frontend/src/scenes/data-management/comments/commentsLogic.ts
index 87fd3b0f4d02..25c8bc5902e1 100644
--- a/frontend/src/scenes/data-management/comments/commentsLogic.ts
+++ b/frontend/src/scenes/data-management/comments/commentsLogic.ts
@@ -72,6 +72,9 @@ export const openURLFor = (c: CommentType): string | null => {
return commentURL ? `${commentURL}#panel=discussion` : null
}
+export type CommentKindFilter = 'any' | 'comment' | 'task'
+export type CommentCompletedFilter = 'any' | 'open' | 'completed'
+
export const commentsLogic = kea<commentsLogicType>([
path(['scenes', 'data-management', 'comments', 'commentsLogic']),
connect(() => ({
@@ -81,7 +84,11 @@ export const commentsLogic = kea<commentsLogicType>([
setScope: (scope: ActivityScope | null) => ({ scope }),
setFilterCreatedBy: (createdBy: string | null) => ({ createdBy }),
setSearchText: (searchText: string) => ({ searchText }),
+ setKind: (kind: CommentKindFilter) => ({ kind }),
+ setCompletedFilter: (completed: CommentCompletedFilter) => ({ completed }),
deleteComment: (id: string) => ({ id }),
+ completeComment: (comment: CommentType) => ({ comment }),
+ reopenComment: (comment: CommentType) => ({ comment }),
loadComments: true,
}),
loaders(({ values }) => ({
@@ -104,6 +111,14 @@ export const commentsLogic = kea<commentsLogicType>([
params.search = values.searchText.trim()
}
+ if (values.kind !== 'any') {
+ params.kind = values.kind
+ }
+
+ if (values.completedFilter !== 'any') {
+ params.completed = values.completedFilter
+ }
+
const response = await api.comments.list(params)
breakpoint()
return response.results || []
@@ -113,6 +128,14 @@ export const commentsLogic = kea<commentsLogicType>([
await api.comments.delete(id)
return values.comments.filter((c) => c.id !== id)
},
+ completeComment: async ({ comment }: { comment: CommentType }) => {
+ const updated = await api.comments.complete(comment.id)
+ return values.comments.map((c) => (c.id === updated.id ? updated : c))
+ },
+ reopenComment: async ({ comment }: { comment: CommentType }) => {
+ const updated = await api.comments.reopen(comment.id)
+ return values.comments.map((c) => (c.id === updated.id ? updated : c))
+ },
},
],
})),
@@ -120,12 +143,21 @@ export const commentsLogic = kea<commentsLogicType>([
scope: [null as ActivityScope | null, { setScope: (_, { scope }) => scope }],
filterCreatedBy: [null as string | null, { setFilterCreatedBy: (_, { createdBy }) => createdBy }],
searchText: ['', { setSearchText: (_, { searchText }) => searchText }],
+ kind: ['any' as CommentKindFilter, { setKind: (_, { kind }) => kind }],
+ completedFilter: [
+ 'any' as CommentCompletedFilter,
+ {
+ setCompletedFilter: (_, { completed }) => completed,
+ // The Status select hides when Kind isn't 'task'; reset so it can't keep filtering.
+ setKind: (state, { kind }) => (kind === 'task' ? state : 'any'),
+ },
+ ],
})),
selectors(() => ({
hasAnySearch: [
- (s) => [s.searchText, s.scope, s.filterCreatedBy],
- (searchText, scope, filterCreatedBy) => {
- return !!searchText || !!scope || !!filterCreatedBy
+ (s) => [s.searchText, s.scope, s.filterCreatedBy, s.kind, s.completedFilter],
+ (searchText, scope, filterCreatedBy, kind, completedFilter) => {
+ return !!searchText || !!scope || !!filterCreatedBy || kind !== 'any' || completedFilter !== 'any'
},
],
shouldShowEmptyState: [
@@ -139,6 +171,8 @@ export const commentsLogic = kea<commentsLogicType>([
setScope: actions.loadComments,
setFilterCreatedBy: actions.loadComments,
setSearchText: actions.loadComments,
+ setKind: actions.loadComments,
+ setCompletedFilter: actions.loadComments,
deleteCommentSuccess: () => {
lemonToast.success('Comment deleted')
},
@@ -146,5 +180,16 @@ export const commentsLogic = kea<commentsLogicType>([
posthog.captureException(e, { action: 'data management scene deleting comment' })
lemonToast.error('Could not delete comment, refresh and try again')
},
+ completeCommentFailure: (e) => {
+ posthog.captureException(e, { action: 'data management scene completing comment' })
+ lemonToast.error('Could not mark task complete, refresh and try again')
+ },
+ reopenCommentFailure: (e) => {
+ posthog.captureException(e, { action: 'data management scene reopening comment' })
+ lemonToast.error('Could not reopen task, refresh and try again')
+ },
+ // Re-fetch so the active Kind/Status filter drops any rows that no longer match.
+ completeCommentSuccess: actions.loadComments,
+ reopenCommentSuccess: actions.loadComments,
})),
])
diff --git a/frontend/src/scenes/session-recordings/player/commenting/PlayerFrameCommentOverlay.tsx b/frontend/src/scenes/session-recordings/player/commenting/PlayerFrameCommentOverlay.tsx
index d95161383405..a27498cc4214 100644
--- a/frontend/src/scenes/session-recordings/player/commenting/PlayerFrameCommentOverlay.tsx
+++ b/frontend/src/scenes/session-recordings/player/commenting/PlayerFrameCommentOverlay.tsx
@@ -22,8 +22,9 @@ export const PlayerCommentModal = (): JSX.Element => {
const playerCommentOverlayLogicProps = { recordingId: sessionRecordingId, ...logicProps }
const theBuiltOverlayLogic = playerCommentOverlayLogic(playerCommentOverlayLogicProps)
const { recordingComment, isRecordingCommentSubmitting, richContentEditor } = useValues(theBuiltOverlayLogic)
- const { submitRecordingComment, resetRecordingComment, setRichContentEditor, setRichContent } =
+ const { submitRecordingComment, resetRecordingComment, setRichContentEditor, setRichContent, setAsTask } =
useActions(theBuiltOverlayLogic)
+ const isEditing = !!recordingComment.commentId
return (
<div className="absolute bottom-4 left-4 z-20 w-90">
@@ -78,16 +79,35 @@ export const PlayerCommentModal = (): JSX.Element => {
>
Cancel
</LemonButton>
- <LemonButton
- form="recording-comment-form"
- type="primary"
- onClick={submitRecordingComment}
- data-attr="create-recording-comment-submit"
- size="small"
- loading={isRecordingCommentSubmitting}
- >
- {recordingComment.commentId ? 'Update' : 'Save'}
- </LemonButton>
+ <div className="flex gap-2">
+ {!isEditing && (
+ <LemonButton
+ type="secondary"
+ onClick={() => {
+ setAsTask(true)
+ submitRecordingComment()
+ }}
+ data-attr="create-recording-comment-task-submit"
+ size="small"
+ loading={isRecordingCommentSubmitting}
+ >
+ Add as task
+ </LemonButton>
+ )}
+ <LemonButton
+ form="recording-comment-form"
+ type="primary"
+ onClick={() => {
+ setAsTask(false)
+ submitRecordingComment()
+ }}
+ data-attr="create-recording-comment-submit"
+ size="small"
+ loading={isRecordingCommentSubmitting}
+ >
+ {isEditing ? 'Update' : 'Save'}
+ </LemonButton>
+ </div>
</div>
</Form>
</div>
diff --git a/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts b/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts
index 25f0ee2305bf..6337045a2371 100644
--- a/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/commenting/playerFrameCommentOverlayLogic.ts
@@ -46,6 +46,7 @@ export const playerCommentOverlayLogic = kea<playerCommentOverlayLogicType>([
addEmojiComment: (emoji: string) => ({ emoji }),
setLoading: (isLoading: boolean) => ({ isLoading }),
setRichContent: (richContent: JSONContent | null) => ({ richContent }),
+ setAsTask: (asTask: boolean) => ({ asTask }),
// copied from comments logic
setRichContentEditor: (editor: RichContentEditorType) => ({ editor }),
onRichContentEditorUpdate: (isEmpty: boolean) => ({ isEmpty }),
@@ -57,6 +58,12 @@ export const playerCommentOverlayLogic = kea<playerCommentOverlayLogicType>([
setLoading: (_, { isLoading }: { isLoading: boolean }) => isLoading,
},
],
+ asTask: [
+ false as boolean,
+ {
+ setAsTask: (_, { asTask }) => asTask,
+ },
+ ],
// copied from comments logic
isEmpty: [
@@ -120,6 +127,8 @@ export const playerCommentOverlayLogic = kea<playerCommentOverlayLogicType>([
setIsCommenting: ({ isCommenting }) => {
if (!isCommenting) {
actions.resetRecordingComment()
+ // Don't let "Add as task" leak into the next overlay session.
+ actions.setAsTask(false)
}
},
addEmojiComment: async ({ emoji }) => {
@@ -192,11 +201,12 @@ export const playerCommentOverlayLogic = kea<playerCommentOverlayLogicType>([
if (commentId) {
await api.comments.update(commentId, apiPayload)
} else {
- await api.comments.create(apiPayload)
+ await api.comments.create({ ...apiPayload, is_task: values.asTask })
}
playerCommentModel.actions.commentEdited(props.recordingId)
actions.resetRecordingComment()
+ actions.setAsTask(false)
actions.setIsCommenting(false)
},
},
diff --git a/frontend/src/scenes/session-recordings/player/inspector/components/ItemComment.stories.tsx b/frontend/src/scenes/session-recordings/player/inspector/components/ItemComment.stories.tsx
index 332123bf51ee..e1482826af8c 100644
--- a/frontend/src/scenes/session-recordings/player/inspector/components/ItemComment.stories.tsx
+++ b/frontend/src/scenes/session-recordings/player/inspector/components/ItemComment.stories.tsx
@@ -129,6 +129,9 @@ function makeCommentItem(
is_email_verified: false,
},
+ is_task: false,
+ completed_at: null,
+ completed_by: null,
...dataOverrides,
},
timeInRecording: 0,
@@ -152,3 +155,31 @@ export const AnnotationComment: Story = {
item: makeCommentItem(),
},
}
+
+export const TaskComment: Story = {
+ args: {
+ item: makeCommentItem({}, { is_task: true, content: 'fix the empty-state copy' }),
+ },
+}
+
+export const CompletedTaskComment: Story = {
+ args: {
+ item: makeCommentItem(
+ {},
+ {
+ is_task: true,
+ content: 'fix the empty-state copy',
+ completed_at: '2026-04-19T15:00:00.000Z',
+ completed_by: {
+ id: 1,
+ uuid: '0196b443-26f4-0000-5d24-b982365fe43d',
+ distinct_id: 'BpwPZw8BGaeISf7DlDprsui5J9DMIYjhE3fTFMJiEMF',
+ first_name: 'Ric',
+ last_name: '',
+ email: '[email protected]',
+ is_email_verified: false,
+ },
+ }
+ ),
+ },
+}
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 776b79e4cb55..4d86b360f035 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -5551,6 +5551,9 @@ export type CommentType = {
item_context: Record<string, any> | null
/** only on the type to support patching for soft delete */
deleted?: boolean
+ is_task: boolean
+ completed_at: string | null
+ completed_by: UserBasicType | null
}
export type CommentCreationParams = { mentions?: number[]; slug?: string }
diff --git a/posthog/api/comments.py b/posthog/api/comments.py
index a019da3a0c4d..d90796601a1e 100644
--- a/posthog/api/comments.py
+++ b/posthog/api/comments.py
@@ -2,6 +2,7 @@ from typing import Any, cast
from django.db import transaction
from django.db.models import Q, QuerySet
+from django.utils import timezone
from drf_spectacular.utils import extend_schema
from rest_framework import exceptions, pagination, serializers, viewsets
@@ -13,7 +14,10 @@ from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.api.shared import UserBasicSerializer
from posthog.api.utils import ClassicBehaviorBooleanFieldSerializer, action
from posthog.models import User
+from posthog.models.activity_logging.activity_log import Change, Detail, log_activity
+from posthog.models.activity_logging.model_activity import get_was_impersonated
from posthog.models.comment import Comment
+from posthog.models.comment.comment import activity_log_scope_for
from posthog.models.comment.utils import produce_discussion_mention_events, send_mention_notifications
from posthog.tasks.email import send_discussions_mentioned
@@ -45,11 +49,40 @@ class CommentSerializer(serializers.ModelSerializer):
deleted = ClassicBehaviorBooleanFieldSerializer()
mentions = serializers.ListField(child=serializers.IntegerField(), write_only=True, required=False)
slug = serializers.CharField(write_only=True, required=False)
+ is_task = serializers.BooleanField(
+ default=False,
+ required=False,
+ help_text=(
+ "Whether this comment is an actionable task that can be marked complete. "
+ "Tasks render with a checkbox in the UI and can be filtered as a separate kind. "
+ "Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation."
+ ),
+ )
+ completed_by = UserBasicSerializer(
+ read_only=True,
+ allow_null=True,
+ help_text="The user who marked this task complete. Null for open tasks and non-task comments.",
+ )
class Meta:
model = Comment
exclude = ["team"]
- read_only_fields = ["id", "created_by", "version"]
+ read_only_fields = ["id", "created_by", "version", "completed_at", "completed_by"]
+ extra_kwargs = {
+ "completed_at": {
+ "help_text": (
+ "ISO timestamp when the task was marked complete. Only meaningful when is_task is true. "
+ "Read-only — toggled via the /complete and /reopen actions, not via PATCH."
+ ),
+ },
+ }
+
+ def to_representation(self, instance):
+ data = super().to_representation(instance)
+ # Coerce legacy null is_task rows to False so the contract stays non-null.
+ if data.get("is_task") is None:
+ data["is_task"] = False
+ return data
def has_empty_paragraph(self, doc):
for node in doc.get("content", []):
@@ -66,6 +99,8 @@ class CommentSerializer(serializers.ModelSerializer):
if instance:
if instance.created_by != request.user:
raise exceptions.PermissionDenied("You can only modify your own comments")
+ if "is_task" in data and bool(data["is_task"]) != bool(instance.is_task):
+ raise exceptions.ValidationError({"is_task": "Cannot change task state after creation."})
# Skip content validation when soft-deleting a comment
is_deleting = data.get("deleted") is True
@@ -78,6 +113,12 @@ class CommentSerializer(serializers.ModelSerializer):
if not instance:
data["created_by"] = request.user
+ if data.get("is_task"):
+ if data.get("source_comment"):
+ raise exceptions.ValidationError({"is_task": "Replies cannot be tasks."})
+ item_context = data.get("item_context") or {}
+ if item_context.get("is_emoji"):
+ raise exceptions.ValidationError({"is_task": "Emoji reactions cannot be tasks."})
return data
@@ -156,6 +197,22 @@ class CommentListQueryParamsSerializer(serializers.Serializer):
item_id = serializers.CharField(required=False, help_text="Filter by the ID of the resource being commented on.")
search = serializers.CharField(required=False, help_text="Full-text search within comment content.")
source_comment = serializers.CharField(required=False, help_text="Filter replies to a specific parent comment.")
+ kind = serializers.ChoiceField(
+ required=False,
+ choices=["any", "comment", "task"],
+ help_text=(
+ "Filter by comment kind. 'task' returns only items intentionally created as actionable. "
+ "'comment' excludes tasks. Defaults to 'any' (no filter)."
+ ),
+ )
+ completed = serializers.ChoiceField(
+ required=False,
+ choices=["any", "open", "completed"],
+ help_text=(
+ "When kind=task, restrict to open (incomplete) or completed tasks. "
+ "Ignored when kind is not 'task'. Defaults to 'any' (no filter)."
+ ),
+ )
@extend_schema(tags=["core", "platform_features"])
@@ -197,6 +254,20 @@ class CommentViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.ModelV
Q(item_context__isnull=True) | ~Q(item_context__has_key="is_emoji") | Q(item_context__is_emoji=False)
)
+ kind = params.get("kind")
+ if kind == "task":
+ queryset = queryset.filter(is_task=True)
+ elif kind == "comment":
+ # Pre-migration rows have is_task=NULL; count them as comments.
+ queryset = queryset.filter(Q(is_task=False) | Q(is_task__isnull=True))
+
+ if kind == "task":
+ completed = params.get("completed")
+ if completed == "open":
+ queryset = queryset.filter(completed_at__isnull=True)
+ elif completed == "completed":
+ queryset = queryset.filter(completed_at__isnull=False)
+
source_comment = params.get("source_comment")
if self.action == "thread":
source_comment = self.kwargs.get("pk")
@@ -216,3 +287,70 @@ class CommentViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.ModelV
count = queryset.count()
return Response({"count": count})
+
+ @extend_schema(
+ request=None,
+ responses=CommentSerializer,
+ description="Mark a task-comment as complete. Sets completed_at and completed_by. "
+ "400 if the comment is not a task or is already complete.",
+ )
+ @action(methods=["POST"], detail=True)
+ def complete(self, request: Request, *args: Any, **kwargs: Any) -> Response:
+ comment = self.get_object()
+ if not comment.is_task:
+ raise exceptions.ValidationError("Only tasks can be marked complete")
+ with transaction.atomic():
+ comment = Comment.objects.select_for_update().get(pk=comment.pk)
+ if comment.completed_at is not None:
+ raise exceptions.ValidationError("Task is already complete")
+ comment.completed_at = timezone.now()
+ comment.completed_by = cast(User, request.user)
+ comment.save(update_fields=["completed_at", "completed_by"])
+ self._log_task_state_change(comment, request, completed=True)
+ serializer = CommentSerializer(comment, context=self.get_serializer_context())
+ return Response(serializer.data)
+
+ @extend_schema(
+ request=None,
+ responses=CommentSerializer,
+ description="Reopen a completed task-comment. Clears completed_at and completed_by. "
+ "400 if the comment is not a task or is already open.",
+ )
+ @action(methods=["POST"], detail=True)
+ def reopen(self, request: Request, *args: Any, **kwargs: Any) -> Response:
+ comment = self.get_object()
+ if not comment.is_task:
+ raise exceptions.ValidationError("Only tasks can be reopened")
+ with transaction.atomic():
+ comment = Comment.objects.select_for_update().get(pk=comment.pk)
+ if comment.completed_at is None:
+ raise exceptions.ValidationError("Task is already open")
+ comment.completed_at = None
+ comment.completed_by = None
+ comment.save(update_fields=["completed_at", "completed_by"])
+ self._log_task_state_change(comment, request, completed=False)
+ serializer = CommentSerializer(comment, context=self.get_serializer_context())
+ return Response(serializer.data)
+
+ @staticmethod
+ def _log_task_state_change(comment: Comment, request: Request, *, completed: bool) -> None:
+ log_activity(
+ organization_id=None,
+ team_id=comment.team_id,
+ user=cast(User, request.user),
+ was_impersonated=get_was_impersonated(),
+ item_id=cast(str, comment.source_comment_id) or comment.item_id,
+ scope=activity_log_scope_for(comment),
+ activity="completed task" if completed else "reopened task",
+ detail=Detail(
+ changes=[
+ Change(
+ type="Comment",
+ field="completed_at",
+ action="changed",
+ before=None if completed else "completed",
+ after="completed" if completed else None,
+ )
+ ],
+ ),
+ )
diff --git a/posthog/api/test/test_comments.py b/posthog/api/test/test_comments.py
index ae47cda8a109..bd0cfad74c5d 100644
--- a/posthog/api/test/test_comments.py
+++ b/posthog/api/test/test_comments.py
@@ -8,6 +8,8 @@ from django.conf import settings
from parameterized import parameterized
from rest_framework import status
+from posthog.models.activity_logging.activity_log import ActivityLog
+from posthog.models.comment import Comment
from posthog.models.comment.utils import build_comment_item_url, extract_plain_text_from_rich_content
@@ -64,6 +66,9 @@ class TestComments(APIBaseTest, QueryMatchingTest):
"item_context": None,
"scope": "Notebook",
"source_comment": None,
+ "is_task": False,
+ "completed_at": None,
+ "completed_by": None,
}
def test_updates_content_and_increments_version(self) -> None:
@@ -92,6 +97,9 @@ class TestComments(APIBaseTest, QueryMatchingTest):
"item_context": None,
"scope": "Notebook",
"source_comment": None,
+ "is_task": False,
+ "completed_at": None,
+ "completed_by": None,
}
def test_empty_comments_list(self) -> None:
@@ -757,3 +765,195 @@ class TestCommentHelperFunctions(APIBaseTest):
def test_extract_plain_text_from_rich_content(self, name: str, rich_content: dict | None, expected: str) -> None:
result = extract_plain_text_from_rich_content(rich_content)
assert result == expected
+
+
+class TestCommentTasks(APIBaseTest, QueryMatchingTest):
+ def _create_task(self, data: dict | None = None) -> Any:
+ payload = {"content": "fix the empty-state copy", "scope": "Replay", "is_task": True}
+ if data:
+ payload.update(data)
+ return self.client.post(f"/api/projects/{self.team.id}/comments", payload).json()
+
+ def test_creates_task_successfully(self) -> None:
+ response = self._create_task()
+ assert response["is_task"] is True
+ assert response["completed_at"] is None
+ assert response["completed_by"] is None
+
+ def test_default_is_task_is_false(self) -> None:
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/comments",
+ {"content": "regular comment", "scope": "Notebook"},
+ ).json()
+ assert response["is_task"] is False
+
+ @parameterized.expand(
+ [
+ (
+ "reply_cannot_be_task",
+ lambda self: {
+ "content": "reply",
+ "scope": "Replay",
+ "is_task": True,
+ "source_comment": self._create_task()["id"],
+ },
+ "Replies cannot be tasks.",
+ ),
+ (
+ "emoji_reaction_cannot_be_task",
+ lambda _self: {
+ "content": "👍",
+ "scope": "Replay",
+ "is_task": True,
+ "item_context": {"is_emoji": True},
+ },
+ "Emoji reactions cannot be tasks.",
+ ),
+ ]
+ )
+ def test_invalid_task_creation(self, _name: str, payload_fn: Any, expected_detail: str) -> None:
+ payload = payload_fn(self)
+ response = self.client.post(f"/api/projects/{self.team.id}/comments", payload, format="json")
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json()["detail"] == expected_detail
+
+ def test_is_task_immutable_after_creation(self) -> None:
+ task = self._create_task()
+
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/comments/{task['id']}",
+ {"is_task": False},
+ )
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert response.json()["detail"] == "Cannot change task state after creation."
+
+ # Same value is a no-op and should be accepted
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/comments/{task['id']}",
+ {"is_task": True, "content": "edited"},
+ )
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["is_task"] is True
+
+ def test_complete_and_reopen_roundtrip(self) -> None:
+ task = self._create_task()
+
+ complete_response = self.client.post(f"/api/projects/{self.team.id}/comments/{task['id']}/complete")
+ assert complete_response.status_code == status.HTTP_200_OK
+ assert complete_response.json()["completed_at"] is not None
+ assert complete_response.json()["completed_by"]["id"] == self.user.id
+
+ # Already complete -> 400
+ repeat = self.client.post(f"/api/projects/{self.team.id}/comments/{task['id']}/complete")
+ assert repeat.status_code == status.HTTP_400_BAD_REQUEST
+ assert repeat.json()["detail"] == "Task is already complete"
+
+ reopen_response = self.client.post(f"/api/projects/{self.team.id}/comments/{task['id']}/reopen")
+ assert reopen_response.status_code == status.HTTP_200_OK
+ assert reopen_response.json()["completed_at"] is None
+ assert reopen_response.json()["completed_by"] is None
+
+ # Already open -> 400
+ repeat = self.client.post(f"/api/projects/{self.team.id}/comments/{task['id']}/reopen")
+ assert repeat.status_code == status.HTTP_400_BAD_REQUEST
+ assert repeat.json()["detail"] == "Task is already open"
+
+ @parameterized.expand(
+ [
+ ("complete_endpoint", "complete"),
+ ("reopen_endpoint", "reopen"),
+ ]
+ )
+ def test_state_endpoints_reject_non_tasks(self, _name: str, endpoint: str) -> None:
+ comment = self.client.post(
+ f"/api/projects/{self.team.id}/comments",
+ {"content": "regular", "scope": "Notebook"},
+ ).json()
+
+ response = self.client.post(f"/api/projects/{self.team.id}/comments/{comment['id']}/{endpoint}")
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+
+ def test_complete_writes_activity_log_entry(self) -> None:
+ recording_id = "01964c81-1234-5678-90ab-cdef01234567"
+ task = self._create_task({"item_id": recording_id})
+ self.client.post(f"/api/projects/{self.team.id}/comments/{task['id']}/complete")
+ self.client.post(f"/api/projects/{self.team.id}/comments/{task['id']}/reopen")
+
+ activities = list(
+ ActivityLog.objects.filter(
+ team_id=self.team.id,
+ item_id=recording_id,
+ activity__in=["completed task", "reopened task"],
+ ).order_by("created_at")
+ )
+ assert [a.activity for a in activities] == ["completed task", "reopened task"]
+ assert all(a.scope == "Replay" for a in activities)
+
+ @parameterized.expand(
+ [
+ ("complete_endpoint_404", "complete"),
+ ("reopen_endpoint_404", "reopen"),
+ ]
+ )
+ def test_state_endpoints_404_on_soft_deleted_task(self, _name: str, endpoint: str) -> None:
+ task = self._create_task()
+ self.client.patch(f"/api/projects/{self.team.id}/comments/{task['id']}", {"deleted": True})
+
+ response = self.client.post(f"/api/projects/{self.team.id}/comments/{task['id']}/{endpoint}")
+ assert response.status_code == status.HTTP_404_NOT_FOUND
+
+ @parameterized.expand(
+ [
+ ("null_on_task_rejected", True, status.HTTP_400_BAD_REQUEST),
+ ("null_on_comment_rejected", False, status.HTTP_400_BAD_REQUEST),
+ ]
+ )
+ def test_patch_is_task_null_is_rejected(self, _name: str, create_as_task: bool, expected_status: int) -> None:
+ if create_as_task:
+ comment_id = self._create_task()["id"]
+ else:
+ comment_id = self.client.post(
+ f"/api/projects/{self.team.id}/comments",
+ {"content": "regular", "scope": "Notebook"},
+ ).json()["id"]
+
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/comments/{comment_id}",
+ {"is_task": None},
+ format="json",
+ )
+ assert response.status_code == expected_status
+
+ def test_legacy_null_is_task_rows_serialize_as_false(self) -> None:
+ # Simulate a row written before this feature shipped, with is_task=None.
+ legacy = Comment.objects.create(team=self.team, scope="Notebook", content="legacy", created_by=self.user)
+ Comment.objects.filter(id=legacy.id).update(is_task=None)
+
+ response = self.client.get(f"/api/projects/{self.team.id}/comments/{legacy.id}")
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["is_task"] is False
+
+ @parameterized.expand(
+ [
+ ("kind_any", "kind=any", 3),
+ ("kind_comment", "kind=comment", 1),
+ ("kind_task", "kind=task", 2),
+ ("kind_task_open", "kind=task&completed=open", 1),
+ ("kind_task_completed", "kind=task&completed=completed", 1),
+ ("completed_open_without_kind_ignored", "completed=open", 3),
+ ("completed_completed_without_kind_ignored", "completed=completed", 3),
+ ]
+ )
+ def test_kind_and_completed_filters(self, _name: str, query: str, expected_count: int) -> None:
+ # 1 plain comment, 1 open task, 1 completed task
+ self._create_task({"content": "open task"})
+ completed_task = self._create_task({"content": "completed task"})
+ self.client.post(f"/api/projects/{self.team.id}/comments/{completed_task['id']}/complete")
+ self.client.post(
+ f"/api/projects/{self.team.id}/comments",
+ {"content": "regular", "scope": "Notebook"},
+ )
+
+ response = self.client.get(f"/api/projects/{self.team.id}/comments?{query}")
+ assert response.status_code == status.HTTP_200_OK
+ assert len(response.json()["results"]) == expected_count
diff --git a/posthog/migrations/1144_comment_task_fields.py b/posthog/migrations/1144_comment_task_fields.py
new file mode 100644
index 000000000000..114b139841ec
--- /dev/null
+++ b/posthog/migrations/1144_comment_task_fields.py
@@ -0,0 +1,34 @@
+# Generated by Django 5.2.13 on 2026-05-04 15:15
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [("posthog", "1143_sharingconfiguration_notebook")]
+
+ operations = [
+ migrations.AddField(
+ model_name="comment",
+ name="completed_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ migrations.AddField(
+ model_name="comment",
+ name="completed_by",
+ field=models.ForeignKey(
+ blank=True,
+ db_index=False,
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ related_name="+",
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ migrations.AddField(
+ model_name="comment",
+ name="is_task",
+ field=models.BooleanField(blank=True, default=False, null=True),
+ ),
+ ]
diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt
index 241367268579..e97f32a0d6e6 100644
--- a/posthog/migrations/max_migration.txt
+++ b/posthog/migrations/max_migration.txt
@@ -1 +1 @@
-1143_sharingconfiguration_notebook
\ No newline at end of file
+1144_comment_task_fields
diff --git a/posthog/models/comment/comment.py b/posthog/models/comment/comment.py
index d1fc6f601d85..d03816cf760f 100644
--- a/posthog/models/comment/comment.py
+++ b/posthog/models/comment/comment.py
@@ -27,6 +27,18 @@ class Comment(UUIDTModel, RootTeamMixin):
# Threads/replies are simply comments with a source_comment_id
source_comment = models.ForeignKey("Comment", on_delete=models.CASCADE, null=True, blank=True)
+ # Nullable so old code can INSERT without naming the column during rolling deploys.
+ is_task = models.BooleanField(null=True, blank=True, default=False)
+ completed_at = models.DateTimeField(blank=True, null=True)
+ completed_by = models.ForeignKey(
+ "User",
+ on_delete=models.SET_NULL,
+ null=True,
+ blank=True,
+ related_name="+",
+ db_index=False,
+ )
+
class Meta:
indexes = [
models.Index(fields=["team_id", "scope", "item_id"]),
@@ -38,6 +50,12 @@ class Comment(UUIDTModel, RootTeamMixin):
]
+def activity_log_scope_for(comment: Comment) -> str:
+ # Map legacy "recording" → "Replay"; replies are logged under the parent thread.
+ corrected = "Replay" if comment.scope == "recording" else comment.scope
+ return "Comment" if comment.source_comment_id else corrected
+
+
@mutable_receiver(models.signals.post_save, sender=Comment)
def log_comment_activity(sender, instance: Comment, created: bool, **kwargs):
if created:
@@ -57,13 +75,9 @@ def log_comment_activity(sender, instance: Comment, created: bool, **kwargs):
# 2. Lookup the information when loading the activity (could be pretty slow as well as needing custom logic for each type of thing)
# 3. Pass only the URL which allows us to say "X commented on insight/1234"
- # If it is a reply, the scope is the original comment
item_id = cast(str, instance.source_comment_id) or instance.item_id
- # Map 'recording' to 'Replay' for activity log
- # this is only necessary while we still have comments with scope 'recording'
- # after we stop allowing 'recording' as a scope this can be removed
- corrected_scope = "Replay" if instance.scope == "recording" else instance.scope
- scope = "Comment" if instance.source_comment_id else corrected_scope
+ scope = activity_log_scope_for(instance)
+ activity = "created task" if instance.is_task else "commented"
log_activity(
organization_id=None,
@@ -72,7 +86,7 @@ def log_comment_activity(sender, instance: Comment, created: bool, **kwargs):
was_impersonated=get_was_impersonated(),
item_id=item_id,
scope=scope,
- activity="commented",
+ activity=activity,
detail=Detail(
# name=TODO,
# short_id=TODO,
diff --git a/products/platform_features/frontend/generated/api.schemas.ts b/products/platform_features/frontend/generated/api.schemas.ts
index 77f2415b7ceb..a4e53d998931 100644
--- a/products/platform_features/frontend/generated/api.schemas.ts
+++ b/products/platform_features/frontend/generated/api.schemas.ts
@@ -610,6 +610,10 @@ export interface CommentApi {
deleted?: boolean | null
mentions?: number[]
slug?: string
+ /** Whether this comment is an actionable task that can be marked complete. Tasks render with a checkbox in the UI and can be filtered as a separate kind. Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation. */
+ is_task?: boolean
+ /** The user who marked this task complete. Null for open tasks and non-task comments. */
+ readonly completed_by: UserBasicApi | null
/** @nullable */
content?: string | null
rich_content?: unknown | null
@@ -623,6 +627,11 @@ export interface CommentApi {
item_context?: unknown | null
/** @maxLength 79 */
scope: string
+ /**
+ * ISO timestamp when the task was marked complete. Only meaningful when is_task is true. Read-only — toggled via the /complete and /reopen actions, not via PATCH.
+ * @nullable
+ */
+ readonly completed_at: string | null
/** @nullable */
source_comment?: string | null
}
@@ -642,6 +651,10 @@ export interface PatchedCommentApi {
deleted?: boolean | null
mentions?: number[]
slug?: string
+ /** Whether this comment is an actionable task that can be marked complete. Tasks render with a checkbox in the UI and can be filtered as a separate kind. Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation. */
+ is_task?: boolean
+ /** The user who marked this task complete. Null for open tasks and non-task comments. */
+ readonly completed_by?: UserBasicApi | null
/** @nullable */
content?: string | null
rich_content?: unknown | null
@@ -655,6 +668,11 @@ export interface PatchedCommentApi {
item_context?: unknown | null
/** @maxLength 79 */
scope?: string
+ /**
+ * ISO timestamp when the task was marked complete. Only meaningful when is_task is true. Read-only — toggled via the /complete and /reopen actions, not via PATCH.
+ * @nullable
+ */
+ readonly completed_at?: string | null
/** @nullable */
source_comment?: string | null
}
@@ -1100,6 +1118,15 @@ export type AdvancedActivityLogsListParams = {
export type CommentsListParams = {
/**
+ * When kind=task, restrict to open (incomplete) or completed tasks. Ignored when kind is not 'task'. Defaults to 'any' (no filter).
+
+* `any` - any
+* `open` - open
+* `completed` - completed
+ * @minLength 1
+ */
+ completed?: CommentsListCompleted
+ /**
* The pagination cursor value.
*/
cursor?: string
@@ -1109,6 +1136,15 @@ export type CommentsListParams = {
*/
item_id?: string
/**
+ * Filter by comment kind. 'task' returns only items intentionally created as actionable. 'comment' excludes tasks. Defaults to 'any' (no filter).
+
+* `any` - any
+* `comment` - comment
+* `task` - task
+ * @minLength 1
+ */
+ kind?: CommentsListKind
+ /**
* Filter by resource type (e.g. Dashboard, FeatureFlag, Insight, Replay).
* @minLength 1
*/
@@ -1124,3 +1160,19 @@ export type CommentsListParams = {
*/
source_comment?: string
}
+
+export type CommentsListCompleted = (typeof CommentsListCompleted)[keyof typeof CommentsListCompleted]
+
+export const CommentsListCompleted = {
+ Any: 'any',
+ Open: 'open',
+ Completed: 'completed',
+} as const
+
+export type CommentsListKind = (typeof CommentsListKind)[keyof typeof CommentsListKind]
+
+export const CommentsListKind = {
+ Any: 'any',
+ Comment: 'comment',
+ Task: 'task',
+} as const
diff --git a/products/platform_features/frontend/generated/api.ts b/products/platform_features/frontend/generated/api.ts
index 7793e6f9e365..2ec0162d5792 100644
--- a/products/platform_features/frontend/generated/api.ts
+++ b/products/platform_features/frontend/generated/api.ts
@@ -852,6 +852,42 @@ export const commentsDestroy = async (projectId: string, id: string, options?: R
})
}
+/**
+ * Mark a task-comment as complete. Sets completed_at and completed_by. 400 if the comment is not a task or is already complete.
+ */
+export const getCommentsCompleteCreateUrl = (projectId: string, id: string) => {
+ return `/api/projects/${projectId}/comments/${id}/complete/`
+}
+
+export const commentsCompleteCreate = async (
+ projectId: string,
+ id: string,
+ options?: RequestInit
+): Promise<CommentApi> => {
+ return apiMutator<CommentApi>(getCommentsCompleteCreateUrl(projectId, id), {
+ ...options,
+ method: 'POST',
+ })
+}
+
+/**
+ * Reopen a completed task-comment. Clears completed_at and completed_by. 400 if the comment is not a task or is already open.
+ */
+export const getCommentsReopenCreateUrl = (projectId: string, id: string) => {
+ return `/api/projects/${projectId}/comments/${id}/reopen/`
+}
+
+export const commentsReopenCreate = async (
+ projectId: string,
+ id: string,
+ options?: RequestInit
+): Promise<CommentApi> => {
+ return apiMutator<CommentApi>(getCommentsReopenCreateUrl(projectId, id), {
+ ...options,
+ method: 'POST',
+ })
+}
+
export const getCommentsThreadRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/comments/${id}/thread/`
}
diff --git a/products/platform_features/frontend/generated/api.zod.ts b/products/platform_features/frontend/generated/api.zod.ts
index 9c598bfc7403..1efe1f41dd16 100644
--- a/products/platform_features/frontend/generated/api.zod.ts
+++ b/products/platform_features/frontend/generated/api.zod.ts
@@ -240,6 +240,7 @@ export const AdvancedActivityLogsExportCreateBody = /* @__PURE__ */ zod.object({
created_at: zod.iso.datetime({}).optional(),
})
+export const commentsCreateBodyIsTaskDefault = false
export const commentsCreateBodyItemIdMax = 72
export const commentsCreateBodyScopeMax = 79
@@ -248,6 +249,12 @@ export const CommentsCreateBody = /* @__PURE__ */ zod.object({
deleted: zod.boolean().nullish(),
mentions: zod.array(zod.number()).optional(),
slug: zod.string().optional(),
+ is_task: zod
+ .boolean()
+ .default(commentsCreateBodyIsTaskDefault)
+ .describe(
+ 'Whether this comment is an actionable task that can be marked complete. Tasks render with a checkbox in the UI and can be filtered as a separate kind. Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation.'
+ ),
content: zod.string().nullish(),
rich_content: zod.unknown().nullish(),
item_id: zod.string().max(commentsCreateBodyItemIdMax).nullish(),
@@ -256,6 +263,7 @@ export const CommentsCreateBody = /* @__PURE__ */ zod.object({
source_comment: zod.uuid().nullish(),
})
+export const commentsUpdateBodyIsTaskDefault = false
export const commentsUpdateBodyItemIdMax = 72
export const commentsUpdateBodyScopeMax = 79
@@ -264,6 +272,12 @@ export const CommentsUpdateBody = /* @__PURE__ */ zod.object({
deleted: zod.boolean().nullish(),
mentions: zod.array(zod.number()).optional(),
slug: zod.string().optional(),
+ is_task: zod
+ .boolean()
+ .default(commentsUpdateBodyIsTaskDefault)
+ .describe(
+ 'Whether this comment is an actionable task that can be marked complete. Tasks render with a checkbox in the UI and can be filtered as a separate kind. Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation.'
+ ),
content: zod.string().nullish(),
rich_content: zod.unknown().nullish(),
item_id: zod.string().max(commentsUpdateBodyItemIdMax).nullish(),
@@ -272,6 +286,7 @@ export const CommentsUpdateBody = /* @__PURE__ */ zod.object({
source_comment: zod.uuid().nullish(),
})
+export const commentsPartialUpdateBodyIsTaskDefault = false
export const commentsPartialUpdateBodyItemIdMax = 72
export const commentsPartialUpdateBodyScopeMax = 79
@@ -280,6 +295,12 @@ export const CommentsPartialUpdateBody = /* @__PURE__ */ zod.object({
deleted: zod.boolean().nullish(),
mentions: zod.array(zod.number()).optional(),
slug: zod.string().optional(),
+ is_task: zod
+ .boolean()
+ .default(commentsPartialUpdateBodyIsTaskDefault)
+ .describe(
+ 'Whether this comment is an actionable task that can be marked complete. Tasks render with a checkbox in the UI and can be filtered as a separate kind. Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation.'
+ ),
content: zod.string().nullish(),
rich_content: zod.unknown().nullish(),
item_id: zod.string().max(commentsPartialUpdateBodyItemIdMax).nullish(),
diff --git a/products/platform_features/mcp/tools.yaml b/products/platform_features/mcp/tools.yaml
index 84fa3b444ce3..a3c8ee70bd13 100644
--- a/products/platform_features/mcp/tools.yaml
+++ b/products/platform_features/mcp/tools.yaml
@@ -201,6 +201,9 @@ tools:
title: Get all replies in a comment thread.
description: |
Get the full thread of replies for a parent comment. Useful for reading complete discussions on a resource.
+ comments-complete-create:
+ operation: comments_complete_create
+ enabled: false
comments-create:
operation: comments_create
enabled: false
@@ -223,6 +226,9 @@ tools:
comments-partial-update:
operation: comments_partial_update
enabled: false
+ comments-reopen-create:
+ operation: comments_reopen_create
+ enabled: false
comments-update:
operation: comments_update
enabled: false
diff --git a/services/mcp/definitions/core.yaml b/services/mcp/definitions/core.yaml
index 892c49a3fda7..38dada70d7eb 100644
--- a/services/mcp/definitions/core.yaml
+++ b/services/mcp/definitions/core.yaml
@@ -80,6 +80,9 @@ tools:
cohorts-update:
operation: cohorts_update
enabled: false
+ comments-complete-create:
+ operation: comments_complete_create
+ enabled: false
comments-count-retrieve:
operation: comments_count_retrieve
enabled: false
@@ -95,6 +98,9 @@ tools:
comments-partial-update:
operation: comments_partial_update
enabled: false
+ comments-reopen-create:
+ operation: comments_reopen_create
+ enabled: false
comments-retrieve:
operation: comments_retrieve
enabled: false
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 0c64dde09d1c..d12500840997 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -8403,6 +8403,10 @@ export namespace Schemas {
deleted?: boolean | null;
mentions?: number[];
slug?: string;
+ /** Whether this comment is an actionable task that can be marked complete. Tasks render with a checkbox in the UI and can be filtered as a separate kind. Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation. */
+ is_task?: boolean;
+ /** The user who marked this task complete. Null for open tasks and non-task comments. */
+ readonly completed_by: UserBasic | null;
/** @nullable */
content?: string | null;
rich_content?: unknown | null;
@@ -8416,6 +8420,11 @@ export namespace Schemas {
item_context?: unknown | null;
/** @maxLength 79 */
scope: string;
+ /**
+ * ISO timestamp when the task was marked complete. Only meaningful when is_task is true. Read-only — toggled via the /complete and /reopen actions, not via PATCH.
+ * @nullable
+ */
+ readonly completed_at: string | null;
/** @nullable */
source_comment?: string | null;
}
@@ -26639,6 +26648,10 @@ export namespace Schemas {
deleted?: boolean | null;
mentions?: number[];
slug?: string;
+ /** Whether this comment is an actionable task that can be marked complete. Tasks render with a checkbox in the UI and can be filtered as a separate kind. Cannot be set on replies (source_comment) or emoji reactions. Immutable after creation. */
+ is_task?: boolean;
+ /** The user who marked this task complete. Null for open tasks and non-task comments. */
+ readonly completed_by?: UserBasic | null;
/** @nullable */
content?: string | null;
rich_content?: unknown | null;
@@ -26652,6 +26665,11 @@ export namespace Schemas {
item_context?: unknown | null;
/** @maxLength 79 */
scope?: string;
+ /**
+ * ISO timestamp when the task was marked complete. Only meaningful when is_task is true. Read-only — toggled via the /complete and /reopen actions, not via PATCH.
+ * @nullable
+ */
+ readonly completed_at?: string | null;
/** @nullable */
source_comment?: string | null;
}
@@ -42428,6 +42446,15 @@ export namespace Schemas {
} as const;
export type CommentsListParams = {
+ /**
+ * When kind=task, restrict to open (incomplete) or completed tasks. Ignored when kind is not 'task'. Defaults to 'any' (no filter).
+
+ * `any` - any
+ * `open` - open
+ * `completed` - completed
+ * @minLength 1
+ */
+ completed?: CommentsListCompleted;
/**
* The pagination cursor value.
*/
@@ -42437,6 +42464,15 @@ export namespace Schemas {
* @minLength 1
*/
item_id?: string;
+ /**
+ * Filter by comment kind. 'task' returns only items intentionally created as actionable. 'comment' excludes tasks. Defaults to 'any' (no filter).
+
+ * `any` - any
+ * `comment` - comment
+ * `task` - task
+ * @minLength 1
+ */
+ kind?: CommentsListKind;
/**
* Filter by resource type (e.g. Dashboard, FeatureFlag, Insight, Replay).
* @minLength 1
@@ -42454,6 +42490,24 @@ export namespace Schemas {
source_comment?: string;
};
+ export type CommentsListCompleted = typeof CommentsListCompleted[keyof typeof CommentsListCompleted];
+
+
+ export const CommentsListCompleted = {
+ Any: 'any',
+ Open: 'open',
+ Completed: 'completed',
+ } as const;
+
+ export type CommentsListKind = typeof CommentsListKind[keyof typeof CommentsListKind];
+
+
+ export const CommentsListKind = {
+ Any: 'any',
+ Comment: 'comment',
+ Task: 'task',
+ } as const;
+
export type ConversationsTicketsListParams = {
/**
* Filter by assignee. Use `unassigned` for tickets with no assignee, `user:<user_id>` for a specific user, or `role:<role_uuid>` for a role.
diff --git a/services/mcp/src/generated/platform_features/api.ts b/services/mcp/src/generated/platform_features/api.ts
index f80a034c7c68..2570f119e0cf 100644
--- a/services/mcp/src/generated/platform_features/api.ts
+++ b/services/mcp/src/generated/platform_features/api.ts
@@ -349,8 +349,20 @@ export const CommentsListParams = /* @__PURE__ */ zod.object({
})
export const CommentsListQueryParams = /* @__PURE__ */ zod.object({
+ completed: zod
+ .enum(['any', 'open', 'completed'])
+ .optional()
+ .describe(
+ "When kind=task, restrict to open (incomplete) or completed tasks. Ignored when kind is not 'task'. Defaults to 'any' (no filter).\n\n* `any` - any\n* `open` - open\n* `completed` - completed"
+ ),
cursor: zod.string().optional().describe('The pagination cursor value.'),
item_id: zod.string().min(1).optional().describe('Filter by the ID of the resource being commented on.'),
+ kind: zod
+ .enum(['any', 'comment', 'task'])
+ .optional()
+ .describe(
+ "Filter by comment kind. 'task' returns only items intentionally created as actionable. 'comment' excludes tasks. Defaults to 'any' (no filter).\n\n* `any` - any\n* `comment` - comment\n* `task` - task"
+ ),
scope: zod
.string()
.min(1)
diff --git a/services/mcp/src/tools/generated/platform_features.ts b/services/mcp/src/tools/generated/platform_features.ts
index 1488e7ee4754..dcda8b9f94dc 100644
--- a/services/mcp/src/tools/generated/platform_features.ts
+++ b/services/mcp/src/tools/generated/platform_features.ts
@@ -278,8 +278,10 @@ const commentsList = (): ToolBase<typeof CommentsListSchema, Schemas.PaginatedCo
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/comments/`,
query: {
+ completed: params.completed,
cursor: params.cursor,
item_id: params.item_id,
+ kind: params.kind,
scope: params.scope,
search: params.search,
source_comment: params.source_comment,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/comments-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/comments-list.json
index 1b6cd72df7d5..d98c52cbf8b3 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/comments-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/comments-list.json
@@ -1,6 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
+ "completed": {
+ "description": "When kind=task, restrict to open (incomplete) or completed tasks. Ignored when kind is not 'task'. Defaults to 'any' (no filter).\n\n* `any` - any\n* `open` - open\n* `completed` - completed",
+ "enum": ["any", "open", "completed"],
+ "type": "string"
+ },
"cursor": {
"description": "The pagination cursor value.",
"type": "string"
@@ -10,6 +15,11 @@
"minLength": 1,
"type": "string"
},
+ "kind": {
+ "description": "Filter by comment kind. 'task' returns only items intentionally created as actionable. 'comment' excludes tasks. Defaults to 'any' (no filter).\n\n* `any` - any\n* `comment` - comment\n* `task` - task",
+ "enum": ["any", "comment", "task"],
+ "type": "string"
+ },
"scope": {
"description": "Filter by resource type (e.g. Dashboard, FeatureFlag, Insight, Replay).",
"minLength": 1,