@devries-cameron20 / t3code-1 / commits / 272cd38379
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): imported thread titles no longer end in a broken emoji (#39548)

Co-authored-by: MarcoDotIO <20867620+MarcoDotIO@users.noreply.github.com>

tiliakoos committed Nov 20, 2026 at 08:27 UTC 272cd383790422ace6bc40a213176d0d11fb1700
2 files changed +22 -1
apps/server/src/project/AgentSessionScanner.test.ts
+19
@@ -3831,6 +3831,25 @@ describe("parseAgentSessionTranscript", () => {
3831 expect(thread?.title).toBe("Fix the flaky login test");
3832 });
3833
3834 + it("does not split an emoji when shortening a long first message into a title", () => {
3835 + const prompt = `${"a".repeat(99)}🚀 then deploy`;
3836 + const thread = AgentSessionScanner.parseAgentSessionTranscript({
3837 + contents: [
3838 + encodeTranscriptRecord({ type: "session_meta", payload: { id: "codex-session" } }),
3839 + encodeTranscriptRecord({
3840 + type: "event_msg",
3841 + payload: { type: "user_message", message: prompt },
3842 + }),
3843 + ].join("\n"),
3844 + source: "codex",
3845 + providerInstanceId: ProviderInstanceId.make("codex"),
3846 + fallbackSessionId: "fallback",
3847 + lastActiveAtMs: Date.parse("2026-08-25T08:00:00.000Z"),
3848 + });
3849 +
3850 + expect(thread?.title).toBe("a".repeat(99));
3851 + });
3852 +
3853 it.each([
3854 "Explain <external_codex_apps_open_page> in this transcript",
3855 "<external_codex_apps_open_page>Keep this incomplete example",
apps/server/src/project/AgentSessionScanner.ts
+3 -1
@@ -29,6 +29,7 @@ import * as Schema from "effect/Schema";
29 import * as Semaphore from "effect/Semaphore";
30 import * as Stream from "effect/Stream";
31
32 +import { splitsSurrogatePair } from "@t3tools/shared/assistantCitations";
33 import { isBareGitConfig, parseOriginUrlFromGitConfig } from "@t3tools/shared/git";
34 import * as HostProcess from "@t3tools/shared/HostProcess";
35 import { normalizeProjectPathForComparison } from "@t3tools/shared/path";
@@ -455,7 +456,8 @@ function deriveTitle(source: AgentSessionSource, text: string): string | undefin
456 WAKE_ENVELOPE,
457 "$1",
458 );
458 - return request.trim().split("\n")[0]?.slice(0, 100).trim() || undefined;
459 + const line = request.trim().split("\n")[0] ?? "";
460 + return line.slice(0, splitsSurrogatePair(line, 100) ? 99 : 100).trim() || undefined;
461 }
462
463 // Pi keeps abandoned branches in the file; its active branch runs from the last entry to the root.