Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 完善初始边界提交的任务收口
DavidShene50de830b515
diff --git a/apps/desktop/src/renderer/__tests__/authContextSessionBoundary.test.tsx b/apps/desktop/src/renderer/__tests__/authContextSessionBoundary.test.tsxindex 6c72af6a06..8c38650007 100644--- a/apps/desktop/src/renderer/__tests__/authContextSessionBoundary.test.tsx+++ b/apps/desktop/src/renderer/__tests__/authContextSessionBoundary.test.tsx@@ -296,6 +296,24 @@ describe('AuthContext session cache boundaries', () => {expect(view.result.current.dataOwnerId).toBe('local-v1');});+ it('finalizes a committed owner change after a first pending snapshot', async () => {+ mocks.service.initialize.mockResolvedValue({+ ...authState(null),+ ownerGeneration: 1,+ ownerBoundaryPending: true,+ });+ const view = renderHook(() => useAuth(), { wrapper });+ await waitFor(() => expect(view.result.current.dataOwnerId).toBeNull());++ mocks.cancelRemoteOptimisticSendsForDataOwnerBoundary.mockClear();+ act(() => mocks.emitAuth({ ...authState('account-b'), ownerGeneration: 2 }));++ expect(mocks.cancelRemoteOptimisticSendsForDataOwnerBoundary).toHaveBeenLastCalledWith({+ finalizeSessions: true,+ });+ expect(view.result.current.dataOwnerId).toBe('account-b');+ });+it('resets sessions when authentication expires', async () => {renderHook(() => useAuth(), { wrapper });await waitFor(() => expect(mocks.service.initialize).toHaveBeenCalled());diff --git a/apps/desktop/src/renderer/contexts/AuthContext.tsx b/apps/desktop/src/renderer/contexts/AuthContext.tsxindex 68e5850e83..f4fc39cc0b 100644--- a/apps/desktop/src/renderer/contexts/AuthContext.tsx+++ b/apps/desktop/src/renderer/contexts/AuthContext.tsx@@ -286,7 +286,10 @@ export function AuthProvider({}activeDataOwnerGenerationRef.current = state.ownerGeneration;}- const initialOwnerHydration = !hasAppliedAuthStateRef.current && !pendingSignedOutProjection;+ const initialOwnerHydration =+ !hasAppliedAuthStateRef.current+ && !pendingSignedOutProjection+ && !pendingOwnerProjectionRef.current;const unknownOwnerRollbackProjection =pendingOwnerProjectionRef.current&& !pendingSignedOutProjection