mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
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:
committed by
Peter Steinberger
parent
57c8f62396
commit
690ec492df
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user