fix(engine): make heartbeat helper imports static to fail fast on partial dist
Convert the dynamic await import("./agent-session-helpers.js") and
await import("./session-skill-context.js") calls inside the heartbeat
executor to static top-level imports, matching the rationale of
38933c770 (which already made the sibling pi.js import static).
This surfaces ERR_MODULE_NOT_FOUND at engine load time rather than
mid-heartbeat when a worktree is on a branch missing the helpers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
9
.changeset/heartbeat-static-helper-imports.md
Normal file
9
.changeset/heartbeat-static-helper-imports.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
"@runfusion/fusion": patch
|
||||
---
|
||||
|
||||
Convert the heartbeat executor's dynamic `import("./agent-session-helpers.js")`
|
||||
and `import("./session-skill-context.js")` calls to static imports. This makes
|
||||
missing or partial engine dist surface at module load time (matching the
|
||||
existing static `pi.js` import) instead of failing mid-heartbeat with a
|
||||
confusing `ERR_MODULE_NOT_FOUND`.
|
||||
@@ -33,6 +33,8 @@ import {
|
||||
import { heartbeatLog, formatError } from "./logger.js";
|
||||
import { createRunAuditor, type EngineRunContext } from "./run-audit.js";
|
||||
import { promptWithFallback } from "./pi.js";
|
||||
import { createResolvedAgentSession, extractRuntimeHint, extractRuntimeModel } from "./agent-session-helpers.js";
|
||||
import { buildSessionSkillContextSync } from "./session-skill-context.js";
|
||||
import type { AgentReflectionService } from "./agent-reflection.js";
|
||||
|
||||
interface SelfImproveServiceLike {
|
||||
@@ -1598,9 +1600,6 @@ export class HeartbeatMonitor {
|
||||
},
|
||||
};
|
||||
|
||||
const { createResolvedAgentSession, extractRuntimeHint, extractRuntimeModel } = await import("./agent-session-helpers.js");
|
||||
const { buildSessionSkillContextSync } = await import("./session-skill-context.js");
|
||||
|
||||
// Build tools with task creation tracking and run context for mutation correlation
|
||||
// For no-task runs, exclude fn_task_log and document tools (they require a taskId)
|
||||
let heartbeatTools: ToolDefinition[];
|
||||
|
||||
Reference in New Issue
Block a user