fix: don't auto-create HEARTBEAT.md on workspace init#12027
fix: don't auto-create HEARTBEAT.md on workspace init#12027Takhoffman merged 3 commits intoopenclaw:mainfrom
Conversation
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/agents/workspace.ts
Line: 125:137
Comment:
**Stale `heartbeatPath` return type**
`ensureAgentWorkspace` no longer creates/returns `heartbeatPath`, but the function signature still advertises `heartbeatPath?: string` and the internal `WorkspaceBootstrapFileName` union still includes `DEFAULT_HEARTBEAT_FILENAME`. This will leave callers/types thinking HEARTBEAT.md is part of the bootstrap set even though it’s now intentionally excluded. Please remove `heartbeatPath` from the return type (and any related bootstrap-type unions if this function is meant to describe what gets created).
How can I resolve this? If you propose a fix, please make it concise. |
e3c5b68 to
4892194
Compare
Fixes openclaw#11766 The documentation states 'If the file is missing, the heartbeat still runs and the model decides what to do.' However, ensureAgentWorkspace() was auto-creating HEARTBEAT.md from template (which is effectively empty), causing heartbeat to be silently disabled. This change removes HEARTBEAT.md from workspace initialization so that: - Missing file: heartbeat runs, LLM decides (per docs) - Empty file: heartbeat skipped (saves API calls) - File with tasks: heartbeat runs normally
4892194 to
e8b2311
Compare
|
Merged via squash.
Thanks @shadril238! |
… thanks @shadril238 Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test Co-authored-by: shadril238 <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
|
@steipete This one removes the creation of HEARTBEAT.md completely---even on a brand new workspace. This doesn't sound right---the empty template file is intended as a starting point to grow one's own heartbeat actions. In my opinion, this is the right approach: #11807 Only create the HEARTBEAT.md on an empty workspace (i.e. when BOOTSTRAP.md is created). Tis PR also leads to a behavioural change: Previously, in a new workspace, the heartbeat would not run, as there was a blocking "functionally empty" file. Now, new workspaces don't have that file, and the heartbeat will run, leaving the agent to figure out what to do without any guidance. Removing the file and letting the heartbeat run without it should be a conscious choice for people who change their heartbeat prompt to tell the agent what to do. |
… thanks @shadril238" This reverts commit 386bb0c.
… thanks @shadril238" (#16183) This reverts commit 386bb0c.
…aw#12027) thanks @shadril238" (openclaw#16183) This reverts commit 386bb0c.
…aw#12027) thanks @shadril238" (openclaw#16183) This reverts commit 386bb0c.
…aw#12027) thanks @shadril238" (openclaw#16183) This reverts commit 386bb0c.
…aw#12027) thanks @shadril238" (openclaw#16183) This reverts commit 386bb0c.
… thanks @shadril238 Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test Co-authored-by: shadril238 <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…aw#12027) thanks @shadril238" (openclaw#16183) This reverts commit 386bb0c.
… thanks @shadril238 Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test Co-authored-by: shadril238 <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…aw#12027) thanks @shadril238" (openclaw#16183) This reverts commit 386bb0c.
… thanks @shadril238 Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test Co-authored-by: shadril238 <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
…aw#12027) thanks @shadril238" (openclaw#16183) This reverts commit 386bb0c.
Fixes #11766
Problem
Documentation states "If the file is missing, the heartbeat still runs and the model decides what to do." However, workspace initialization was auto-creating HEARTBEAT.md from a template containing only comments/headers, causing heartbeat to be silently disabled.
Solution
Remove HEARTBEAT.md from workspace initialization. The file should only exist if the user explicitly creates it with tasks.
Testing
Behavior After Fix
Greptile Overview
Greptile Summary
This PR updates
ensureAgentWorkspace(src/agents/workspace.ts) to stop auto-creatingHEARTBEAT.mdfrom the workspace templates during workspace initialization, aligning behavior with the docs (“if missing, heartbeat still runs”). It removes HEARTBEAT.md from the “brand new workspace” detection list and from the set of files written viawriteFileIfMissing, while keeping other bootstrap files (AGENTS/SOUL/TOOLS/IDENTITY/USER and BOOTSTRAP on first init) unchanged.Confidence Score: 4/5
ensureAgentWorkspacestill exposesheartbeatPath/heartbeat bootstrap naming even though the file is no longer created or returned, which can mislead callers and future changes.