Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

test(voice): cover a live email canvas opened before its content is known

muterCfd9c2926652a
diff --git a/apps/teamhub/tests/integration/voice_live_canvas_test.go b/apps/teamhub/tests/integration/voice_live_canvas_test.go
index 24ead75b..7ae19e5c 100644
--- a/apps/teamhub/tests/integration/voice_live_canvas_test.go
+++ b/apps/teamhub/tests/integration/voice_live_canvas_test.go
@@ -227,6 +227,11 @@ func TestVoiceLiveWritesAndChangesAnEmailCanvasAsTheAgent(t *testing.T) {
if output := call("email-0", "open_email_canvas", map[string]string{"to": "Amy", "subject": "Pickup", "body": "Can you pick me up?"}); output["error"] != "invalid_recipients" || canvasMessages() != 0 {
t.Fatalf("name as recipient=%v", output)
}
+ // A recipient alone is no email yet: the model is told the content is
+ // missing, not that the address is wrong, and nothing is written.
+ if output := call("email-empty", "open_email_canvas", map[string]string{"to": "[email protected]", "subject": "", "body": ""}); output["error"] != "missing_content" || canvasMessages() != 0 {
+ t.Fatalf("recipient alone=%v", output)
+ }
email := map[string]string{"to": "[email protected]", "subject": "Next Wed LA airport pickup", "body": "Hi Amy,\n\nCan you pick me up at LAX at 9 am next Wednesday?"}
opened := call("email-1", "open_email_canvas", email)
documentID, _ := opened["document_id"].(string)
@@ -256,6 +261,10 @@ func TestVoiceLiveWritesAndChangesAnEmailCanvasAsTheAgent(t *testing.T) {
!strings.Contains(stale["body"].(string), "Can you pick me up at LAX at 9 am next Wednesday?") || computes.Load() != 0 {
t.Fatalf("stale edit=%v computes=%d", stale, computes.Load())
}
+ // A change that names nothing to change is said so, and nothing runs.
+ if nothing := call("edit-none", "edit_email_canvas", map[string]string{"document_id": documentID, "revision_id": revisionID}); nothing["error"] != "nothing_to_change" || computes.Load() != 0 {
+ t.Fatalf("empty edit=%v computes=%d", nothing, computes.Load())
+ }
// A header change keeps every line it leaves out and replaces only the
// header, so the body's blocks stay as they are.
edit := map[string]string{"document_id": documentID, "revision_id": revisionID, "subject": "Next Wed barbecue pickup", "cc": "[email protected]"}
diff --git a/apps/voice-runtime/acceptance/live-scenarios/scenarios.ts b/apps/voice-runtime/acceptance/live-scenarios/scenarios.ts
index df9b0b3f..43d0e22a 100644
--- a/apps/voice-runtime/acceptance/live-scenarios/scenarios.ts
+++ b/apps/voice-runtime/acceptance/live-scenarios/scenarios.ts
@@ -1638,6 +1638,65 @@ export function scenarioJobs(
s.close();
}
+ // Asked for an email with only a recipient, the model asks what it
+ // should say; it does not take TeamHub's answer as a bad address.
+ async function b14(rep: number) {
+ const s = await open();
+ const t: string[] = [];
+ const filled = (value: unknown) =>
+ typeof value === "string" && value.trim() !== "";
+ const mock = makeMock({
+ // As TeamHub answers an email with no subject or body.
+ open_email_canvas: (a) =>
+ filled(a.subject) && filled(a.body)
+ ? {
+ status: "opened",
+ document_id: "document_canvas_1",
+ revision_id: "revision_1",
+ }
+ : { error: "missing_content" },
+ });
+ const r1 = await s.turn(
+ // Opened before its content is known, as in the call where this went
+ // wrong: TeamHub answers missing_content.
+ "Open an email to tonyzhang at simplexai dot com now, I will tell you what to say in a bit",
+ mock,
+ );
+ t.push(`U: email to tonyzhang → A: ${say(r1)}`);
+ const r2 = await s.turn("Say tomorrow's 3 pm meeting moves to 4 pm", mock);
+ t.push(`U: meeting moved → A: ${say(r2)}`);
+ const opened = calls(r2).find(
+ (c) =>
+ c.name === "open_email_canvas" &&
+ filled(c.args.subject) &&
+ filled(c.args.body),
+ );
+ push({
+ scenario: "B14 email content",
+ caseId: "email-recipient-only",
+ rep,
+ transcript: t,
+ metrics: {
+ // Whether the model wrote the email before it knew its content.
+ triedEmpty: calls(r1).some(
+ (c) =>
+ c.name === "open_email_canvas" &&
+ !(filled(c.args.subject) && filled(c.args.body)),
+ ),
+ noAddressBlame:
+ !/spell|say it again|address\b[^,.?!]{0,30}\b(not|isn't|wasn't|wrong|invalid)|(not|wasn't|isn't|couldn't)[^,.?!]{0,20}(recogni|valid)/i.test(
+ text(r1),
+ ),
+ asksContent: /what|subject|body|content|write|say/i.test(text(r1)),
+ openedWithContent: Boolean(opened),
+ keptRecipient:
+ typeof opened?.args.to === "string" &&
+ /tonyzhang@simplexai\.com/i.test(opened.args.to),
+ },
+ });
+ s.close();
+ }
+
return [
["b1-result", b1],
["b1b-length", b1Length],
@@ -1652,5 +1711,6 @@ export function scenarioJobs(
["b10-regressions", b10],
["b11-cut-off", b11],
["b13-open-file", b13],
+ ["b14-email-content", b14],
];
}