Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

[1/2] test(eve): add conformance rules for a message sent while a request is pending (#4351)

Ben Pankowb8382ef68551
diff --git a/packages/eve/src/internal/testing/channel-conformance/MATRIX.md b/packages/eve/src/internal/testing/channel-conformance/MATRIX.md
index f9d3578ed..06d3cff3b 100644
--- a/packages/eve/src/internal/testing/channel-conformance/MATRIX.md
+++ b/packages/eve/src/internal/testing/channel-conformance/MATRIX.md
@@ -22,9 +22,10 @@ pnpm --filter eve exec vitest run --config vitest.unit.config.ts channel-conform
| a text reply matching an option answers the only pending question | ✅ | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| a text reply that matches no option answers the question with the person's words | ✅ | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| a text reply answers an open-ended question with the person's words | ✅ | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| pressing an option of an answered question sends it to the agent as new input | —<sup>[3](#note-3)</sup> | —<sup>[4](#note-4)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
| pressing options of two pending questions answers each with its own option | ✅ | ✅ | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
-| text replies answer two pending questions one at a time, in the order shown | —<sup>[5](#note-5)</sup> | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
+| text replies answer two pending questions one at a time, in the order shown | —<sup>[3](#note-3)</sup> | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
+| pressing an option of an answered question sends it to the agent as new input | —<sup>[4](#note-4)</sup> | —<sup>[5](#note-5)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
+| a message while a question without free text is pending withdraws it, and the next message gets a reply | ✅ | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
## Tool approvals
@@ -32,14 +33,16 @@ pnpm --filter eve exec vitest run --config vitest.unit.config.ts channel-conform
| --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| a tool approval shows a choice to approve and one to cancel | ✅ | ✅ | ✅ | | ✅ | ✅ | | ✅ | | ✅ | | ✅ | | ✅ | | ✅ | ✅ | ✅ | ✅ |
| pressing Approve runs the gated tool | ✅ | ✅ | ✅ | ✅ | —<sup>[1](#note-1)</sup> | ✅ | ✅ | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
+| pressing Cancel stops the gated tool without running it | ✅ | ✅ | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
+| a text reply of approve runs the gated tool | —<sup>[6](#note-6)</sup> | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
+| a text reply of cancel stops the gated tool without running it | —<sup>[6](#note-6)</sup> | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| pressing Approve twice runs the gated tool once | ✅ | ✅ | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
| pressing Approve on one of two pending approvals runs only that tool | ✅ | ✅ | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
-| answering an approval and a question pending together settles both | ✅ | ✅ | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
| text replies answer two pending approvals one at a time, in the order shown | —<sup>[6](#note-6)</sup> | —<sup>[7](#note-7)</sup> | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ❌<sup>[8](#note-8)</sup> | ❌<sup>[8](#note-8)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
+| answering an approval and a question pending together settles both | ✅ | ✅ | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
| text replies answer a question and an approval raised together, in the order shown | —<sup>[6](#note-6)</sup> | ✅ | ✅ | | ✅ | —<sup>[2](#note-2)</sup> | | ✅ | | ✅ | | ✅ | | ✅ | | ✅ | ✅ | ✅ | ✅ |
-| pressing Cancel stops the gated tool without running it | ✅ | ✅ | ✅ | | —<sup>[1](#note-1)</sup> | ✅ | | —<sup>[1](#note-1)</sup> | | ✅ | | ✅ | | ✅ | | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
-| a text reply of approve runs the gated tool | —<sup>[6](#note-6)</sup> | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
-| a text reply of cancel stops the gated tool without running it | —<sup>[6](#note-6)</sup> | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
+| a message while an approval is pending cancels it, so typing approve afterwards runs nothing and the next message gets a reply | —<sup>[6](#note-6)</sup> | ✅ | ✅ | ✅ | ✅ | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
+| pressing Approve on an approval a message cancelled runs nothing | —<sup>[6](#note-6)</sup> | ✅ | ✅ | ✅ | —<sup>[1](#note-1)</sup> | —<sup>[2](#note-2)</sup> | —<sup>[2](#note-2)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> | —<sup>[1](#note-1)</sup> |
## Answered prompts
@@ -96,9 +99,9 @@ pnpm --filter eve exec vitest run --config vitest.unit.config.ts channel-conform
1. <a id="note-1"></a>the platform has no buttons a person can press
2. <a id="note-2"></a>the platform has no plain-text replies
-3. <a id="note-3"></a>an answered question's drawer closes, so nothing is left to press
-4. <a id="note-4"></a>an answered question disables its options, so nothing is left to press
-5. <a id="note-5"></a>each open request has its own drawer, and typing a message dismisses them all
+3. <a id="note-3"></a>each open request has its own drawer, and typing a message dismisses them all
+4. <a id="note-4"></a>an answered question's drawer closes, so nothing is left to press
+5. <a id="note-5"></a>an answered question disables its options, so nothing is left to press
6. <a id="note-6"></a>the approval drawer holds the keyboard; a person answers it with y or n
7. <a id="note-7"></a>a reply sent while approvals wait goes out as a steering message, which sometimes restarts the turn instead of answering
8. <a id="note-8"></a>one card shows every approval a step raises, so a typed reply can't say which it answers
diff --git a/packages/eve/src/internal/testing/channel-conformance/conformance.ts b/packages/eve/src/internal/testing/channel-conformance/conformance.ts
index d19e686e1..19532ec88 100644
--- a/packages/eve/src/internal/testing/channel-conformance/conformance.ts
+++ b/packages/eve/src/internal/testing/channel-conformance/conformance.ts
@@ -270,6 +270,9 @@ const channelConformance = {
"a text reply of cancel stops the gated tool without running it": TUI_TYPED_APPROVAL,
"approving by text clears the approval's buttons": TUI_TYPED_APPROVAL,
"approving by text names who approved on the approval": TUI_TYPED_APPROVAL,
+ "a message while an approval is pending cancels it, so typing approve afterwards runs nothing and the next message gets a reply":
+ TUI_TYPED_APPROVAL,
+ "pressing Approve on an approval a message cancelled runs nothing": TUI_TYPED_APPROVAL,
"pressing Approve names who approved on the approval": TUI_SINGLE_PERSON,
"pressing an option names who answered on the question": TUI_SINGLE_PERSON,
"answering a question by text names who answered on the question": TUI_SINGLE_PERSON,
diff --git a/packages/eve/src/internal/testing/channel-conformance/contract.ts b/packages/eve/src/internal/testing/channel-conformance/contract.ts
index b7633fb68..1c003dab9 100644
--- a/packages/eve/src/internal/testing/channel-conformance/contract.ts
+++ b/packages/eve/src/internal/testing/channel-conformance/contract.ts
@@ -12,6 +12,7 @@ import {
PLAIN_TOOL,
type RenderedOption,
REQUESTER_GATED_TOOL,
+ RETRO_DAY_TOOL,
type SentFile,
type Surface,
SECOND_GATED_TOOL,
@@ -20,8 +21,9 @@ import {
} from "#internal/testing/channel-conformance/harness.js";
import {
DAY_PROMPT,
+ RETRO_PROMPT,
TIME_PROMPT,
-} from "#internal/testing/channel-conformance/two-questions-workflow.js";
+} from "#internal/testing/channel-conformance/question-workflows.js";
/**
* One behavior every first-party channel owes a person, stated once and run
@@ -99,6 +101,10 @@ function option(
return found!;
}
+// Neither matches an option, a tool, or a number, so each steers the turn.
+const ASIDE = "Alice also wants the changelog summarized.";
+const FOLLOW_UP = "Alice asks what is still left to do.";
+
const HOTFIX = `Use ${REQUESTER_GATED_TOOL} to ship the fix.`;
const HOTFIX_PROMPT = "Approve Release hotfix?";
@@ -220,9 +226,6 @@ async function expectResponderNamed(conversation: ChannelConversation, prompt: s
* A one-token input budget lets the model call that crosses it finish, so a
* turn that calls a tool is held before the model reads the tool's result.
*/
-// Neither matches an option, a tool, or a number, so it steers the turn.
-const FOLLOW_UP = "Alice asks what is still left to do.";
-
// The smallest valid JPEG (1x1) and PDF, so a channel's media checks accept them.
const DIAGRAM: SentFile = {
bytes: Buffer.from(
@@ -419,20 +422,6 @@ const questionRules = [
expectAnswered(await conversation.waitForToolResult("ask_question"), OWN_WORDS);
},
},
- {
- rule: "pressing an option of an answered question sends it to the agent as new input",
- source: "docs/tools/workflows.mdx#ask-a-human-ctxask",
- requires: ["buttons"],
- async run(conversation) {
- const options = await askWhichDay(conversation);
- const saturday = options.find((option) => option.label === "Saturday");
- expect(saturday, "a Saturday option to press").toBeDefined();
- await conversation.press(saturday!);
- expectAnsweredSaturday(await conversation.waitForToolResult("ask_question"));
- await conversation.press(saturday!);
- await conversation.waitForReplyTo("Saturday");
- },
- },
{
rule: "pressing options of two pending questions answers each with its own option",
source: "docs/tools/workflows.mdx#ask-a-human-ctxask",
@@ -462,6 +451,40 @@ const questionRules = [
});
},
},
+ {
+ rule: "pressing an option of an answered question sends it to the agent as new input",
+ source: "docs/tools/workflows.mdx#ask-a-human-ctxask",
+ requires: ["buttons"],
+ async run(conversation) {
+ const options = await askWhichDay(conversation);
+ const saturday = options.find((option) => option.label === "Saturday");
+ expect(saturday, "a Saturday option to press").toBeDefined();
+ await conversation.press(saturday!);
+ expectAnsweredSaturday(await conversation.waitForToolResult("ask_question"));
+ await conversation.press(saturday!);
+ await conversation.waitForReplyTo("Saturday");
+ },
+ },
+ {
+ rule: "a message while a question without free text is pending withdraws it, and the next message gets a reply",
+ source: "docs/tools/human-in-the-loop.md#how-pause-and-resume-works",
+ requires: ["text-replies"],
+ variesByConversation: true,
+ async run(conversation) {
+ await conversation.say(`Use ${RETRO_DAY_TOOL} to schedule the retro.`);
+ await conversation.waitForQuestion(RETRO_PROMPT);
+ await conversation.say(ASIDE);
+ await conversation.waitForReplyTo(ASIDE);
+ // Once withdrawn, an option label is an ordinary message. A question left open would take it.
+ await conversation.say("Thursday");
+ await conversation.waitForRest();
+ expect(
+ await conversation.sharedText(),
+ `${RETRO_DAY_TOOL} took "Thursday" as an answer after the aside`,
+ ).not.toMatch(/"day":"Thursday"/u);
+ await conversation.waitForReplyTo("Thursday");
+ },
+ },
] as const satisfies readonly ContractRule[];
const approvalRules = [
@@ -497,6 +520,40 @@ const approvalRules = [
await expectDeployed(conversation);
},
},
+ {
+ rule: "pressing Cancel stops the gated tool without running it",
+ source: "docs/tools/human-in-the-loop.md#approvals",
+ requires: ["buttons"],
+ async run(conversation) {
+ const options = await askToDeploy(conversation);
+ const cancel = options.find((option) => CANCEL_LABELS.includes(option.label));
+ expect(cancel, "a Cancel option to press").toBeDefined();
+ await conversation.press(cancel!);
+ await expectNotDeployed(conversation);
+ },
+ },
+ {
+ rule: "a text reply of approve runs the gated tool",
+ source: "docs/tools/human-in-the-loop.md#how-pause-and-resume-works",
+ requires: ["text-replies"],
+ variesByConversation: true,
+ async run(conversation) {
+ await askToDeploy(conversation);
+ await conversation.say("approve");
+ await expectDeployed(conversation);
+ },
+ },
+ {
+ rule: "a text reply of cancel stops the gated tool without running it",
+ source: "docs/tools/human-in-the-loop.md#how-pause-and-resume-works",
+ requires: ["text-replies"],
+ variesByConversation: true,
+ async run(conversation) {
+ await askToDeploy(conversation);
+ await conversation.say("cancel");
+ await expectNotDeployed(conversation);
+ },
+ },
{
rule: "pressing Approve twice runs the gated tool once",
source: "docs/tools/human-in-the-loop.md#approvals",
@@ -527,17 +584,6 @@ const approvalRules = [
expect(conversation.runsOf(SECOND_GATED_TOOL)).toBe(0);
},
},
- {
- rule: "answering an approval and a question pending together settles both",
- source: "docs/tools/human-in-the-loop.md#how-pause-and-resume-works",
- requires: ["buttons"],
- async run(conversation) {
- await conversation.say(ASK_AND_DEPLOY);
- await answerEach(conversation, { [APPROVAL_PROMPT]: APPROVE_LABELS, [PROMPT]: "Saturday" });
- // The turn replies only once both calls settle.
- await expectDeployed(conversation);
- },
- },
{
rule: "text replies answer two pending approvals one at a time, in the order shown",
source: "docs/tools/human-in-the-loop.md#several-requests-at-once",
@@ -551,48 +597,63 @@ const approvalRules = [
},
},
{
- rule: "text replies answer a question and an approval raised together, in the order shown",
- source: "docs/tools/human-in-the-loop.md#several-requests-at-once",
- requires: ["text-replies"],
+ rule: "answering an approval and a question pending together settles both",
+ source: "docs/tools/human-in-the-loop.md#how-pause-and-resume-works",
+ requires: ["buttons"],
async run(conversation) {
await conversation.say(ASK_AND_DEPLOY);
- await conversation.replyToEach({ [PROMPT]: "Saturday", [APPROVAL_PROMPT]: "approve" });
+ await answerEach(conversation, { [APPROVAL_PROMPT]: APPROVE_LABELS, [PROMPT]: "Saturday" });
// The turn replies only once both calls settle.
await expectDeployed(conversation);
},
},
{
- rule: "pressing Cancel stops the gated tool without running it",
- source: "docs/tools/human-in-the-loop.md#approvals",
- requires: ["buttons"],
+ rule: "text replies answer a question and an approval raised together, in the order shown",
+ source: "docs/tools/human-in-the-loop.md#several-requests-at-once",
+ requires: ["text-replies"],
async run(conversation) {
- const options = await askToDeploy(conversation);
- const cancel = options.find((option) => CANCEL_LABELS.includes(option.label));
- expect(cancel, "a Cancel option to press").toBeDefined();
- await conversation.press(cancel!);
- await expectNotDeployed(conversation);
+ await conversation.say(ASK_AND_DEPLOY);
+ await conversation.replyToEach({ [PROMPT]: "Saturday", [APPROVAL_PROMPT]: "approve" });
+ // The turn replies only once both calls settle.
+ await expectDeployed(conversation);
},
},
{
- rule: "a text reply of approve runs the gated tool",
+ rule: "a message while an approval is pending cancels it, so typing approve afterwards runs nothing and the next message gets a reply",
+ // Policy since #4135. #4051 proposes keeping the approval open instead, which flips this rule.
source: "docs/tools/human-in-the-loop.md#how-pause-and-resume-works",
requires: ["text-replies"],
variesByConversation: true,
async run(conversation) {
await askToDeploy(conversation);
+ await conversation.say(ASIDE);
+ await conversation.waitForReplyTo(ASIDE);
await conversation.say("approve");
- await expectDeployed(conversation);
+ await conversation.waitForRest();
+ expect(
+ conversation.runsOf(GATED_TOOL),
+ `${GATED_TOOL} ran on an approval the aside cancelled`,
+ ).toBe(0);
+ await conversation.say(FOLLOW_UP);
+ await conversation.waitForReplyTo(FOLLOW_UP);
},
},
{
- rule: "a text reply of cancel stops the gated tool without running it",
+ rule: "pressing Approve on an approval a message cancelled runs nothing",
source: "docs/tools/human-in-the-loop.md#how-pause-and-resume-works",
- requires: ["text-replies"],
+ requires: ["buttons", "text-replies"],
variesByConversation: true,
async run(conversation) {
- await askToDeploy(conversation);
- await conversation.say("cancel");
- await expectNotDeployed(conversation);
+ const options = await askToDeploy(conversation);
+ await conversation.say(ASIDE);
+ await conversation.waitForReplyTo(ASIDE);
+ // The card's original button, as a client that hasn't refreshed still shows it.
+ await conversation.press(option(options, APPROVE_LABELS));
+ await conversation.waitForRest();
+ expect(
+ conversation.runsOf(GATED_TOOL),
+ `${GATED_TOOL} ran on an approval the aside cancelled`,
+ ).toBe(0);
},
},
] as const satisfies readonly ContractRule[];
diff --git a/packages/eve/src/internal/testing/channel-conformance/harness.ts b/packages/eve/src/internal/testing/channel-conformance/harness.ts
index 9e96a63a1..8dd79af6c 100644
--- a/packages/eve/src/internal/testing/channel-conformance/harness.ts
+++ b/packages/eve/src/internal/testing/channel-conformance/harness.ts
@@ -16,7 +16,10 @@ import { always } from "#tools/approval/policies.js";
import { defineTool } from "#tools/definition.js";
import { askQuestion } from "#tools/provided/ask-question.js";
import { defineWorkflowTool } from "#public/tools/index.js";
-import { askDayAndTimeWorkflow } from "#internal/testing/channel-conformance/two-questions-workflow.js";
+import {
+ askDayAndTimeWorkflow,
+ askRetroDayWorkflow,
+} from "#internal/testing/channel-conformance/question-workflows.js";
import { getWorld } from "#internal/workflow/runtime.js";
import type { MessageStreamEvent } from "#protocol/message.js";
import {
@@ -381,6 +384,9 @@ export interface ConversationOptions {
/** The test agent's tool that asks {@link DAY_PROMPT} and {@link TIME_PROMPT} at once. */
export const TWO_QUESTIONS_TOOL = "plan_review";
+/** The test agent's tool that asks {@link RETRO_PROMPT}, which takes no free text. */
+export const RETRO_DAY_TOOL = "pick_retro_day";
+
/** What a person sees once a tool call settles. */
export type ToolOutcome =
| { readonly kind: "ran"; readonly output: unknown }
@@ -681,6 +687,16 @@ async function converse(
},
() => ({ status: "allowed" }),
),
+ {
+ logicalPath: `tools/${RETRO_DAY_TOOL}.ts`,
+ loadNamespace: async () => ({
+ default: defineWorkflowTool({
+ description: `Schedules a retro. Only call when asked to use ${RETRO_DAY_TOOL}.`,
+ execute: askRetroDayWorkflow,
+ inputSchema: z.object({}),
+ }),
+ }),
+ },
{
logicalPath: `tools/${TWO_QUESTIONS_TOOL}.ts`,
loadNamespace: async () => ({
diff --git a/packages/eve/src/internal/testing/channel-conformance/two-questions-workflow.ts b/packages/eve/src/internal/testing/channel-conformance/question-workflows.ts
similarity index 68%
rename from packages/eve/src/internal/testing/channel-conformance/two-questions-workflow.ts
rename to packages/eve/src/internal/testing/channel-conformance/question-workflows.ts
index 0b79162ae..e17b60c84 100644
--- a/packages/eve/src/internal/testing/channel-conformance/two-questions-workflow.ts
+++ b/packages/eve/src/internal/testing/channel-conformance/question-workflows.ts
@@ -2,6 +2,7 @@ import type { ToolInputResponse, WorkflowToolContext } from "#public/tools/index
export const DAY_PROMPT = "Which day works for the review?";
export const TIME_PROMPT = "Which time works for the review?";
+export const RETRO_PROMPT = "Which day suits the retro?";
/**
* Asks two questions at once, so both are pending together. The test tier's
@@ -20,6 +21,24 @@ export async function askDayAndTimeWorkflow(
return { day: summarize(day), time: summarize(time) };
}
+/**
+ * Asks one question that takes no free text, so a message that matches no option
+ * steers the turn instead of answering it.
+ */
+export async function askRetroDayWorkflow(
+ _input: unknown,
+ ctx: WorkflowToolContext,
+): Promise<{ readonly day: string }> {
+ "use workflow";
+
+ const day = await ctx.ask({
+ display: "select",
+ options: choices("Thursday", "Friday"),
+ prompt: RETRO_PROMPT,
+ });
+ return { day: summarize(day) };
+}
+
function choices(...labels: string[]) {
return labels.map((label) => ({ id: label, label }));
}