fix: isolate concurrent OpenCode chat runs

This commit is contained in:
brother7 committed 2026-08-17 22:03:37 +08:00
1 parent 7e8d9e3811
commit 65040730ec
29 files changed
+5207 -427

No files matched your search

+36 -1
View File
@@ -135,7 +135,42 @@ describe('ProvidersSettings', () => {
render(<ProvidersSettings />);
await waitFor(() => {
expect(providerState.importUserModelConfig).toHaveBeenCalledWith('access-token');
expect(providerState.importUserModelConfig).toHaveBeenCalledWith('access-token', {
runtimeRefresh: 'defer',
});
});
});
it('applies a pending runtime refresh only after the user explicitly syncs models', async () => {
authState.accessToken = 'access-token';
providerState.importUserModelConfig = vi.fn()
.mockResolvedValueOnce({
account: baseProviderState.accounts[0],
importedModels: ['gpt-4.1-mini'],
runtimeRefreshRequired: true,
})
.mockResolvedValueOnce({
account: baseProviderState.accounts[0],
importedModels: ['gpt-4.1-mini'],
runtimeRefreshRequired: true,
});
render(<ProvidersSettings />);
expect(await screen.findByTestId('providers-runtime-refresh-pending')).toBeVisible();
expect(providerState.importUserModelConfig).toHaveBeenNthCalledWith(1, 'access-token', {
runtimeRefresh: 'defer',
});
fireEvent.click(screen.getByTestId('providers-sync-user-models-button'));
await waitFor(() => {
expect(providerState.importUserModelConfig).toHaveBeenNthCalledWith(2, 'access-token', {
runtimeRefresh: 'apply',
});
});
await waitFor(() => {
expect(screen.queryByTestId('providers-runtime-refresh-pending')).not.toBeInTheDocument();
});
});
});