diff --git a/internal/cloud/server-workbench-http.ts b/internal/cloud/server-workbench-http.ts index e4e50c58..0214304a 100644 --- a/internal/cloud/server-workbench-http.ts +++ b/internal/cloud/server-workbench-http.ts @@ -1446,7 +1446,9 @@ async function handleWorkbenchMessagePage(request, response, url, options, actor } const messages = factMessagesForSession(session, result.facts); const limit = boundedLimit(url.searchParams.get("limit")); - const offset = cursorOffset(url.searchParams.get("cursor") ?? url.searchParams.get("after")); + const cursorParam = url.searchParams.get("cursor") ?? url.searchParams.get("after"); + const hasCursor = Boolean(textValue(cursorParam)); + const offset = hasCursor ? cursorOffset(cursorParam) : Math.max(0, messages.length - limit); const page = messages.slice(offset, offset + limit); const nextOffset = offset + page.length; const resolvedSessionId = factSessionId(session);