Skip to content

fix: don't auto-create HEARTBEAT.md on workspace init#12027

Merged
Takhoffman merged 3 commits intoopenclaw:mainfrom
shadril238:fix/heartbeat-missing-file-behavior
Feb 14, 2026
Merged

fix: don't auto-create HEARTBEAT.md on workspace init#12027
Takhoffman merged 3 commits intoopenclaw:mainfrom
shadril238:fix/heartbeat-missing-file-behavior

Conversation

@shadril238
Copy link
Contributor

@shadril238 shadril238 commented Feb 8, 2026

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

  • 32 heartbeat tests pass
  • 12 workspace tests pass
  • 16 agent-mutate tests pass

Behavior After Fix

Scenario Before After
User deletes HEARTBEAT.md File recreated, heartbeat skipped File stays deleted, heartbeat runs
Empty HEARTBEAT.md Skipped Skipped (unchanged)
HEARTBEAT.md with tasks Runs Runs (unchanged)

Greptile Overview

Greptile Summary

This PR updates ensureAgentWorkspace (src/agents/workspace.ts) to stop auto-creating HEARTBEAT.md from 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 via writeFileIfMissing, while keeping other bootstrap files (AGENTS/SOUL/TOOLS/IDENTITY/USER and BOOTSTRAP on first init) unchanged.

Confidence Score: 4/5

  • This PR is generally safe to merge and is narrowly scoped to workspace bootstrap behavior.
  • Change is small and consistent with the stated behavior change (stop creating HEARTBEAT.md). The main remaining concern is a type/API mismatch: ensureAgentWorkspace still exposes heartbeatPath/heartbeat bootstrap naming even though the file is no longer created or returned, which can mislead callers and future changes.
  • src/agents/workspace.ts

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Feb 8, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 8, 2026

Additional Comments (1)

src/agents/workspace.ts
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).

Prompt To Fix With AI
This 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.

@shadril238 shadril238 force-pushed the fix/heartbeat-missing-file-behavior branch from e3c5b68 to 4892194 Compare February 8, 2026 18:55
@Takhoffman Takhoffman self-assigned this Feb 14, 2026
shadril238 and others added 3 commits February 13, 2026 18:16
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
@Takhoffman Takhoffman force-pushed the fix/heartbeat-missing-file-behavior branch from 4892194 to e8b2311 Compare February 14, 2026 00:24
@Takhoffman Takhoffman merged commit 386bb0c into openclaw:main Feb 14, 2026
9 checks passed
@Takhoffman
Copy link
Contributor

Merged via squash.

  • Merge commit: 386bb0c
  • Verified: pnpm install --frozen-lockfile, pnpm build, pnpm check, pnpm test
  • Changelog: CHANGELOG.md updated=true required=true opt_out=false

Thanks @shadril238!

@openclaw-barnacle openclaw-barnacle bot added size: XS trusted-contributor Contributor with 4+ merged PRs labels Feb 14, 2026
steipete pushed a commit to azade-c/openclaw that referenced this pull request Feb 14, 2026
… 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]>
@HenryLoenwind
Copy link
Contributor

HenryLoenwind commented Feb 14, 2026

@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.

Takhoffman added a commit that referenced this pull request Feb 14, 2026
Takhoffman added a commit that referenced this pull request Feb 14, 2026
hamidzr pushed a commit to hamidzr/openclaw that referenced this pull request Feb 14, 2026
openperf pushed a commit to openperf/moltbot that referenced this pull request Feb 14, 2026
openperf pushed a commit to openperf/moltbot that referenced this pull request Feb 14, 2026
BigUncle pushed a commit to BigUncle/openclaw that referenced this pull request Feb 14, 2026
mverrilli pushed a commit to mverrilli/openclaw that referenced this pull request Feb 14, 2026
… 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]>
mverrilli pushed a commit to mverrilli/openclaw that referenced this pull request Feb 14, 2026
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
… 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]>
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
cloud-neutral pushed a commit to cloud-neutral-toolkit/openclawbot.svc.plus that referenced this pull request Feb 15, 2026
… 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]>
Benkei-dev pushed a commit to Benkei-dev/openclaw that referenced this pull request Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS trusted-contributor Contributor with 4+ merged PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Missing HEARTBEAT.md behaviour doesn't match documentation

3 participants

Comments