Skip to content

fix: touch log file on heartbeat success to prevent stagnation#218

Closed
liyishuai wants to merge 3 commits intoEvoMap:mainfrom
liyishuai:fix-heartbeat-touch-2
Closed

fix: touch log file on heartbeat success to prevent stagnation#218
liyishuai wants to merge 3 commits intoEvoMap:mainfrom
liyishuai:fix-heartbeat-touch-2

Conversation

@liyishuai
Copy link

Fixes #216. Touching the log file explicitly updates its mtime without writing noisy logs. This satisfies the lifecycle.js health check.

Copilot AI review requested due to automatic review settings March 7, 2026 19:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses lifecycle “stagnation” restarts (Issue #216) by updating the evolver_loop.log mtime on successful heartbeats, so the lifecycle health check can detect liveness even when the loop is otherwise quiet.

Changes:

  • Import getLogsDir() into the A2A protocol module.
  • On successful sendHeartbeat(), touch evolver_loop.log via fs.utimesSync(...) to advance its mtime without writing log output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@liyishuai liyishuai closed this Mar 7, 2026
@liyishuai liyishuai reopened this Mar 7, 2026
liyishuai and others added 2 commits March 8, 2026 03:43
- Add getEvolverLogPath() to paths.js to centralize the log filename,
  eliminating the duplicate literal between a2aProtocol.js and lifecycle.js
- On heartbeat success, mkdirSync the logs dir before touching so a missing
  directory no longer silently defeats the stagnation fix
- Handle ENOENT from utimesSync by creating the file then retrying; other
  errors now emit console.warn so misconfiguration is visible
- Add sendHeartbeat unit tests covering mtime update and file creation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Delete env vars on teardown when originals were undefined, matching
  the codebase pattern (avoids '' vs undefined semantic difference)
- Assert mtime > oldTime (5s in the past) instead of >= Date.now(),
  which is stable on filesystems with coarse (1s) timestamp resolution

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@autogame-17
Copy link
Collaborator

Thank you @liyishuai for this contribution! The changes have been reviewed and merged into the upstream codebase with full Co-authored-by attribution. This fixes #216 as well.

Your improvement will be included in the next public release.

If you have an EvoMap account, we would like to award you credits for this contribution. Please reply with your node_id or registered email so we can send the reward.

Closing this PR as the changes have been cherry-picked upstream (the public repo is a one-way publish from the private codebase). Thanks again!

@autogame-17 autogame-17 closed this Mar 8, 2026
@liyishuai
Copy link
Author

Same here: My node_id is node_597c057f. Let's make evolution happen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lifecycle stagnation health check triggered due to silent successful heartbeats

3 participants