mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 08:41:13 +00:00
fix(ci): remove duplicated heartbeat prompt setup
This commit is contained in:
@@ -642,42 +642,6 @@ export async function runHeartbeatOnce(opts: {
|
||||
// sending the full conversation history (~100K tokens) to the LLM.
|
||||
// Delivery routing still uses the main session entry (lastChannel, lastTo).
|
||||
const useIsolatedSession = heartbeat?.isolatedSession === true;
|
||||
const canRelayToUser = Boolean(
|
||||
delivery.channel !== "none" && delivery.to && visibility.showAlerts,
|
||||
);
|
||||
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
||||
const { prompt, hasExecCompletion, hasCronEvents } = resolveHeartbeatRunPrompt({
|
||||
cfg,
|
||||
heartbeat,
|
||||
preflight,
|
||||
canRelayToUser,
|
||||
workspaceDir,
|
||||
startedAt,
|
||||
heartbeatFileContent: preflight.heartbeatFileContent,
|
||||
});
|
||||
|
||||
// If no tasks are due, skip heartbeat entirely (including isolated session creation)
|
||||
if (prompt === null) {
|
||||
return { status: "skipped", reason: "no-tasks-due" };
|
||||
}
|
||||
|
||||
let runSessionKey = sessionKey;
|
||||
let runStorePath = storePath;
|
||||
if (useIsolatedSession) {
|
||||
const isolatedKey = `${sessionKey}:heartbeat`;
|
||||
const cronSession = resolveCronSession({
|
||||
cfg,
|
||||
sessionKey: isolatedKey,
|
||||
agentId,
|
||||
nowMs: startedAt,
|
||||
forceNew: true,
|
||||
});
|
||||
cronSession.store[isolatedKey] = cronSession.sessionEntry;
|
||||
await saveSessionStore(cronSession.storePath, cronSession.store);
|
||||
runSessionKey = isolatedKey;
|
||||
runStorePath = cronSession.storePath;
|
||||
}
|
||||
|
||||
const delivery = resolveHeartbeatDeliveryTarget({
|
||||
cfg,
|
||||
entry,
|
||||
@@ -734,6 +698,23 @@ export async function runHeartbeatOnce(opts: {
|
||||
return { status: "skipped", reason: "no-tasks-due" };
|
||||
}
|
||||
|
||||
let runSessionKey = sessionKey;
|
||||
let runStorePath = storePath;
|
||||
if (useIsolatedSession) {
|
||||
const isolatedKey = `${sessionKey}:heartbeat`;
|
||||
const cronSession = resolveCronSession({
|
||||
cfg,
|
||||
sessionKey: isolatedKey,
|
||||
agentId,
|
||||
nowMs: startedAt,
|
||||
forceNew: true,
|
||||
});
|
||||
cronSession.store[isolatedKey] = cronSession.sessionEntry;
|
||||
await saveSessionStore(cronSession.storePath, cronSession.store);
|
||||
runSessionKey = isolatedKey;
|
||||
runStorePath = cronSession.storePath;
|
||||
}
|
||||
|
||||
// Update task last run times AFTER successful heartbeat completion
|
||||
const updateTaskTimestamps = async () => {
|
||||
if (!preflight.tasks || preflight.tasks.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user