Skip to content

Preserve heartbeat grace after short suspension - #2372

Merged
ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-heartbeat-grace-after-sh-thr_e394yjf4tm
Aug 25, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-heartbeat-grace-after-sh-thr_e394yjf4tm

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

What was wrong

Heartbeat acknowledgement expiry was coupled to the older 60-second system-suspension log heuristic. With the landed 5-second heartbeat and 30-second acknowledgement lease, a heartbeat callback delayed for roughly 31–64 seconds saw the acknowledgement as expired before the delay qualified for suspension grace, so waking a healthy host forced an unnecessary heartbeat-ack-timeout reconnect. This is a follow-up to PR #2359.

What changed

  • Grant one fresh acknowledgement lease whenever the heartbeat timer gap itself exceeds the lease, independently of how the gap is classified for logging.
  • Keep the existing sub-minute heartbeat-delay warning and 60-second likely-suspension info classification unchanged.
  • Add regression coverage proving a 35-second gap does not reconnect immediately and that a genuinely dead return path still reconnects after the fresh lease expires.

There are no wire-contract changes, so HOST_DAEMON_PROTOCOL_VERSION remains unchanged.

How you verified

The new regression failed before the production change with an immediate (1013, "heartbeat-ack-timeout") reconnect and passed afterward.

pnpm exec turbo run test --filter=@bb/host-daemon --force --concurrency=1 -- src/server-connection.test.ts
pnpm exec turbo run typecheck --filter=@bb/host-daemon --force --concurrency=1
pnpm exec turbo run test --filter=@bb/host-daemon --force --concurrency=1
pnpm exec turbo run build --filter=@bb/host-daemon --force --concurrency=1
pnpm exec oxfmt apps/host-daemon/src/server-connection.ts apps/host-daemon/src/server-connection.test.ts --check
  • Focused current-main result: 13 tests passed; 7/7 Turbo tasks successful.
  • Host-daemon typecheck: 4/4 Turbo tasks successful.
  • Full host-daemon suite: 45 files and 555 tests passed; 7/7 Turbo tasks successful.
  • Host-daemon build: 5/5 Turbo tasks successful.

Follow-up to #2358 and #2359.

AGENT GENERATED

@ymichael
ymichael merged commit 4e2e91e into main Aug 25, 2026
15 checks passed
@ymichael
ymichael deleted the bb/post-merge-fix-preserve-heartbeat-grace-after-sh-thr_e394yjf4tm branch August 25, 2026 02:54
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.

1 participant