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
8 changes: 8 additions & 0 deletions apps/server/src/mcp/OrchestratorMcpService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,14 @@ describe("OrchestratorMcpService provider resolution", () => {
...request,
clientRequestId: "empty",
});
const emojiAtLimit = yield* service.createThreads(scope, {
threads: [{ ...request.threads[0]!, prompt: `${"a".repeat(76)}😀 and more work.` }],
clientRequestId: "emoji-title",
});
const titled = yield* orchestrator.getThreadProjection(
emojiAtLimit.threads[0]!.threadId,
);
assert.equal(titled.thread.title, `${"a".repeat(76)}...`);

yield* settings.updateSettings({
projectSettingsOverrides: {
Expand Down
9 changes: 8 additions & 1 deletion apps/server/src/mcp/OrchestratorMcpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,14 @@ function threadTitle(input: {
}): string {
const detail = input.title?.trim() || input.prompt?.trim();
if (!detail) return `${input.parentTitle} thread ${input.index + 1}`;
return detail.length > 80 ? `${detail.slice(0, 77)}...` : detail;
if (detail.length <= 80) return detail;
let end = 77;
const previous = detail.charCodeAt(end - 1);
const next = detail.charCodeAt(end);
if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) {
end -= 1;
}
return `${detail.slice(0, end)}...`;
}

function threadSettlement(
Expand Down
Loading