Founder-CEO chat round trip proven end to end; agents see the founder

loadChatContext labels human senders "[Name (founder)]" so a woken agent
knows it answers its boss, not a teammate. New integration test drives
the whole loop — founder DM wakes the CEO, the prompt names the founder,
the reply lands in the same pinned conversation and thread, the wake
task closes — and a Playwright spec pins the UI contract: badged CEO row
first, selected by default, message queues the wake run, channel recency
never displaces the pin. AGENTS.md documents the feature contracts.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-14 00:23:49 -04:00
1 parent 3c44ff959d
commit c7eafb2836
3 files changed
+233 -1

No files matched your search

+5 -1
View File
@@ -490,9 +490,13 @@ export class TaskExecutionService {
limit 20
`).all(scope.sourceThreadId, orgId) as Array<{ body_md: string; sender_type: string; sender_name: string }>;
if (messages.length === 0) return null;
// Human principals are marked as the founder: an agent replying to its
// boss must know it is not talking to another agent.
const label = (m: { sender_type: string; sender_name: string }) =>
m.sender_type === "employee" || m.sender_type === "board" ? `${m.sender_name} (founder)` : m.sender_name;
return {
threadId: scope.sourceThreadId,
transcript: messages.map((m) => `[${m.sender_name}]: ${m.body_md}`).join("\n"),
transcript: messages.map((m) => `[${label(m)}]: ${m.body_md}`).join("\n"),
};
}