fix(headless): scope default list_messages to default conversation (#1103)

This commit is contained in:
Charles Packer
2026-02-23 03:26:10 -08:00
committed by GitHub
parent 2b41b32146
commit 7a88f922b9
2 changed files with 9 additions and 1 deletions

View File

@@ -49,6 +49,7 @@ export interface ListMessagesHandlerClient {
order: "asc" | "desc";
before?: string;
after?: string;
conversation_id?: "default";
},
): Promise<AgentsMessagesPage>;
};
@@ -114,6 +115,7 @@ export async function handleListMessages(
const page = await client.agents.messages.list(route.agentId, {
limit,
order,
conversation_id: "default",
...cursorOpts,
});
items = page.items;

View File

@@ -197,9 +197,11 @@ describe("handleListMessages — API call arguments", () => {
const opts = agentListSpy.mock.calls[0]?.[1] as {
limit: number;
order: string;
conversation_id?: string;
};
expect(opts.limit).toBe(50);
expect(opts.order).toBe("desc");
expect(opts.conversation_id).toBe("default");
});
test("forwards before cursor to conversations path", async () => {
@@ -232,8 +234,12 @@ describe("handleListMessages — API call arguments", () => {
client,
});
const opts = agentListSpy.mock.calls[0]?.[1] as { before?: string };
const opts = agentListSpy.mock.calls[0]?.[1] as {
before?: string;
conversation_id?: string;
};
expect(opts.before).toBe("msg-cursor-agents");
expect(opts.conversation_id).toBe("default");
});
test("does not include before/after when absent", async () => {