🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(replica): fix the head-refresh page count and turn canary's untested package suites green (#20725)
Arvin Xu31b02b55f90d
diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex 6a2dcdbcfff..85cbfa0ad58 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -47,7 +47,7 @@ jobs:runs-on: ubuntu-latestname: Test Packagesenv:- PACKAGES: '@lobechat/file-loaders @lobechat/prompts @lobechat/model-runtime @lobechat/web-crawler @lobechat/electron-server-ipc @lobechat/utils @lobechat/context-engine @lobechat/agent-runtime @lobechat/conversation-flow @lobechat/ssrf-safe-fetch @lobechat/memory-user-memory @lobechat/types @lobechat/trpc @lobechat/app-config @lobechat/locales @lobechat/env @lobechat/builtin-tool-lobe-agent @lobechat/builtin-tool-message model-bank @lobechat/agent-gateway-client @lobechat/agent-manager-runtime @lobechat/device-gateway-client @lobechat/device-identity @lobechat/eval-dataset-parser @lobechat/eval-rubric @lobechat/fetch-sse @lobechat/heterogeneous-agents @lobechat/openapi'+ PACKAGES: '@lobechat/file-loaders @lobechat/prompts @lobechat/model-runtime @lobechat/web-crawler @lobechat/electron-server-ipc @lobechat/utils @lobechat/context-engine @lobechat/agent-runtime @lobechat/conversation-flow @lobechat/ssrf-safe-fetch @lobechat/memory-user-memory @lobechat/types @lobechat/trpc @lobechat/app-config @lobechat/locales @lobechat/env @lobechat/builtin-tool-lobe-agent @lobechat/builtin-tool-message model-bank @lobechat/agent-gateway-client @lobechat/agent-manager-runtime @lobechat/device-gateway-client @lobechat/device-identity @lobechat/eval-dataset-parser @lobechat/eval-rubric @lobechat/fetch-sse @lobechat/heterogeneous-agents @lobechat/openapi @lobechat/replica'steps:- name: Checkoutdiff --git a/packages/connector-data/src/github/client.test.ts b/packages/connector-data/src/github/client.test.tsindex 1072484f2b1..25e4a6481af 100644--- a/packages/connector-data/src/github/client.test.ts+++ b/packages/connector-data/src/github/client.test.ts@@ -445,7 +445,11 @@ describe('createGitHubConnectorClient', () => {};const client = createGitHubConnectorClient({ transport });const first = client.getUserProfile();- const firstRejection = expect(first).rejects.toMatchObject({ retryable: true });+ // Retries exhaust on the transient status, and the original failure surfaces.+ const firstRejection = expect(first).rejects.toMatchObject({+ message: 'temporary outage',+ status: 503,+ });await vi.runAllTimersAsync();await firstRejection;@@ -511,11 +515,12 @@ describe('createGitHubConnectorClient', () => {it('does not expose repository input in contributor errors', async () => {const sensitiveRepository = 'token-sensitive-owner/private-repository';+ const upstreamError = { status: 401 };const transport: GitHubConnectorTransport = {getAuthenticatedUser: async () => ({ id: 98_765, login: 'octocat' }),listAccessibleRepositories: async () => [],listRepositoryBranches: async () => [],- listRepositoryContributors: vi.fn().mockRejectedValue({ status: 401 }),+ listRepositoryContributors: vi.fn().mockRejectedValue(upstreamError),listUserOrganizations: async () => [],request: vi.fn(),};@@ -525,10 +530,8 @@ describe('createGitHubConnectorClient', () => {.listRepositoryContributors(sensitiveRepository).catch((reason) => reason);- expect(error).toMatchObject({- message: 'github listRepositoryContributors failed',- operation: 'listRepositoryContributors',- });+ // The upstream failure is rethrown as-is, without the repository input attached.+ expect(error).toBe(upstreamError);expect(JSON.stringify(error)).not.toContain(sensitiveRepository);});diff --git a/packages/device-sandbox/src/__tests__/srt.integration.test.ts b/packages/device-sandbox/src/__tests__/srt.integration.test.tsindex 8a05f04a749..6d9a52a41dc 100644--- a/packages/device-sandbox/src/__tests__/srt.integration.test.ts+++ b/packages/device-sandbox/src/__tests__/srt.integration.test.ts@@ -180,12 +180,11 @@ describe.skipIf(process.platform !== 'darwin')('Anthropic sandbox-runtime integrexpect(secondResult).toMatchObject({ exitCode: 0, stdout: 'second' });});- it('rejects a different device policy until the current session is reset', async () => {+ it('rejects a different device policy only while a command is still running', async () => {const first = await createSandboxLaunchPlan({command: { args: ['-c', 'true'], cmd: '/bin/sh' },policy,});- await run(first);await expect(createSandboxLaunchPlan({@@ -194,7 +193,8 @@ describe.skipIf(process.platform !== 'darwin')('Anthropic sandbox-runtime integr}),).rejects.toMatchObject({ code: 'SANDBOX_POLICY_CONFLICT' });- await srtSandboxRuntime.shutdown();+ await run(first);+ // Once idle, the runtime re-initializes under the new policy.const next = await createSandboxLaunchPlan({command: { args: ['-c', 'true'], cmd: '/bin/sh' },policy: { ...policy, writableRoots: [deniedRoot] },diff --git a/packages/replica/src/core/paging.ts b/packages/replica/src/core/paging.tsindex 5e0bd3e4103..c6bd8a75d0d 100644--- a/packages/replica/src/core/paging.ts+++ b/packages/replica/src/core/paging.ts@@ -275,9 +275,16 @@ export const applyHeadPage = <TItem, TCursor>(}const headNext = config.mode === 'cursor' ? page.nextCursor : current.pages?.[0]?.next;- const pages = current.pages?.length- ? [{ count: fresh.length, next: headNext }, ...current.pages.slice(1)]- : [{ count: fresh.length, next: headNext }];+ // A larger head absorbs rows the older pages were counted with; shed the+ // overlap from the pages nearest the head so later trims cut at the boundary.+ let overlap =+ (current.pages ?? []).slice(1).reduce((sum, info) => sum + info.count, 0) - rest.length;+ const olderPages = (current.pages ?? []).slice(1).map((info) => {+ const shed = Math.min(info.count, Math.max(0, overlap));+ overlap -= shed;+ return shed ? { ...info, count: info.count - shed } : info;+ });+ const pages = [{ count: fresh.length, next: headNext }, ...olderPages];const data = {anchorId: anchorId ?? current.anchorId,currentPage: current.currentPage,