Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
CR7: 远程设置大补丁部分保存后失败,从主机重读作为新基线
nana5f6fa908c86a
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/remoteBotSettingsTarget.test.ts b/apps/desktop/src/renderer/features/bots/__tests__/remoteBotSettingsTarget.test.tsindex 8fba3ce8f8..81421a653c 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/remoteBotSettingsTarget.test.ts+++ b/apps/desktop/src/renderer/features/bots/__tests__/remoteBotSettingsTarget.test.ts@@ -163,3 +163,20 @@ it('offers only the pages whose operations the host implements', () => {// The Home folder is a path on the teammate's computer: no remote host ever offers it.expect(remoteBotSettingsPages(new Set(ALL_OPS)).has('advanced')).toBe(false);});++it('starts again from the host profile, not from the old one, when a later part of a split patch fails after an earlier one was saved', async () => {+ const { target, profiles } = create();+ host.invoke.mockResolvedValueOnce(ok({ profile: profile() }));+ await profiles.load();+ const long = '字'.repeat(12_000);+ host.invoke+ .mockResolvedValueOnce(ok({ profile: profile({ avatarColor: 'blue' }) }))+ .mockResolvedValueOnce(ok({ profile: profile({ avatarColor: 'blue', identitySource: long }) }))+ .mockResolvedValueOnce(refused('INTERNAL', 'Computer went away'))+ // The re-read after the failure: the first two parts are on the computer.+ .mockResolvedValueOnce(ok({ profile: profile({ avatarColor: 'blue', identitySource: long }) }));+ await expect(target.profile.update('bot-1', { identitySource: long, userContextSource: long, avatarColor: 'blue' }))+ .rejects.toSatisfy((error) => extractIpcError(error)?.code === 'INTERNAL');+ expect(sent(4)).toMatchObject({ input: { op: 'profile.get' } });+ expect(profiles.get()).toMatchObject({ avatarColor: 'blue', identitySource: long, userContextSource: '' });+});diff --git a/apps/desktop/src/renderer/features/bots/remoteBotSettingsTarget.ts b/apps/desktop/src/renderer/features/bots/remoteBotSettingsTarget.tsindex 2aa85bac24..bb273afd32 100644--- a/apps/desktop/src/renderer/features/bots/remoteBotSettingsTarget.ts+++ b/apps/desktop/src/renderer/features/bots/remoteBotSettingsTarget.ts@@ -71,9 +71,13 @@ export function createRemoteProfileStore(deviceId: string, botId: string) {...(capabilityBaseline ? { capabilityBaseline } : {}),...(profilePatch.avatar !== undefined ? { expectedAvatar: before.avatar } : {}),};+ let saved = 0;try {let raw: unknown;- for (const part of splitProfilePatch(body)) raw = await invokeBotSettings(deviceId, 'profile.update', botId, { patch: part });+ for (const part of splitProfilePatch(body)) {+ raw = await invokeBotSettings(deviceId, 'profile.update', botId, { patch: part });+ saved += 1;+ }const next = normalizeDbProfile((raw as { profile?: unknown } | null)?.profile);if (!next) throw createIpcError('INTERNAL', 'Invalid teammate profile');// A newer write on this profile is closer to what the person wants now.@@ -84,8 +88,15 @@ export function createRemoteProfileStore(deviceId: string, botId: string) {return next;} catch (error) {if (generation === writeGeneration) {- profile = before;- emit();+ // A large patch goes in several requests: when an earlier one is already saved on the+ // computer, `before` is no longer what it holds, so the page starts again from what it has.+ let reread: unknown = null;+ if (saved > 0) reread = await invokeBotSettings(deviceId, 'profile.get', botId).catch(() => null);+ if (reread && normalizeDbProfile((reread as { profile?: unknown }).profile)) adopt(reread);+ else {+ profile = before;+ emit();+ }}throw error;} finally {