Q10: wake tasks no longer carry a truncated copy of the message

Manual re-runs of a chat wake answer the same thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 03:36:22 -04:00
1 parent abe9534350
commit 31ab919334
4 files changed
+53 -6

No files matched your search

+31 -1
View File
@@ -66,7 +66,14 @@ async function founderLine() {
chat.editMessage({ orgId, messageId: row.id, bodyMd: newBody, actorType: "employee", actorId: founderId });
};
const onWakeTurn = (hook: (turnIndex: number) => void) => { onWake = hook; };
return { connection, wakePrompts, wakeInputs, say, runWake, edit, onWakeTurn };
const runManually = async () => {
const wake = connection.db.prepare(
"select id, task_id from task_runs where org_id = ? and agent_id = ? and trigger = 'chat_mention' and state = 'queued'",
).get(orgId, ceoId) as { id: string; task_id: string };
connection.db.prepare("update task_runs set state = 'failed' where id = ?").run(wake.id);
await execution.runTask({ orgId, taskId: wake.task_id });
};
return { connection, wakePrompts, wakeInputs, say, runWake, runManually, edit, onWakeTurn };
}
describe("chat wake context", () => {
@@ -194,4 +201,27 @@ describe("chat wake context", () => {
expect(earlier).toContain("13 earlier messages in this thread are not shown.");
h.connection.close();
});
test("a long message reaches the run whole, and the task description does not truncate it", async () => {
const h = await founderLine();
const long = `Plan: ${"step ".repeat(200)}END-OF-PLAN`;
h.say(long, null);
await h.runWake();
const prompt = h.wakePrompts[0];
expect(prompt).toContain(long);
expect(prompt).not.toContain("step ...");
const description = (h.connection.db.prepare("select description from tasks where origin = 'chat_wake'").get() as { description: string }).description;
expect(description).not.toContain("step ");
expect(description).toContain("messaged you directly");
h.connection.close();
});
test("re-running a chat wake by hand answers the same thread", async () => {
const h = await founderLine();
h.say("Please draft the Q3 hiring plan.", null);
await h.runManually();
expect(h.wakePrompts).toHaveLength(1);
expect(h.wakePrompts[0]).toContain("Please draft the Q3 hiring plan.");
h.connection.close();
});
});