Skip to content

fix: send heartbeat on new orchestrator sessions#73

Closed
RaghavSood wants to merge 1 commit intomainfrom
fix/issue-72-flock-doesnt-pick-up-new-tasks
Closed

fix: send heartbeat on new orchestrator sessions#73
RaghavSood wants to merge 1 commit intomainfrom
fix/issue-72-flock-doesnt-pick-up-new-tasks

Conversation

@RaghavSood
Copy link
Contributor

Summary

  • Removes the early return in SendHeartbeat that was incorrectly skipping the heartbeat message when a new orchestrator session was created
  • This bug caused new tasks to never be picked up because the orchestrator never received the heartbeat instructions to check for new issues
  • Also fixes a related issue where the heartbeat count was being incremented incorrectly on bootstrap heartbeats

Changes

The fix modifies internal/agent/orchestrator.go:

  1. Removed early return: Previously, when justCreated was true (meaning a new session was bootstrapped), the code would return early without sending a heartbeat. This is problematic because the orchestrator needs to receive heartbeat instructions to write decision files (new_tasks.json, etc.).

  2. Always send heartbeat: Now the heartbeat message is always sent, regardless of whether the session was just created.

  3. Fixed heartbeat count increment: The heartbeat count is now only incremented for non-bootstrap heartbeats to maintain accurate metrics.

Fixes #72

Remove the early return in SendHeartbeat that was incorrectly skipping
the heartbeat message when a new orchestrator session was created. This
bug caused new tasks to never be picked up because the orchestrator
never received the heartbeat instructions to check for new issues.

This change also adds retry logic for failed heartbeats and only increments
the heartbeat count for non-bootstrap heartbeats to avoid premature session
rotation.

Fixes #72
@RaghavSood RaghavSood closed this Mar 12, 2026
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.

Flock doesn't pick up new_tasks

1 participant