Skip to content

Commit 49ecc44

Browse files
committed
Fix connectors overwriting link titles on comment updates
1 parent c89a24d commit 49ecc44

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

connectors/AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,8 @@ After creating a new connector, add it to `pnpm-workspace.yaml` if not already c
903903
12. **❌ Forgetting to clean up on disable** — Delete callbacks, webhooks, and stored state
904904
13. **❌ Two-way sync without metadata correlation** — Embed Plot ID in external item metadata to prevent duplicates from race conditions (see SYNC_STRATEGIES.md §6)
905905
14. **❌ Stripping HTML tags locally** — Pass raw HTML with `contentType: "html"` for server-side conversion. Local regex stripping breaks encoding and loses links
906-
15. **❌ Not setting `created` on notes from external data** — Always pass the external system's timestamp (e.g., `internalDate` from Gmail, `created_at` from an API) as the note's `created` field. Omitting it defaults to sync time, making all notes appear to have been created "just now"
906+
15. **❌ Using placeholder titles in comment/update webhooks** — `title` always overwrites on upsert. Always use the real entity title (fetch from API if not in the webhook payload). Never use IDs or keys as placeholder titles
907+
16. **❌ Not setting `created` on notes from external data** — Always pass the external system's timestamp (e.g., `internalDate` from Gmail, `created_at` from an API) as the note's `created` field. Omitting it defaults to sync time, making all notes appear to have been created "just now"
907908
908909
## Study These Examples
909910

connectors/jira/src/jira.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ export class Jira extends Connector<Jira> {
764764
const link: NewLinkWithNotes = {
765765
...(source ? { source } : {}),
766766
type: "issue",
767-
title: issue.key, // Placeholder; upsert by source will preserve existing title
767+
title: issue.fields?.summary || issue.key,
768768
notes: [
769769
{
770770
key: `comment-${comment.id}`,

connectors/linear/src/linear.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,10 @@ export class Linear extends Connector<Linear> {
783783
return;
784784
}
785785

786+
// Fetch issue title from Linear API (title always overwrites on upsert)
787+
const client = await this.getClient(projectId);
788+
const issue = await client.issue(issueId);
789+
786790
// Extract comment author from webhook payload
787791
const commentAuthor = this.resolveAuthorContact(comment.user);
788792

@@ -792,7 +796,7 @@ export class Linear extends Connector<Linear> {
792796
const newLink: NewLinkWithNotes = {
793797
source: threadSource,
794798
type: "issue",
795-
title: issueId, // Placeholder; upsert by source will preserve existing title
799+
title: issue.title,
796800
notes: [
797801
{
798802
key: `comment-${comment.id}`,

twister/src/plot.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,12 @@ export type NewLink = (
904904
* Creates a thread+link pair, with notes attached to the thread.
905905
*/
906906
export type NewLinkWithNotes = NewLink & {
907-
/** Title for the link and its thread container */
907+
/**
908+
* Title for the link and its thread container.
909+
* Must be the real entity title (e.g. issue title, message subject),
910+
* never a placeholder or ID. This value overwrites the existing title on upsert.
911+
* If the title is not available in the webhook payload, fetch it from the API.
912+
*/
908913
title: string;
909914
/** Notes to attach to the thread */
910915
notes?: Omit<NewNote, "thread">[];

0 commit comments

Comments
 (0)