Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(runtime): 保留自动任务路由刷新时的思考强度
Dash61ccb94f8fa0
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/groupRuntimeRouteAuthorization.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/groupRuntimeRouteAuthorization.test.tsindex 5c467dcd9c..407fb463c3 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/groupRuntimeRouteAuthorization.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/groupRuntimeRouteAuthorization.test.ts@@ -122,7 +122,7 @@ it.each([true, false])('refreshes after the final deferred-route read (revoked=%let prepared = false;const accept = vi.fn(() => 2);const deps = {- sessionId: 'route-child', model: 'next', effectiveProviderId: 'provider', routeExplicit: true, atomicSelection: undefined,+ sessionId: 'route-child', model: 'next', effectiveProviderId: 'provider', routeExplicit: true, atomicSelection: undefined, currentEffort: null,internalOptions: { source: 'agent', beforeMutation: async () => {if (prepared && revoked) throw new GroupToolAuthorizationError();} },diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex 9b29645615..8f1a4f5f70 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -21907,6 +21907,13 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)return { deferred: false, superseded: true };}const routeExplicit = internalOptions.routeExplicit !== false;+ // Pi configuration refreshes (including scheduled sends) omit selection.+ // Omission must preserve the effective effort, including an explicit null;+ // otherwise the UI and the next send see a different axis from native Pi.+ const currentRuntimeProfile = getSessionRuntimeControlSnapshot(sessionId).effectiveOverride;+ const currentEffort = currentRuntimeProfile+ ? currentRuntimeProfile.effort+ : ((getSessionEffort(sessionId) ?? runtimeStatus.effort ?? null) as SessionRuntimeProfile['effort']);// 同引擎重选是 switch ack 后的第二段写入。另一控制端若在两段之间更新(含// set→clear ABA),修订号已变化:旧 SET_MODEL 必须在任何 route/DB 副作用前让位。if (@@ -22141,6 +22148,7 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)? getSessionProvider(sessionId): (normalizeSessionProviderId(effectiveProviderId) ?? null),atomicSelection,+ currentEffort,currentFastMode: getSessionFastMode(sessionId),}),})@@ -23105,13 +23113,14 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)generation = acceptSessionRuntimeAxisMutation({sessionId,source: internalOptions.source,- profile: {+ profile: buildDeferredRuntimeSelectionProfile({agentKind: maker.getSession(sessionId)?.agentKind ?? meta?.agentKind ?? 'claude-code',model,providerId: getSessionProvider(sessionId),- effort: atomicSelection?.effort ?? previousRuntime.effort ?? null,- fastMode: atomicSelection?.fastMode ?? previousRuntime.fastMode,- },+ atomicSelection,+ currentEffort,+ currentFastMode: previousRuntime.fastMode,+ }),pendingPatch: pendingAxisPatch,});} else {@@ -23121,16 +23130,17 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)source: internalOptions.source,previousProfile: internalOptions.previousProfile,deferred: response.deferred,- profile: {+ profile: buildDeferredRuntimeSelectionProfile({agentKind: maker.getSession(sessionId)?.agentKind ?? meta?.agentKind ?? 'claude-code',model,providerId:effectiveProviderId === undefined? getSessionProvider(sessionId): (normalizeSessionProviderId(effectiveProviderId) ?? null),- effort: atomicSelection?.effort ?? null,- fastMode: atomicSelection?.fastMode ?? getSessionFastMode(sessionId),- },+ atomicSelection,+ currentEffort,+ currentFastMode: getSessionFastMode(sessionId),+ }),});}if (!internalOptions.applyingPiCredentialPending && (rebuildLiveOrcaWorker || modelWindowRebuilt || atomicSelection ||@@ -23184,7 +23194,7 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)const projectionMeta = await maker.getSessionMeta(sessionId);const userBaselineOverride =internalOptions.source === 'user'- ? {+ ? buildDeferredRuntimeSelectionProfile({agentKind:maker.getSession(sessionId)?.agentKind ??projectionMeta?.agentKind ??@@ -23194,13 +23204,10 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)effectiveProviderId === undefined? getSessionProvider(sessionId): (normalizeSessionProviderId(effectiveProviderId) ?? null),- effort:- atomicSelection?.effort ??- (getSessionEffort(sessionId) as SessionRuntimeProfile['effort'] | undefined) ??- projectionMeta?.effort ??- null,- fastMode: atomicSelection?.fastMode ?? getSessionFastMode(sessionId),- }+ atomicSelection,+ currentEffort,+ currentFastMode: getSessionFastMode(sessionId),+ }): undefined;await broadcastSessionRuntimeProjection(sessionId, userBaselineOverride).catch((error) => {log.debug('session runtime projection broadcast failed', {diff --git a/apps/desktop/src/shared/__tests__/runtimeModelSwitchGate.test.ts b/apps/desktop/src/shared/__tests__/runtimeModelSwitchGate.test.tsindex 32ec192d4b..945dbe3415 100644--- a/apps/desktop/src/shared/__tests__/runtimeModelSwitchGate.test.ts+++ b/apps/desktop/src/shared/__tests__/runtimeModelSwitchGate.test.ts@@ -293,20 +293,26 @@ describe('buildDeferredRuntimeSelectionProfile', () => {model: 'local-llama',providerId: 'custom:ollama',atomicSelection: { effort: null, fastMode: false },+ currentEffort: 'xhigh',currentFastMode: true,}).effort,).toBeNull();});- it('without atomic selection, Fast falls back to the live session, effort stays null', () => {+ // Regression: scheduler Pi route refresh omitted atomicSelection and projected+ // null over an xhigh session. Both immediate and queued profiles use this+ // production builder; previous coverage only exercised explicit selections.+ // Unit tier: no native process or database is needed to reproduce the lost axis.+ it.each(['xhigh', null] as const)('route-only refresh preserves current effort %s', (currentEffort) => {expect(buildDeferredRuntimeSelectionProfile({- agentKind: 'codex',- model: 'gpt-5.5',- providerId: 'openai',+ agentKind: 'pi',+ model: 'reasoner',+ providerId: 'custom',+ currentEffort,currentFastMode: true,}),- ).toMatchObject({ effort: null, fastMode: true });+ ).toMatchObject({ effort: currentEffort, fastMode: true });});});diff --git a/apps/desktop/src/shared/runtimeModelSwitchGate.ts b/apps/desktop/src/shared/runtimeModelSwitchGate.tsindex d86bf54cce..712f3826f0 100644--- a/apps/desktop/src/shared/runtimeModelSwitchGate.ts+++ b/apps/desktop/src/shared/runtimeModelSwitchGate.ts@@ -140,7 +140,7 @@ export function shouldSkipColdPiWindowRehydration(input: {);}-/** 回合中登记 pending 时写入的运行时快照:必须带上点选时的 effort / Fast,不能等结算再猜。 */+/** Applied and pending snapshots preserve omitted axes; explicit null clears effort. */export function buildDeferredRuntimeSelectionProfile<TAgent extends string,TEffort extends string | null = string | null,@@ -149,6 +149,7 @@ export function buildDeferredRuntimeSelectionProfile<model: string;providerId: string | null;atomicSelection?: { effort: TEffort; fastMode: boolean | 'ultrafast' } | null;+ currentEffort?: TEffort;currentFastMode: boolean | 'ultrafast';}): {agentKind: TAgent;@@ -161,7 +162,7 @@ export function buildDeferredRuntimeSelectionProfile<agentKind: input.agentKind,model: input.model,providerId: input.providerId,- effort: input.atomicSelection?.effort ?? null,+ effort: input.atomicSelection ? input.atomicSelection.effort : input.currentEffort ?? null,fastMode: input.atomicSelection?.fastMode ?? input.currentFastMode,};}