From 37fedc12249213932768b2abb4a055288d2af7b8 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 15 Nov 2026 15:30:23 +0000 Subject: [PATCH 1/2] test(server): imported Claude sessions are titled inside wake envelopes Failing reproduction for #37251. Co-Authored-By: Claude Opus 5.5 --- .../src/project/AgentSessionScanner.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/server/src/project/AgentSessionScanner.test.ts b/apps/server/src/project/AgentSessionScanner.test.ts index ce75e456158a..f53d124c1f15 100644 --- a/apps/server/src/project/AgentSessionScanner.test.ts +++ b/apps/server/src/project/AgentSessionScanner.test.ts @@ -3634,6 +3634,27 @@ describe("parseAgentSessionTranscript", () => { expect(thread?.messages.map((message) => message.text)).toEqual([prompt]); }); + it("titles a Claude session after the prompt inside a wake envelope", () => { + const thread = AgentSessionScanner.parseAgentSessionTranscript({ + contents: JSON.stringify({ + type: "user", + sessionId: "claude-session", + timestamp: "2026-08-25T08:00:00.000Z", + message: { + role: "user", + content: + '\nFix the flaky login test\n', + }, + }), + source: "claudeAgent", + providerInstanceId: ProviderInstanceId.make("claudeAgent"), + fallbackSessionId: "fallback", + lastActiveAtMs: Date.parse("2026-08-25T08:00:00.000Z"), + }); + + expect(thread?.title).toBe("Fix the flaky login test"); + }); + it.each([ "Explain in this transcript", "Keep this incomplete example", From 361781cff303be1ac8d8e9d2dcbe2afcc8e2ab4c Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 15 Nov 2026 15:36:09 +0000 Subject: [PATCH 2/2] fix(server): imported Claude sessions are titled after the prompt inside a wake envelope Fixes pingdotgg/t3code#37251 Co-Authored-By: Claude Opus 5.5 --- apps/server/src/project/AgentSessionScanner.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/server/src/project/AgentSessionScanner.ts b/apps/server/src/project/AgentSessionScanner.ts index 7a89f9c687de..b32466487030 100644 --- a/apps/server/src/project/AgentSessionScanner.ts +++ b/apps/server/src/project/AgentSessionScanner.ts @@ -397,8 +397,15 @@ function codexHistoryBase(records: ReadonlyArray) { : undefined; } +// Agent-started sessions wrap the prompt in a `` +// envelope; title them after the prompt inside it. +const WAKE_ENVELOPE = /^\s*]*)?>([\s\S]*?)(?:<\/wake>|$)/; + function deriveTitle(source: AgentSessionSource, text: string): string | undefined { - const request = source === "codex" ? text.replace(CODEX_TITLE_PREAMBLE, "") : text; + const request = (source === "codex" ? text.replace(CODEX_TITLE_PREAMBLE, "") : text).replace( + WAKE_ENVELOPE, + "$1", + ); return request.trim().split("\n")[0]?.slice(0, 100).trim() || undefined; }