Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions apps/server/src/project/AgentSessionScanner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3831,6 +3831,25 @@ describe("parseAgentSessionTranscript", () => {
expect(thread?.title).toBe("Fix the flaky login test");
});

it("does not split an emoji when shortening a long first message into a title", () => {
const prompt = `${"a".repeat(99)}🚀 then deploy`;
const thread = AgentSessionScanner.parseAgentSessionTranscript({
contents: [
encodeTranscriptRecord({ type: "session_meta", payload: { id: "codex-session" } }),
encodeTranscriptRecord({
type: "event_msg",
payload: { type: "user_message", message: prompt },
}),
].join("\n"),
source: "codex",
providerInstanceId: ProviderInstanceId.make("codex"),
fallbackSessionId: "fallback",
lastActiveAtMs: Date.parse("2026-08-25T08:00:00.000Z"),
});

expect(thread?.title).toBe("a".repeat(99));
});

it.each([
"Explain <external_codex_apps_open_page> in this transcript",
"<external_codex_apps_open_page>Keep this incomplete example",
Expand Down
4 changes: 3 additions & 1 deletion apps/server/src/project/AgentSessionScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import * as Schema from "effect/Schema";
import * as Semaphore from "effect/Semaphore";
import * as Stream from "effect/Stream";

import { splitsSurrogatePair } from "@t3tools/shared/assistantCitations";
import { isBareGitConfig, parseOriginUrlFromGitConfig } from "@t3tools/shared/git";
import * as HostProcess from "@t3tools/shared/HostProcess";
import { normalizeProjectPathForComparison } from "@t3tools/shared/path";
Expand Down Expand Up @@ -455,7 +456,8 @@ function deriveTitle(source: AgentSessionSource, text: string): string | undefin
WAKE_ENVELOPE,
"$1",
);
return request.trim().split("\n")[0]?.slice(0, 100).trim() || undefined;
const line = request.trim().split("\n")[0] ?? "";
return line.slice(0, splitsSurrogatePair(line, 100) ? 99 : 100).trim() || undefined;
}

// Pi keeps abandoned branches in the file; its active branch runs from the last entry to the root.
Expand Down
Loading