mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 16:01:34 +00:00
fix(cron): preserve browser tabs for persistent sessions (#113984)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
@@ -187,6 +187,7 @@ describe("runCronIsolatedAgentTurn isolated session identity", () => {
|
||||
expect(runRequest.promptCacheKey).toBeUndefined();
|
||||
expect(runRequest.bootstrapContextMode).toBeUndefined();
|
||||
expect(runRequest.bootstrapContextRunKind).toBe("cron");
|
||||
expect(cleanupBrowserSessionsForLifecycleEndMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each([
|
||||
|
||||
@@ -338,12 +338,15 @@ export async function runCronIsolatedAgentTurn(params: {
|
||||
});
|
||||
} finally {
|
||||
prepared.context.sessionWorkAdmission.release();
|
||||
// Browser ownership follows the detached run identity, not the stable cron job key.
|
||||
await cleanupBrowserSessionsForLifecycleEnd({
|
||||
cfg: prepared.context.cfgWithAgentDefaults,
|
||||
sessionKeys: [prepared.context.runSessionKey],
|
||||
onWarn: (message) => logWarn(`[cron:${params.job.id}] ${message}`),
|
||||
});
|
||||
// Only run-scoped browser identities end with this invocation.
|
||||
// Persistent cron targets keep the session and its tracked tabs alive.
|
||||
if (prepared.context.runSessionKey !== prepared.context.agentSessionKey) {
|
||||
await cleanupBrowserSessionsForLifecycleEnd({
|
||||
cfg: prepared.context.cfgWithAgentDefaults,
|
||||
sessionKeys: [prepared.context.runSessionKey],
|
||||
onWarn: (message) => logWarn(`[cron:${params.job.id}] ${message}`),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user