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).
This commit is contained in:
Operative-001
2026-02-16 13:48:16 +01:00
committed by Peter Steinberger
parent 57c8f62396
commit 690ec492df

View File

@@ -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 };
}