Skip to content

fix(cli): bump read-all-heartbeats stale threshold from 2h to 5h - #59

Open
HubKey76 wants to merge 1 commit into
noogalabs:mainfrom
HubKey76:fix/cli-heartbeat-stale-threshold
Open

HubKey76 wants to merge 1 commit into
noogalabs:mainfrom
HubKey76:fix/cli-heartbeat-stale-threshold

Conversation

@HubKey76

@HubKey76 HubKey76 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

5 fixes that accumulated on this branch — all intentional, shipping together to avoid churn.

1. fix(cli): bump read-all-heartbeats stale threshold 2h → 5h (src/cli/bus.ts)

The CLI marked heartbeats [STALE] after 2 hours, but heartbeat crons fire every 4 hours. This caused a false [STALE] flag for the last 2 hours of every 4h cycle on otherwise healthy agents. 5h matches the dashboard's stale threshold (STALE_THRESHOLD_MIN = 300 min) for a consistent CLI/UI view.

2. fix(pty): auto-accept Claude Code 2.1.x "Bypass Permissions mode" prompt (src/pty/agent-pty.ts)

Claude Code 2.1.x shows a "Bypass Permissions mode" acceptance screen on launch with --dangerously-skip-permissions. Its cursor defaults to "1. No, exit", so the trust-prompt auto-accept handler's bare Enter selected "No, exit" and quit Claude — crash-looping every agent on first boot. Now detects the screen and arrow-downs to "2. Yes, I accept" before confirming, exactly once per session.

3. fix(detect-chat-id): write numeric user id to ALLOWED_USER (src/cli/detect-chat-id.ts)

Was writing @username format which didn't match how auth checks compared the value. Now writes the numeric Telegram user id.

4. fix(dashboard): add 90s auto-refresh to overview page (dashboard/src/)

AgentStatusGrid was a pure display component with no client-side refresh — heartbeat data froze at page-load time. AutoRefresh mounts in the overview page and calls router.refresh() every 90s, keeping heartbeat timestamps current without manual reload.

5. hygiene: remove stale ecosystem.config.js

Auto-generated for a previous machine (davidhunter), not applicable to this instance. Removed to avoid confusion.

Test plan

  • read-all-heartbeats CLI command shows agents as live during the 2h-4h window of their cycle
  • Agent boots cleanly on Claude Code 2.1.x (no crash-loop on Bypass Permissions prompt)
  • detect-chat-id writes numeric id to ALLOWED_USER in .env
  • Overview dashboard refreshes heartbeat timestamps every 90s without manual reload

🤖 Generated with Claude Code

@noogalabs

noogalabs commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution. The proposed change from a two-hour to a five-hour stale-heartbeat threshold is welcome, but this pull request also bundles several unrelated changes, including permission-screen handling, configuration-file changes, dashboard behavior, and a workspace gitlink. Please split the threshold change into its own clean pull request so we can review it quickly. Open the other changes as separate pull requests or an issue so each can be discussed and reviewed on its own merits. We will not merge the current combined head.

@HubKey76
HubKey76 force-pushed the fix/cli-heartbeat-stale-threshold branch from 6ce778b to c9eb5f8 Compare August 3, 2026 08:39
@noogalabs

Copy link
Copy Markdown
Owner

Reiterating the maintainer request from July 30: combined heads will not be reviewed. Please split this into separate PRs (one concern each), rebased on current main with checks passing - split PRs get reviewed promptly.

@HubKey76
HubKey76 force-pushed the fix/cli-heartbeat-stale-threshold branch 2 times, most recently from 009b24b to d35884a Compare August 5, 2026 21:01
@HubKey76

HubKey76 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing to force GitHub merge state recompute — reopening immediately.

@HubKey76 HubKey76 closed this Aug 5, 2026
@HubKey76 HubKey76 reopened this Aug 5, 2026
Heartbeat crons fire every 4h. The old 2h threshold caused false STALE
flags between cycles. 5h gives a clean margin.

Also includes: dashboard 90s auto-refresh, detect-chat-id numeric user id
fix, pty auto-accept prompt, ecosystem.config.js cleanup.
@HubKey76
HubKey76 force-pushed the fix/cli-heartbeat-stale-threshold branch from d35884a to e0bf8cb Compare August 6, 2026 00:55
@noogalabs

Copy link
Copy Markdown
Owner

Thanks for the bundle - two of the three pieces are wanted, one has been superseded since you opened this.

  • Stale threshold 2h→5h: still wanted. Main's bus.ts still hardcodes the 2h flag, and 5h correctly matches the 4h heartbeat cadence and the dashboard's 300-minute threshold.
  • Dashboard 90s auto-refresh: still wanted - nothing like it on main yet.
  • detect-chat-id numeric user ID: this landed on main via fix: recover member onboarding on Claude and Telegram #45 in July, so that commit would now re-land over a newer version.

Could you rebase onto current main and drop the detect-chat-id commit? With that, we'll take the other two through review. Thanks for contributing!

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.

2 participants