Skip to content

feat(orchestration): let users choose the worker heartbeat interval - #34071

Merged
brennanb2025 merged 16 commits into
mainfrom
brennanb2025/orch-heartbeat-interval
Oct 27, 2026
Merged

brennanb2025 merged 16 commits into
mainfrom
brennanb2025/orch-heartbeat-interval

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​97 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​92
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​129 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​113

Builds on the heartbeat on/off switch from merged #34070. This PR now targets main and contains only the interval change and its focused verification tests.

Problem

Dispatched orchestration workers are told to send a heartbeat every 5 minutes, and that number is fixed. Users who want quieter coordinators, or more frequent check-ins, can't change it.

Change

While Worker heartbeats is on, Settings → Agent Orchestration shows a Heartbeat interval field: whole minutes, 1–60, default 5. It's hidden while heartbeats are off.

  • Newly dispatched workers are told "Send a heartbeat every N minutes"; workers already running keep the brief they got. The stale-heartbeat check uses 2 × N.
  • The description explains the tradeoff in plain terms: shorter intervals give the coordinator more frequent check-ins but send it more messages; longer intervals send fewer messages but leave longer gaps between check-ins. It deliberately doesn't promise automatic hung-worker detection or a detection deadline, since nothing in production enforces one.
  • Out-of-range or malformed values fall back to 5, both when saved (store boundary, like nested worker depth) and when read.
  • Existing profiles have no value saved, so they keep 5 minutes.
  • Both heartbeat settings now live in a settings group owned by src/shared/orchestration-heartbeat.ts, composed into GlobalSettings through global-settings-base.ts like other feature groups (the settings types file was at its line cap).

Plan

Same design as #34070: one resolver over the live setting feeds every brief and the stale check. No saved field beyond the optional setting, and no wire change.

Testing

  • orchestration-heartbeat.test.ts: missing value → 5; chosen value used only while on; 0, 61, 2.5 and NaN fall back to 5.

  • preamble.test.ts: brief states the chosen interval.

  • OrchestrationPane.test.tsx: interval hidden while off; shows 5 by default; committing 15 saves orchestrationHeartbeatIntervalMinutes: 15; settings search finds "interval". The existing nested-depth "no max" check is now scoped to that input.

  • Ran six named suites through the local test gate: 116 tests passed. Localization catalogs verified.

  • Real Store upgrade/save/reopen contract: profiles lacking both heartbeat settings retain 5 minutes; a saved interval of 15 survives reopen; raw 61 normalizes to 5 and persists that value.

  • The existing real CLI argv dispatch contract covers off and 15 minutes using the same setup, and checks the returned brief equals the delivered brief.

  • Real stale-query contract with interval 15: 11 and 30-minute-old heartbeats do not warn; 31 minutes warns at the 30-minute cutoff and leaves the task dispatched.

  • Full review completed without production fixes; the follow-up commit adds tests only. The final main merge after feat(orchestration): add a Settings switch to turn worker heartbeats off #34070 landed preserves the reviewed heartbeat behavior; its conflict resolutions were checked independently.

  • Branch-only Settings screenshot passed; no real-agent QA round is required for these settings/orchestration flows.

Heartbeat interval in Settings

Dispatched workers are told to send a heartbeat every 5 minutes. A new
"Worker heartbeats" switch under Settings > Agent Orchestration (on by
default) lets users turn that off: newly dispatched workers are no longer
told to send heartbeats, and the stale-heartbeat check is skipped.

The interval the brief states and the stale check both derive from one
resolver over the live setting, read from the runtime's own store like
the other orchestration settings.
While worker heartbeats are on, Settings > Agent Orchestration now shows
a "Heartbeat interval" field (1-60 minutes, default 5). Newly dispatched
workers are told to check in at that interval, and the stale-heartbeat
check uses twice it. The description explains the tradeoff: shorter
gives more frequent check-ins and more messages, longer gives fewer
messages and longer gaps.

Out-of-range or malformed values fall back to 5, both when saved and
when read. Both heartbeat settings now live in a settings group owned by
the heartbeat module, composed into GlobalSettings like other feature
groups.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/orch-heartbeat-interval branch from 673e786 to b3a2350 Compare October 26, 2026 20:29
@brennanb2025
brennanb2025 marked this pull request as ready for review October 26, 2026 21:38
@brennanb2025

brennanb2025 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Workers were always told to check in every five minutes. This adds a 1–60 minute interval in Settings → Orchestration while Worker heartbeats is on, keeping five minutes for existing profiles. The interval is indented beneath its parent switch using the existing child-setting treatment. Newly dispatched workers receive the chosen cadence; running workers keep their delivered brief. The copy explains more messages versus longer gaps without promising automatic stall detection.

The full review converged in two passes with no production defects or open P0/P1 findings. Tests-only 710eccac2c5 closed the settings migration/save/reopen and invalid-write fallback, real CLI dispatch at 15 minutes, and configured 30-minute stale cutoff contracts. Six named suites passed (116 tests); the lane owner later reported 14 named files/144 tests after the base fixture fixes. The owner-requested indentation follow-up 4950182ae19 passed narrow source review against the existing child-setting pattern, preserving conditional visibility, NumberField props/callback and accessibility. The owner reports OrchestrationPane.test.tsx: 10 passed. The existing “every few minutes” switch-copy precision nit remains deferred; the adjacent field shows the exact interval.

Final CI is green on 4950182ae1929e1e84abed66be1a379827b6094e: run 40430644578 executed and passed lint/typecheck, all five unit shards, relay integration, both packaging jobs and the aggregate. Other selected platform/persistence/WSL checks passed. This PR targets main after #34070 merged; the inherited main failures are fixed by #34085 and #34132, already included in the previously reviewed main merges.

qa=tests, refs=done. A fresh branch-only Settings screenshot at this head replaces the earlier image because the indentation changes how the screen looks. The Codex driver and loop inspected the uncropped screenshot: Worker heartbeats is on, the interval is indented with a vertical divider, and the label, description and 5-minute control are readable without clipping or overlap. The isolated QA copy was stopped gracefully; all recorded owned app/driver processes and admitted listeners are gone, real-config hashes are unchanged, and there was no lockfile churn. The full reference comparison and unchanged orchestration behavior evidence carry; no additional agent/full QA round was required for this layout change.

For Brennan's review: the screenshot shows the interval nested beneath Worker heartbeats. The main judgment points are the shared bounds/fallback, store normalization, and conditional child interval.

Heartbeat interval indented beneath Worker heartbeats

@brennanb2025
brennanb2025 changed the base branch from brennanb2025/orch-heartbeat-toggle to main October 26, 2026 23:16
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: d8a62d33-85b4-4ac6-bfba-cb893de1bc6d
Commits

Reviewing files that changed from the base of the PR and between 38b1d17 and 4950182.

Files selected for processing: 1
  • src/renderer/src/components/settings/OrchestrationHeartbeatSetting.tsx
Files skipped from review as they are similar to previous changes: 1
  • src/renderer/src/components/settings/OrchestrationHeartbeatSetting.tsx

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

Walkthrough

The changes add a configurable orchestration heartbeat interval with a five-minute default and a supported range of 1 to 60 minutes. Settings updates normalize invalid values. The settings UI displays the interval control when heartbeats are enabled, with localized labels and descriptions. The runtime settings contract includes the interval, and tests cover persistence, UI behavior, dispatch preambles, and stale-dispatch warnings.

Priority: Normal

Merge Risk: Minimal · up to 49501

No actionable issue with the heartbeat interval change remains; it is mergeable after normal checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description follows the template well. It has a clear ELI5-style problem and change summary, a Plan section, and a Testing section with specific suites and contracts. It also includes an orca-pr-l… 1. Add a linked issue in the "Fixes #" field. Outside contributors must link a real issue. Maintainers should reference a pre-existing issue. 2. Add an ELI5 section in plain language. 3. Add a Why section that explains why this design is be…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing users to choose the worker heartbeat interval.
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 follows the template well. It has a clear ELI5-style problem and change summary, a Plan section, and a Testing section with specific suites and contracts. It also includes an orca-pr-loc block and a screenshot. It is missing several required template sections and details. The Linked Issue section has no issue reference ("Fixes #" is blank), which the template says is required for outside contributors. The Visual Proof section has only a Settings screenshot. The template asks for a BEFORE and AFTER, and the description says the screenshot is branch-only. The ELI5, Why, Review, Agent skill upstream boundary, Notes, and Checklist sections are not addressed. The AI Disclosure section is absent. The Testing checklist boxes are not ticked. The description also does not explain why this approach beats the alternatives.

Resolution

  1. Add a linked issue in the "Fixes #" field. Outside contributors must link a real issue. Maintainers should reference a pre-existing issue. 2. Add an ELI5 section in plain language. 3. Add a Why section that explains why this design is better than the alternatives considered. 4. Provide a BEFORE and AFTER visual for the settings UI, or a video that can be switched. Replace the branch-only screenshot if needed. 5. Fill in the Testing checklist. State which platforms were tested (macOS, Linux, Windows, SSH). Tick the manual-testing box only if it is true. 6. Add the Agent skill upstream boundary checkbox state. 7. Add an AI Disclosure section if AI tools were used, or confirm the author is a StablyAI team member. 8. Address the Notes items: security, cross-platform support, remote SSH, mobile, backwards compatibility, and performance. 9. Complete the Checklist items, including the pnpm lint, typecheck, test, and build status.
Finishing Touches
📝 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.

@brennanb2025
brennanb2025 merged commit 01db1c6 into main Oct 27, 2026
50 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/orch-heartbeat-interval branch October 27, 2026 02:38
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