diff --git a/src/agent/check-approval.ts b/src/agent/check-approval.ts index c4be991..d105c4a 100644 --- a/src/agent/check-approval.ts +++ b/src/agent/check-approval.ts @@ -474,23 +474,24 @@ export async function getResumeData( const retrievedMessages = await client.messages.retrieve(lastInContextId); // Fetch message history for backfill through the default conversation route. - // Default conversation is represented by the agent id at the conversations endpoint. + // Default conversation uses the "default" sentinel plus agent_id as a query param. // Wrapped in try/catch so backfill failures don't crash the CLI (e.g., older servers // may not support this pattern) if (includeMessageHistory && isBackfillEnabled()) { try { const messagesPage = await client.conversations.messages.list( - agent.id, + "default", { limit: BACKFILL_PAGE_LIMIT, order: "desc", + agent_id: agent.id, }, ); messages = sortChronological(messagesPage.getPaginatedItems()); if (process.env.DEBUG) { console.log( - `[DEBUG] conversations.messages.list(${agent.id}) returned ${messages.length} messages`, + `[DEBUG] conversations.messages.list(default, agent_id=${agent.id}) returned ${messages.length} messages`, ); } } catch (backfillError) { diff --git a/src/cli/components/ConversationSelector.tsx b/src/cli/components/ConversationSelector.tsx index fa7fea2..72ecde8 100644 --- a/src/cli/components/ConversationSelector.tsx +++ b/src/cli/components/ConversationSelector.tsx @@ -243,11 +243,11 @@ export function ConversationSelector({ if (!afterCursor) { try { const defaultMessages = await client.conversations.messages.list( - // Default conversation is represented by the agent id at the conversations endpoint. - agentId, + "default", { limit: 20, order: "desc", + agent_id: agentId, }, ); const defaultMsgItems = defaultMessages.getPaginatedItems(); diff --git a/src/cli/subcommands/messages.ts b/src/cli/subcommands/messages.ts index 03874de..193770c 100644 --- a/src/cli/subcommands/messages.ts +++ b/src/cli/subcommands/messages.ts @@ -159,12 +159,12 @@ export async function runMessagesSubcommand(argv: string[]): Promise { return 1; } - // Default conversation is represented by the agent id at the conversations endpoint. - const response = await client.conversations.messages.list(agentId, { + const response = await client.conversations.messages.list("default", { limit: parseLimit(parsed.values.limit, 20), after: parsed.values.after, before: parsed.values.before, order, + agent_id: agentId, }); const messages = response.getPaginatedItems() ?? [];