Skip to content

Commit 09e23e1

Browse files
fix(web): the roster shows recipients as a list, never comma-joined (CL-8585) (#932)
1 parent 07ab057 commit 09e23e1

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

agents/myra/src/system-prompt.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const ASSISTANT_SYSTEM_PROMPT =
3939
"message. Never construct an address from an agent's name or slug " +
4040
"to reach it — that address does not route.\n" +
4141
"\n" +
42-
"When you hand a task to another participant, copy the person's " +
43-
'address from that same "Participants:" block in `to` so they can ' +
44-
"follow the conversation, and give every mail you send a short subject.";
42+
"When you hand a task to another participant, pass `to` as a list " +
43+
'holding their address and the person\'s from that same "Participants:" ' +
44+
"block, never one comma-joined string, so the person can follow the " +
45+
"conversation, and give every mail you send a short subject.";

apps/web/src/chat/room-roster.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ describe("appendRoster / stripRoster", () => {
2323
test("appends a cc instruction naming the person, and strips it too", () => {
2424
const body = "Please pass this to the scribe.";
2525
const withRoster = appendRoster(body, [
26-
{ name: "Sawyer", address: "usr_sawyer@room.example", kind: "person" },
27-
{ name: "Scribe", address: "run_abc@room.example", kind: "agent" },
26+
{ name: "Alice", address: "alice@example.com", kind: "person" },
27+
{ name: "Scribe", address: "run_abc@example.com", kind: "agent" },
2828
]);
2929
expect(withRoster).toBe(
3030
"Please pass this to the scribe.\n\n" +
31-
"Participants:\nSawyer <usr_sawyer@room.example>\nScribe <run_abc@room.example>\n\n" +
32-
"Copy usr_sawyer@room.example in `to` on any mail you send another participant, so they can follow along, and give every mail a short subject.",
31+
"Participants:\nAlice <alice@example.com>\nScribe <run_abc@example.com>\n\n" +
32+
'When you mail another participant, pass `to` as a list with them and the person, e.g. `to: ["<their address>", "alice@example.com"]`, never one comma-joined string, and give every mail a short subject.',
3333
);
3434
expect(stripRoster(withRoster)).toBe(body);
3535
});
3636

3737
test("names every person when more than one is in the roster", () => {
3838
const withRoster = appendRoster("hi", [
39-
{ name: "Sawyer", address: "usr_sawyer@room.example", kind: "person" },
40-
{ name: "Alex", address: "usr_alex@room.example", kind: "person" },
41-
{ name: "Scribe", address: "run_abc@room.example", kind: "agent" },
39+
{ name: "Alice", address: "alice@example.com", kind: "person" },
40+
{ name: "Bob", address: "bob@example.com", kind: "person" },
41+
{ name: "Scribe", address: "run_abc@example.com", kind: "agent" },
4242
]);
4343
expect(withRoster).toContain(
44-
"Copy usr_sawyer@room.example, usr_alex@room.example in `to` on any mail you send another participant, so they can follow along, and give every mail a short subject.",
44+
'`to: ["<their address>", "alice@example.com", "bob@example.com"]`',
4545
);
4646
});
4747
});

apps/web/src/chat/room-roster.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ function rosterBlock(entries: readonly RosterEntry[]): string {
3030
function ccInstruction(entries: readonly RosterEntry[]): string | undefined {
3131
const people = entries.filter((entry) => entry.kind === "person");
3232
if (people.length === 0) return undefined;
33-
const addresses = people.map((entry) => entry.address).join(", ");
34-
// The subject clause is load-bearing: a mail with an empty Subject ends
35-
// the receiving agent's run today.
36-
return `Copy ${addresses} in \`to\` on any mail you send another participant, so they can follow along, and give every mail a short subject.`;
33+
const quoted = people.map((entry) => `"${entry.address}"`).join(", ");
34+
// The list shape and the subject clause are both load-bearing: a
35+
// comma-joined `to` string is dropped as one bad recipient, and a mail
36+
// with an empty Subject ends the receiving agent's run today.
37+
return `When you mail another participant, pass \`to\` as a list with them and the person, e.g. \`to: ["<their address>", ${quoted}]\`, never one comma-joined string, and give every mail a short subject.`;
3738
}
3839

3940
/** Appends a `Participants:` block listing every entry's name and address,

0 commit comments

Comments
 (0)