fix: migrate default conversation API usage to SDK 1.7.11 pattern (#1256)

Co-authored-by: Letta Code <noreply@letta.com>
This commit is contained in:
cthomas
2026-03-03 22:48:49 -08:00
committed by GitHub
parent a44c16edc7
commit 4111c546d3
18 changed files with 116 additions and 110 deletions

View File

@@ -5819,11 +5819,12 @@ export default function App({
// causing CONFLICT on the next user message.
getClient()
.then((client) => {
const cancelId =
conversationIdRef.current === "default"
? agentIdRef.current
: conversationIdRef.current;
return client.conversations.cancel(cancelId);
if (conversationIdRef.current === "default") {
return client.conversations.cancel("default", {
agent_id: agentIdRef.current,
});
}
return client.conversations.cancel(conversationIdRef.current);
})
.catch(() => {
// Silently ignore - cancellation already happened client-side
@@ -5938,11 +5939,12 @@ export default function App({
// Don't wait for it or show errors since user already got feedback
getClient()
.then((client) => {
const cancelId =
conversationIdRef.current === "default"
? agentIdRef.current
: conversationIdRef.current;
return client.conversations.cancel(cancelId);
if (conversationIdRef.current === "default") {
return client.conversations.cancel("default", {
agent_id: agentIdRef.current,
});
}
return client.conversations.cancel(conversationIdRef.current);
})
.catch(() => {
// Silently ignore - cancellation already happened client-side
@@ -5962,11 +5964,13 @@ export default function App({
setInterruptRequested(true);
try {
const client = await getClient();
const cancelId =
conversationIdRef.current === "default"
? agentIdRef.current
: conversationIdRef.current;
await client.conversations.cancel(cancelId);
if (conversationIdRef.current === "default") {
await client.conversations.cancel("default", {
agent_id: agentIdRef.current,
});
} else {
await client.conversations.cancel(conversationIdRef.current);
}
if (abortControllerRef.current) {
abortControllerRef.current.abort();
@@ -6174,9 +6178,7 @@ export default function App({
// Build success message
const agentLabel = agent.name || targetAgentId;
const isSpecificConv =
opts?.conversationId &&
opts.conversationId !== "default" &&
!opts?.conversationId.startsWith("agent-");
opts?.conversationId && opts.conversationId !== "default";
const successOutput = isSpecificConv
? [
`Switched to **${agentLabel}**`,
@@ -8047,13 +8049,17 @@ export default function App({
}
: undefined;
const compactId =
conversationIdRef.current === "default"
? agentId
: conversationIdRef.current;
const compactConversationId = conversationIdRef.current;
const compactBody =
compactConversationId === "default"
? {
agent_id: agentId,
...(compactParams ?? {}),
}
: compactParams;
const result = await client.conversations.messages.compact(
compactId,
compactParams,
compactConversationId,
compactBody,
);
// Format success message with before/after counts and summary

View File

@@ -177,9 +177,7 @@ export const AgentInfoBar = memo(function AgentInfoBar({
{/* Phantom alien row + Conversation ID */}
<Box>
<Text>{alienLines[3]}</Text>
{conversationId &&
conversationId !== "default" &&
!conversationId.startsWith("agent-") ? (
{conversationId && conversationId !== "default" ? (
<Box width={rightWidth} flexShrink={1}>
<Text dimColor wrap="truncate-end">
{truncateText(conversationId, rightWidth)}

View File

@@ -243,8 +243,9 @@ export function ConversationSelector({
if (!afterCursor) {
try {
const defaultMessages = await client.conversations.messages.list(
agentId,
"default",
{
agent_id: agentId,
limit: 20,
order: "desc",
},

View File

@@ -180,7 +180,7 @@ export async function discoverFallbackRunIdForResume(
}> = [];
if (ctx.conversationId === "default") {
// Default conversation routes through resolvedConversationId (typically agent ID).
// Default conversation lookup by conversation id first.
lookupQueries.push({ conversation_id: ctx.resolvedConversationId });
} else {
// Named conversation: first use the explicit conversation id.

View File

@@ -159,7 +159,8 @@ export async function runMessagesSubcommand(argv: string[]): Promise<number> {
return 1;
}
const response = await client.conversations.messages.list(agentId, {
const response = await client.conversations.messages.list("default", {
agent_id: agentId,
limit: parseLimit(parsed.values.limit, 20),
after: parsed.values.after,
before: parsed.values.before,