refactor(coding-agent): represent heartbeat cache validity by presence - #1743
refactor(coding-agent): represent heartbeat cache validity by presence#1743snimu wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 322c572. Configure here.
This reverts commit 322c572.
|
Closing: fully reverted after the routing-cache finding invalidated the audit premise (see resolved thread). The branch stays in place as history for the stack; #1744 has been retargeted to snimu/derive-connection-models. |
|
Closing permanently: this PR is an intentional no-op (C7 was fully reverted after a review finding invalidated the audit premise; the branch carries net-zero changes). The stack is being converted to plain PRs against main, so this placeholder is no longer needed. Ticket ENG-5661 will be cancelled. |

What was wrong
"Is the cached heartbeat snapshot usable?" was answered twice in the daemon supervisor: by the snapshot's presence AND by a
heartbeatSnapshotStaleflag, kept aligned by paired writes (audit: duplicate sources of truth, dup-truth.md finding 6).The fix
The flag is deleted.
heartbeats_changedclears the snapshot; a successful list sets it; validity is presence. All list branches behave identically under the mapping stale=true ⇔ absent. One deliberate narrowing:heartbeat_manageno longer routes via a stale-but-present snapshot — benign, becauseheartbeats_changedonly arrives from a live worker whose broadcast immediately triggers client list refreshes that repopulate the cache, withfindWorkerForClientas the fallback; disconnected-worker recovery is unaffected (a dead socket can't emit the event). +5/−7.How it's verified
Reviewer proved the state bijection branch-by-branch, identified and vetted the one behavioral delta (correcting the audit's "stale snapshots were never consumed" claim), and confirmed no ordering race (frames on one socket are ordered). Heartbeats suite 6/6; full CI-style suite: no branch-only failures vs stack base. Two-model implement/review loop, approved first pass.
Stacked on #1741 (test the whole stack at the leaf; merge base-first).
Note: intentionally no Linear ticket for this cleanup stack, so that check stays red.
Note
Low Risk
No functional code changes in the diff; risk is limited to process/stack bookkeeping if an empty merge is mistaken for a behavior change.
Overview
This PR is effectively empty — the diff has no code changes, and the description states the intended refactor was fully reverted in
3fb6ee2a2.The original goal was to drop
heartbeatSnapshotStaleindaemon-supervisorand treat cache validity as “snapshot present vs absent,” aligned with clearing onheartbeats_changedand repopulating on a successful list. That was rolled back becauseheartbeat_managestill relies on a stale-but-present snapshot as the routing index for unloaded sessions; treating stale as absent would clear that index on every manage before clients could refresh.Current behavior is unchanged:
heartbeatSnapshotandheartbeatSnapshotStaleremain the dual source of truth in the supervisor. The PR is kept open only for stack linkage; merge as empty or close and retarget downstream work.Reviewed by Cursor Bugbot for commit e4e12e6. Bugbot is set up for automated code reviews on this repo. Configure here.
Linear ticket: ENG-5661
(ticket linked above)
Note
Refactor
coding-agentheartbeat cache validity to use presenceThe PR contains only blank line modifications. There are no functional changes to the heartbeat cache logic or any other code.
Macroscope summarized e4e12e6.