Skip to content

Commit e02c8df

Browse files
test(tools): Cover top-level executeTool intent through the agent loop
Co-Authored-By: Aditya Mathur <[email protected]>
1 parent f2cc938 commit e02c8df

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎packages/junior/tests/integration/annotation-cards.test.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const readResult = () => ({
5858
afterEach(closeConversationFixture);
5959

6060
it("saves plugin object results once per reply, rejects them from reads, leaves background updates silent, and stores only Message card references", async () => {
61+
const saveInputs: unknown[] = [];
6162
const previous = setPlugins([
6263
defineJuniorPlugin({
6364
manifest: {
@@ -83,7 +84,9 @@ it("saves plugin object results once per reply, rejects them from reads, leaves
8384
status: z.string().optional(),
8485
}),
8586
outputSchema: pluginToolOutputSchema,
86-
execute: ({ fail, timed_out, status }) => {
87+
execute: (input) => {
88+
saveInputs.push(input);
89+
const { fail, timed_out, status } = input;
8790
if (fail) throw new Error("Object update failed");
8891
return {
8992
timed_out,
@@ -121,7 +124,12 @@ it("saves plugin object results once per reply, rejects them from reads, leaves
121124
{
122125
type: "toolCall",
123126
name: "executeTool",
124-
arguments: { tool_name: "objects_save", arguments: {} },
127+
// callMcpTool takes a top-level intent too, so models send it here.
128+
arguments: {
129+
tool_name: "objects_save",
130+
arguments: { status: "open" },
131+
intent: "show the object",
132+
},
125133
},
126134
// A read must not save an Annotation, so core rejects its result.
127135
{ type: "toolCall", name: "objects_read", arguments: {} },
@@ -152,6 +160,7 @@ it("saves plugin object results once per reply, rejects them from reads, leaves
152160
message: "Show the object.",
153161
});
154162
await harness.drain();
163+
expect(saveInputs[0]).toEqual({ status: "open" });
155164
const history =
156165
await getConversationEventStore().loadHistory(conversationId);
157166
const message = history.find(

0 commit comments

Comments
 (0)