mirror of https://github.com/openclaw/openclaw.git
fix: archive session behavior
This commit is contained in:
parent
5d0dbd3823
commit
5449b3b46a
|
|
@ -442,7 +442,7 @@ export async function initSessionState(params: {
|
|||
archivedAt: baseEntry?.archivedAt,
|
||||
};
|
||||
if (typeof sessionEntry.archivedAt === "number") {
|
||||
delete sessionEntry.archivedAt;
|
||||
sessionEntry.archivedAt = null;
|
||||
}
|
||||
const metaPatch = deriveSessionMetaPatch({
|
||||
ctx: sessionCtxForState,
|
||||
|
|
|
|||
|
|
@ -217,14 +217,16 @@ export const sessionsHandlers: GatewayRequestHandlers = {
|
|||
const wasArchived = typeof applied.previous?.archivedAt === "number";
|
||||
const isArchived = typeof applied.entry.archivedAt === "number";
|
||||
if (!wasArchived && isArchived) {
|
||||
void writeSessionArchiveSummary({
|
||||
cfg,
|
||||
key: target.canonicalKey ?? key,
|
||||
entry: applied.entry,
|
||||
storePath,
|
||||
archivedAt: applied.entry.archivedAt ?? undefined,
|
||||
}).catch((err) => {
|
||||
console.warn(`sessions.patch archive summary failed: ${String(err)}`);
|
||||
setImmediate(() => {
|
||||
void writeSessionArchiveSummary({
|
||||
cfg,
|
||||
key: target.canonicalKey ?? key,
|
||||
entry: applied.entry,
|
||||
storePath,
|
||||
archivedAt: applied.entry.archivedAt ?? undefined,
|
||||
}).catch((err) => {
|
||||
console.warn(`sessions.patch archive summary failed: ${String(err)}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ export async function resolveSessionKeyFromResolveParams(params: {
|
|||
opts: {
|
||||
includeGlobal: p.includeGlobal === true,
|
||||
includeUnknown: p.includeUnknown === true,
|
||||
includeArchived: true,
|
||||
spawnedBy: p.spawnedBy,
|
||||
agentId: p.agentId,
|
||||
search: sessionId,
|
||||
|
|
@ -119,6 +120,7 @@ export async function resolveSessionKeyFromResolveParams(params: {
|
|||
opts: {
|
||||
includeGlobal: p.includeGlobal === true,
|
||||
includeUnknown: p.includeUnknown === true,
|
||||
includeArchived: true,
|
||||
label: parsedLabel.label,
|
||||
agentId: p.agentId,
|
||||
spawnedBy: p.spawnedBy,
|
||||
|
|
|
|||
Loading…
Reference in New Issue