Merge pull request #7554 from paperclipai/codex/pap-10343-comment-redaction

[codex] Redact deleted issue comments
This commit is contained in:
Dotta
2026-06-05 05:32:08 -10:00
committed by GitHub
30 changed files with 40631 additions and 98 deletions
+2
View File
@@ -28,6 +28,7 @@ const ACTIVITY_ROW_VERBS: Record<string, string> = {
"issue.released": "released",
"issue.comment_added": "commented on",
"issue.comment_cancelled": "cancelled a queued comment on",
"issue.comment_deleted": "deleted a comment on",
"issue.attachment_added": "attached file to",
"issue.attachment_removed": "removed attachment from",
"issue.document_created": "created document for",
@@ -89,6 +90,7 @@ const ISSUE_ACTIVITY_LABELS: Record<string, string> = {
"issue.released": "released the issue",
"issue.comment_added": "added a comment",
"issue.comment_cancelled": "cancelled a queued comment",
"issue.comment_deleted": "deleted a comment",
"issue.feedback_vote_saved": "saved feedback on an AI output",
"issue.attachment_added": "added an attachment",
"issue.attachment_removed": "removed an attachment",
+26
View File
@@ -324,6 +324,32 @@ describe("buildIssueChatMessages", () => {
});
});
it("redacts deleted comment bodies while preserving tombstone metadata", () => {
const messages = buildIssueChatMessages({
comments: [
createComment({
body: "Sensitive deleted body",
deletedAt: new Date("2026-04-06T12:05:00.000Z"),
deletedByType: "user",
deletedByUserId: "user-1",
}),
],
timelineEvents: [],
linkedRuns: [],
liveRuns: [],
currentUserId: "user-1",
userLabelMap: new Map([["user-1", "Dotta"]]),
});
expect(messages[0]?.content).toEqual([{ type: "text", text: "" }]);
expect(messages[0]?.metadata.custom).toMatchObject({
deletedAt: "2026-04-06T12:05:00.000Z",
deletedByType: "user",
deletedByUserId: "user-1",
});
expect(JSON.stringify(messages[0])).not.toContain("Sensitive deleted body");
});
it("prefers derived agent attribution when a board-authored comment is proven to come from a run", () => {
const agentMap = new Map<string, Agent>([["agent-1", createAgent("agent-1", "Claude")]]);
const messages = buildIssueChatMessages({
+9 -3
View File
@@ -408,14 +408,20 @@ function createCommentMessage(args: {
followUpRequested: comment.followUpRequested === true,
presentation: comment.presentation ?? null,
commentMetadata: comment.metadata ?? null,
deletedAt: comment.deletedAt ? toDate(comment.deletedAt).toISOString() : null,
deletedByType: comment.deletedByType ?? null,
deletedByAgentId: comment.deletedByAgentId ?? null,
deletedByUserId: comment.deletedByUserId ?? null,
deletedByRunId: comment.deletedByRunId ?? null,
};
const contentText = comment.deletedAt ? "" : comment.body;
if (isSystemNotice) {
const message: ThreadSystemMessage = {
id: comment.id,
role: "system",
createdAt,
content: [{ type: "text", text: comment.body }],
content: [{ type: "text", text: contentText }],
metadata: { custom },
};
return message;
@@ -426,7 +432,7 @@ function createCommentMessage(args: {
id: comment.id,
role: "assistant",
createdAt,
content: [{ type: "text", text: comment.body }],
content: [{ type: "text", text: contentText }],
status: { type: "complete", reason: "stop" },
metadata: createAssistantMetadata(custom),
};
@@ -437,7 +443,7 @@ function createCommentMessage(args: {
id: comment.id,
role: "user",
createdAt,
content: [{ type: "text", text: comment.body }],
content: [{ type: "text", text: contentText }],
attachments: [],
metadata: { custom },
};