Skip to content

Stop asking orchestration workers for heartbeats - #35343

Closed
Jinwoo-H wants to merge 4 commits into
mainfrom
orch-heartbeats-removal
Closed

Jinwoo-H wants to merge 4 commits into
mainfrom
orch-heartbeats-removal

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 21 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35 $\color{#cf222e}{\Huge{\mathbf{−}}}$​479 $\color{#cf222e}{\Huge{\mathbf{−}}}$​444
Prod 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​40 $\color{#cf222e}{\Huge{\mathbf{−}}}$​434 $\color{#cf222e}{\Huge{\mathbf{−}}}$​394

What

Workers are no longer told to send heartbeats, and a heartbeat that still arrives no longer reaches a coordinator.

  • Preamble and guides. The worker preamble, the orchestration guide, its worker-contract and messaging references, and the CLI docs no longer tell workers to send heartbeats. Bundled guides are regenerated.
  • Heartbeats are not mail. Workers already running an older preamble, and older peers, still send heartbeats. A heartbeat is now stored already read and delivered (insertMessage). It still updates last_heartbeat_at, which worker-show shows as lastHeartbeatAt. notifyMessageArrived returns early for heartbeats, so no send, replay or federated import path wakes a coordinator, a waiting check --wait, or a mailbox pointer. Old CLIs get the same receipt as before, with no new errors.
  • Removed, since nothing uses them any more:
    • the stale-heartbeat warning in the legacy coordinator tick
    • getStaleDispatches
    • the heartbeat interval plumbing (getOrchestrationHeartbeatMinutes and the heartbeatIntervalMinutes preamble parameter)
    • the coordinator's heartbeat-mail handling
    • the step that marked earlier heartbeats read when worker_done arrived
  • Settings (separate commit for UX review: ae79e61bf32). Removes the Worker heartbeats switch, the Heartbeat interval field, their copy and translations, and the two saved fields. Saved values from older builds are dropped on load through the existing retired-settings path.

Compatibility

  • New server with an old worker CLI: the heartbeat is accepted, the receipt shape is unchanged, and last_heartbeat_at updates. Verified in the real app below.
  • Old server with a new CLI: unchanged. --type heartbeat is still a valid type.
  • Federated workers: a relayed heartbeat is imported already read and wakes nothing.
  • Known residue: heartbeat rows that were already unread before an upgrade surface once in the next check. Clearing them would need a schema migration, which would collide with feat(orchestration): release settled workers automatically after a 2-minute grace period #34744 (v44) and add downgrade risk, so this PR leaves them.

Verification

Real app, dev build, background launch, same scratch profile for both runs. Each run dispatches a task to a real worker terminal, which then sends a heartbeat with the dev CLI.

before (40822e2c4e0) after (this branch)
Heartbeat lines in the preamble 5 0 (the diff is exactly the heartbeat block)
Heartbeat send exit code 0 0
Coordinator unread mail after the send heartbeat: alive none
worker-show lastHeartbeatAt set set
Coordinator in check --wait while a heartbeat arrives (not measured) waits out its 12 s timeout, 0 messages
Settings > Orchestration Worker heartbeats + Heartbeat interval shown both gone; saved off/15 values dropped on load without error

Tests:

  • The send test shows a waiting coordinator is not woken. It fails without the notifyMessageArrived rule.
  • The preamble test asserts the preamble never mentions heartbeats.
  • A persistence test loads saved heartbeat settings and drops them on save.

pnpm check:changed --maxWorkers=2: everything passes except three unit-test files that touch no code this PR changes:

  • runtime-failed-local-worktree-removal
  • runtime-client-settings-wsl-host-hooks (real-home write guard)
  • tests/e2e/helpers/persisted-profile-state.unit

All six of their failing tests fail the same way with every file this PR changes reverted to the base.

Workers are no longer told to send periodic heartbeats. A heartbeat that
still arrives from an older worker or peer only records last_heartbeat_at:
it is stored already handled, so it never lands in a coordinator inbox and
never wakes a coordinator or a check --wait. Removes the stale-heartbeat
warning and the heartbeat interval plumbing that only fed the preamble.
The Worker heartbeats switch and Heartbeat interval field only changed the
worker preamble text, which no longer mentions heartbeats. Saved values are
dropped on load as retired settings.
One rule at the runtime notification entry replaces per-call-site read
checks, so mutation replay and federated control-mail import stay silent
for heartbeats too.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; heartbeat compatibility remains intact without delivering new heartbeats as coordinator mail.

Summary

Stops asking orchestration workers to send heartbeats while keeping older workers compatible.

  • New worker briefs and orchestration guides no longer ask for heartbeats.
  • Incoming heartbeats update liveness without waking coordinator mailboxes.
  • The Orchestration settings no longer offer heartbeat controls or intervals.

No actionable issues were found. This review checked code paths and existing tests; it did not run the app or test suite.

Jinwoo-H acknowledged that previously unread heartbeats can surface after upgrade. Cleanup was deferred to avoid a schema migration conflict and downgrade risk.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Older worker sends heartbeat] --> B[Store row already read and delivered]
  B --> C{Local or federated?}
  C -->|Local| D[Check dispatch authority and record timestamp]
  C -->|Federated| E[Record timestamp and advance relay cursor]
  D --> F[Skip mailbox notification]
  E --> F
  G[New worker preamble] --> H[No heartbeat instructions]
Loading

Reviews (1) · Last reviewed commit: "fix(orchestration): never wake a mailbox..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change removes orchestration heartbeat settings, their UI and translations, and heartbeat instructions from worker preambles and guides. Heartbeat messages are handled differently in persistence, coordinator processing, and mailbox notifications. Stale-Dispatch queries and warnings are removed, along with related tests.

Priority: Normal

Merge Risk: Low · up to f63d0

Group-addressed heartbeats still fail, but the documentation no longer states that restriction. Restore it as a bounded follow-up.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the implementation, compatibility behavior, verification results, and known residue. However, it does not follow the required template and omits or leaves incomplete several r… Complete the required template sections. Add an actual issue reference after “Fixes #” or document the maintainer exception, add Visual Proof or N/A with a reason, provide the required Testing checklist and platform details, complete AI D…
Docstring Coverage Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely summarizes the primary change: removing heartbeat instructions from orchestration workers.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the implementation, compatibility behavior, verification results, and known residue. However, it does not follow the required template and omits or leaves incomplete several required sections, including ELI5, Why, Linked Issue, Visual Proof, Testing, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Complete the required template sections. Add an actual issue reference after “Fixes #” or document the maintainer exception, add Visual Proof or N/A with a reason, provide the required Testing checklist and platform details, complete AI Disclosure if applicable, address Review, Agent skill upstream boundary, Notes, and Checklist items, and add explicit ELI5 and Why sections.

Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 17 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1383e72-0c58-4492-a922-38a9a6e05b93
Commits

Reviewing files that changed from the base of the PR and between d0bfbd2 and f63d073.

Files ignored due to path filters: 1
  • src/main/runtime/orchestration/__snapshots__/preamble.test.ts.snap is excluded by !**/*.snap
Files selected for processing: 62
  • config/flaky-test-pattern-baseline.txt
  • docs/site/content/docs/cli/orchestration.mdx
  • skill-guides/orchestration.md
  • skill-guides/orchestration/references/messaging-and-gates.md
  • skill-guides/orchestration/references/worker-contract.md
  • src/cli/bundled-skill-guides.ts
  • src/main/persistence/applying-settings/persistence-settings-ui-defaults.test.ts
  • src/main/persistence/applying-settings/settings-update.ts
  • src/main/persistence/applying-settings/terminal-settings-migrations.ts
  • src/main/runtime/orchestration/agent-facing-parity.test.ts
  • src/main/runtime/orchestration/coordinator-dispatch-unobserved-prompt.test.ts
  • src/main/runtime/orchestration/coordinator-runtime-contract.ts
  • src/main/runtime/orchestration/coordinator-task-dispatch.ts
  • src/main/runtime/orchestration/coordinator.test.ts
  • src/main/runtime/orchestration/coordinator.ts
  • src/main/runtime/orchestration/db.test.ts
  • src/main/runtime/orchestration/db/dispatch-context/dispatch-completion.ts
  • src/main/runtime/orchestration/db/messages/message-insert.ts
  • src/main/runtime/orchestration/db/remaining-dispatch-statement-compilation.test.ts
  • src/main/runtime/orchestration/db/runs/legacy-coordinator-mail-takeover.ts
  • src/main/runtime/orchestration/lifecycle-reconciliation.test.ts
  • src/main/runtime/orchestration/lifecycle-reconciliation.ts
  • src/main/runtime/orchestration/orchestration-delivery-consumption.test.ts
  • src/main/runtime/orchestration/preamble.test.ts
  • src/main/runtime/orchestration/preamble.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-retry.test.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-start-deadline.test.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-start-failure.test.ts
  • src/main/runtime/rpc/methods/orchestration/cli-runtime-boundary.test.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation-control-mail.test.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/check-direct.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/check.test.ts
  • src/main/runtime/rpc/methods/orchestration/messaging/send.test.ts
  • src/main/runtime/rpc/methods/orchestration/runs/dispatch-methods.ts
  • src/main/runtime/rpc/methods/orchestration/worker/deliver-worker-dispatch-preamble.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-prompt-budget.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-readiness-settlement.test.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/main/runtime/terminal/lifecycle/floating-session-liveness.ts
  • src/main/runtime/workspaces/workspace-selectors.ts
  • src/renderer/src/components/settings/OrchestrationHeartbeatSetting.tsx
  • src/renderer/src/components/settings/OrchestrationPane.test.tsx
  • src/renderer/src/components/settings/OrchestrationPane.tsx
  • src/renderer/src/components/settings/orchestration-heartbeat-copy.ts
  • src/renderer/src/components/settings/orchestration-search.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-base.ts
  • src/shared/orchestration-heartbeat.test.ts
  • src/shared/orchestration-heartbeat.ts
Files with no reviewable changes: 41
  • src/main/runtime/orchestration/lifecycle-reconciliation.test.ts
  • config/flaky-test-pattern-baseline.txt
  • src/main/runtime/rpc/methods/orchestration/messaging/check.test.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-retry.test.ts
  • src/shared/orchestration-heartbeat.test.ts
  • src/main/runtime/rpc/methods/orchestration/worker/deliver-worker-dispatch-preamble.ts
  • skill-guides/orchestration/references/worker-contract.md
  • src/main/runtime/rpc/methods/orchestration-structured-worker-start-deadline.test.ts
  • src/main/runtime/orchestration/coordinator-dispatch-unobserved-prompt.test.ts
  • src/main/runtime/workspaces/workspace-selectors.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation.ts
  • src/main/runtime/rpc/methods/orchestration-structured-worker-start-failure.test.ts
  • src/shared/default-global-settings.ts
  • src/main/runtime/orchestration/coordinator-runtime-contract.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-readiness-settlement.test.ts
  • src/renderer/src/components/settings/OrchestrationHeartbeatSetting.tsx
  • src/renderer/src/components/settings/orchestration-search.ts
  • src/shared/global-settings-base.ts
  • src/renderer/src/components/settings/OrchestrationPane.tsx
  • src/main/runtime/orchestration/orchestration-delivery-consumption.test.ts
  • src/main/runtime/orchestration/coordinator.test.ts
  • src/main/runtime/orchestration/db/dispatch-context/dispatch-completion.ts
  • src/main/persistence/applying-settings/settings-update.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/main/runtime/orchestration/db.test.ts
  • src/main/runtime/orchestration/coordinator-task-dispatch.ts
  • src/main/runtime/orchestration/lifecycle-reconciliation.ts
  • src/renderer/src/components/settings/orchestration-heartbeat-copy.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/components/settings/OrchestrationPane.test.tsx
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/shared/orchestration-heartbeat.ts
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

- Default `check` is the bound Run's oldest unacked Delivery (FIFO). Replay until `--ack`.
- `--peek` / `--all` do not consume mail and return no `deliveryId`, so they do not drain a mailbox on their own. `--all` and a Run `--peek` show at most 100 rows. To drain, repeat plain `check --ack <previous deliveryId>` until `deliveryId` is `null`.
- Group addresses: `@all`, `@idle`, `@claude`, `@codex`, `@opencode`, `@gemini`, `@droid`, `@grok`, `@cursor`, `@worktree:<id>` — never for `worker_done` / heartbeat.
- Group addresses: `@all`, `@idle`, `@claude`, `@codex`, `@opencode`, `@gemini`, `@droid`, `@grok`, `@cursor`, `@worktree:<id>` — never for `worker_done`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Keep the heartbeat group restriction.

Heartbeat sends to group addresses are still rejected. The rejects heartbeat group sends before inserting rows test covers this case. Restore heartbeat in this restriction so users do not attempt an invalid send. (raw.githubusercontent.com)

@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

Superseded by #36137, which combines the orchestration v3 changes into one PR.

@Jinwoo-H Jinwoo-H closed this Oct 29, 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.

1 participant