From 690ec492df3206acc8b6a88a62ce612c38061f59 Mon Sep 17 00:00:00 2001 From: Operative-001 Date: Mon, 16 Feb 2026 13:48:16 +0100 Subject: [PATCH] refactor: remove redundant field assignments in resolveCronSession Addresses Greptile review comment: when !isNewSession, the spread already copies all entry fields. The explicit entry?.field assignments were redundant and could cause confusion. Simplified to only override the core fields (sessionId, updatedAt, systemSent). --- src/cron/isolated-agent/session.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/cron/isolated-agent/session.ts b/src/cron/isolated-agent/session.ts index 1e1442eb4c9..fcc2579cbd8 100644 --- a/src/cron/isolated-agent/session.ts +++ b/src/cron/isolated-agent/session.ts @@ -60,24 +60,12 @@ export function resolveCronSession(params: { const sessionEntry: SessionEntry = { // Spread existing entry to preserve conversation context when reusing + // (the spread already copies all fields when !isNewSession, no need to re-assign) ...(isNewSession ? undefined : entry), + // Always update these core fields sessionId, updatedAt: params.nowMs, systemSent, - // Preserve user preferences from existing entry - thinkingLevel: entry?.thinkingLevel, - verboseLevel: entry?.verboseLevel, - model: entry?.model, - modelOverride: entry?.modelOverride, - providerOverride: entry?.providerOverride, - contextTokens: entry?.contextTokens, - sendPolicy: entry?.sendPolicy, - lastChannel: entry?.lastChannel, - lastTo: entry?.lastTo, - lastAccountId: entry?.lastAccountId, - label: entry?.label, - displayName: entry?.displayName, - skillsSnapshot: entry?.skillsSnapshot, }; return { storePath, store, sessionEntry, systemSent, isNewSession }; }