fix: preserve heartbeat wake compatibility (#76086)

This commit is contained in:
Peter Steinberger
2026-05-02 14:39:56 +01:00
parent c06739d773
commit c6817d8d7a
4 changed files with 6 additions and 3 deletions

View File

@@ -441,6 +441,7 @@ describe("emitExecSystemEvent", () => {
to: "telegram:-100123:topic:47",
threadId: 47,
},
trusted: false,
});
expect(requestHeartbeatMock).toHaveBeenCalledWith(
expect.objectContaining({
@@ -460,6 +461,7 @@ describe("emitExecSystemEvent", () => {
expect(enqueueSystemEventMock).toHaveBeenCalledWith("Exec finished", {
sessionKey: "global",
contextKey: "exec:run-global",
trusted: false,
});
expect(requestHeartbeatMock).toHaveBeenCalledWith(
expect.objectContaining({

View File

@@ -426,6 +426,7 @@ export function emitExecSystemEvent(
sessionKey,
contextKey: opts.contextKey,
deliveryContext: opts.deliveryContext,
trusted: false,
});
requestHeartbeat(
scopedHeartbeatWakeOptions(sessionKey, {

View File

@@ -185,7 +185,7 @@ describe("plugin runtime command execution", () => {
expectRuntimeValue(readValue, expected);
});
it("maps deprecated runtime.system.requestHeartbeatNow to a structured event wake", async () => {
it("maps deprecated runtime.system.requestHeartbeatNow to an immediate compatibility wake", async () => {
vi.useFakeTimers();
resetHeartbeatWakeStateForTests();
const handler = vi.fn(async () => ({ status: "skipped" as const, reason: "disabled" }));
@@ -199,7 +199,7 @@ describe("plugin runtime command execution", () => {
expect(handler).toHaveBeenCalledWith(
expect.objectContaining({
source: "other",
intent: "event",
intent: "immediate",
reason: "legacy-plugin",
}),
);

View File

@@ -18,7 +18,7 @@ export function createRuntimeSystem(): PluginRuntime["system"] {
const requestHeartbeatNow: PluginRuntime["system"]["requestHeartbeatNow"] = (opts) =>
requestHeartbeat({
source: opts?.source ?? "other",
intent: opts?.intent ?? "event",
intent: opts?.intent ?? "immediate",
reason: opts?.reason,
coalesceMs: opts?.coalesceMs,
agentId: opts?.agentId,