Stop heartbeat tool turns from asking for HEARTBEAT_OK (#76338)

* fix heartbeat tool prompt sentinel

* fix: remove agent runtime fallback config
This commit is contained in:
pashpashpash
2026-05-02 21:46:26 -07:00
committed by GitHub
parent 775c27433f
commit 8f4eaa9c00
58 changed files with 603 additions and 595 deletions

View File

@@ -210,16 +210,16 @@ This is the deterministic model-bound layer stack OpenClaw can snapshot for the
"roughTokens": 1934
},
"totalTextOnly": {
"chars": 30483,
"roughTokens": 7621
"chars": 30623,
"roughTokens": 7656
},
"totalWithDynamicToolsJson": {
"chars": 81357,
"roughTokens": 20340
"chars": 81497,
"roughTokens": 20375
},
"userInputText": {
"chars": 468,
"roughTokens": 117
"chars": 608,
"roughTokens": 152
}
}
```
@@ -544,7 +544,7 @@ Sender (untrusted metadata):
}
```
Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.
Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. Use heartbeat_respond to report the wake outcome. Set notify=false when nothing needs the user's attention. Set notify=true with notificationText only when the user should be interrupted.
````
### Tools: Dynamic Tool Catalog

View File

@@ -1,7 +1,7 @@
import fs from "node:fs";
import path from "node:path";
import type { Api, Model } from "@mariozechner/pi-ai";
import { HEARTBEAT_PROMPT } from "../../../src/auto-reply/heartbeat.js";
import { resolveHeartbeatPromptForResponseTool } from "../../../src/auto-reply/heartbeat.js";
import {
buildDirectChatContext,
buildGroupChatContext,
@@ -403,8 +403,8 @@ function createScenarios(): PromptScenario[] {
const heartbeatCtx: TemplateContext = {
...telegramDirectCtx,
MessageSid: "heartbeat-0001",
Body: HEARTBEAT_PROMPT,
BodyStripped: HEARTBEAT_PROMPT,
Body: resolveHeartbeatPromptForResponseTool(),
BodyStripped: resolveHeartbeatPromptForResponseTool(),
};
const telegramDirectTools = createDynamicTools({ ctx: telegramDirectCtx, trigger: "user" });
const discordGroupTools = createDynamicTools({ ctx: discordGroupCtx, trigger: "user" });
@@ -480,7 +480,7 @@ function createScenarios(): PromptScenario[] {
],
trigger: "heartbeat",
ctx: heartbeatCtx,
prompt: createPrompt(heartbeatCtx, HEARTBEAT_PROMPT),
prompt: createPrompt(heartbeatCtx, heartbeatCtx.BodyStripped ?? heartbeatCtx.Body ?? ""),
extraSystemPrompt: createExtraSystemPrompt({
ctx: heartbeatCtx,
chatContext: buildDirectChatContext({