From 9713fff12b8c891965bbedd45b1a9a3ef020cf1c Mon Sep 17 00:00:00 2001
From: Haileyesus <118998054+blackmammoth@users.noreply.github.com>
Date: Fri, 3 Jul 2026 13:34:02 +0300
Subject: [PATCH] fix: strip timestamp tags from cursor
---
.../cursor-session-synchronizer.provider.ts | 8 +++++++-
.../list/cursor/cursor-sessions.provider.ts | 18 +++++++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/server/modules/providers/list/cursor/cursor-session-synchronizer.provider.ts b/server/modules/providers/list/cursor/cursor-session-synchronizer.provider.ts
index d5ea9b3c..2b2fc5fe 100644
--- a/server/modules/providers/list/cursor/cursor-session-synchronizer.provider.ts
+++ b/server/modules/providers/list/cursor/cursor-session-synchronizer.provider.ts
@@ -141,7 +141,13 @@ export class CursorSessionSynchronizer implements IProviderSessionSynchronizer {
}
const text = typeof data.message?.content?.[0]?.text === 'string' ? data.message.content[0].text : '';
- const firstLine = text.replace(/<\/?user_query>/g, '').trim().split('\n')[0];
+ // Drop Cursor's `…` prefix and `` tags
+ // so the session name comes from the actual first line the user typed.
+ const firstLine = text
+ .replace(/[\s\S]*?<\/timestamp>/g, '')
+ .replace(/<\/?user_query>/g, '')
+ .trim()
+ .split('\n')[0];
return {
sessionId,
diff --git a/server/modules/providers/list/cursor/cursor-sessions.provider.ts b/server/modules/providers/list/cursor/cursor-sessions.provider.ts
index 307d9638..5ed69290 100644
--- a/server/modules/providers/list/cursor/cursor-sessions.provider.ts
+++ b/server/modules/providers/list/cursor/cursor-sessions.provider.ts
@@ -59,17 +59,21 @@ function unwrapUserQueryText(value: string, role: 'user' | 'assistant'): string
return value;
}
- const normalized = value.trimStart();
+ // Cursor wraps user turns as `…\n…`.
+ // Show only the `` content, trimmed so there are no blank lines
+ // at the top/bottom and the `` prefix is dropped entirely.
const openTag = '';
const closeTag = '';
- if (!normalized.startsWith(openTag)) {
- return value;
+ const openIndex = value.indexOf(openTag);
+ if (openIndex >= 0) {
+ const afterOpen = value.slice(openIndex + openTag.length);
+ const closeIndex = afterOpen.lastIndexOf(closeTag);
+ const inner = closeIndex >= 0 ? afterOpen.slice(0, closeIndex) : afterOpen;
+ return inner.trim();
}
- const afterOpen = normalized.slice(openTag.length);
- const closeIndex = afterOpen.lastIndexOf(closeTag);
- const inner = closeIndex >= 0 ? afterOpen.slice(0, closeIndex) : afterOpen;
- return inner.trim();
+ // No `` wrapper: still strip a leading `…`.
+ return value.replace(/^\s*[\s\S]*?<\/timestamp>\s*/, '').trim();
}
function normalizeToolId(value: unknown): string | null {