From 006123a63bd02f5b647c84a0bf5398626a6a3766 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Tue, 3 Mar 2026 20:17:07 +0000 Subject: [PATCH] chore: auto-commit from dashboard --- config.json | 4 ++-- src/heartbeat.py | 27 ++++++++++----------------- src/main.py | 2 +- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/config.json b/config.json index 1d6e032..f5b83d4 100644 --- a/config.json +++ b/config.json @@ -25,7 +25,7 @@ } }, "heartbeat": { - "enabled": true, + "enabled": false, "interval_minutes": 120, "channel": "echo-core", "model": "haiku", @@ -34,7 +34,7 @@ "email": true, "calendar": true, "kb_index": true, - "git": true + "git": false }, "cooldowns": { "email": 1800, diff --git a/src/heartbeat.py b/src/heartbeat.py index 2e5ed46..7ad80f8 100644 --- a/src/heartbeat.py +++ b/src/heartbeat.py @@ -53,6 +53,9 @@ def run_heartbeat(config: dict | None = None) -> str: hour = datetime.now().hour # local hour is_quiet = _is_quiet_hour(hour, quiet_hours) + if is_quiet: + return "HEARTBEAT_OK" + state = _load_state() checks = state.setdefault("checks", {}) results = [] @@ -65,8 +68,8 @@ def run_heartbeat(config: dict | None = None) -> str: results.append(email_result) checks["email"] = now.isoformat() - # Check 2: Calendar — daily summary + next-event reminder (no quiet hours bypass) - if check_flags.get("calendar") and not is_quiet and _should_run("calendar", checks, now, cooldowns): + # Check 2: Calendar — daily summary + next-event reminder + if check_flags.get("calendar") and _should_run("calendar", checks, now, cooldowns): cal_result = _check_calendar_smart(state, quiet_hours) if cal_result: results.append(cal_result) @@ -94,23 +97,14 @@ def run_heartbeat(config: dict | None = None) -> str: checks["embeddings"] = now.isoformat() # Claude CLI: run if HEARTBEAT.md has extra instructions - if not is_quiet: - claude_result = _run_claude_extra( - hb_config, critical + results, is_quiet - ) - if claude_result: - results.append(claude_result) + claude_result = _run_claude_extra(hb_config, critical + results) + if claude_result: + results.append(claude_result) # Update state state["last_run"] = now.isoformat() _save_state(state) - # Critical items always get through (even quiet hours) - if is_quiet: - if critical: - return " | ".join(critical) - return "HEARTBEAT_OK" - all_results = critical + results if not all_results: return "HEARTBEAT_OK" @@ -408,8 +402,7 @@ def _get_extra_instructions() -> str | None: return "\n".join(meaningful).strip() -def _run_claude_extra(hb_config: dict, python_results: list[str], - is_quiet: bool) -> str | None: +def _run_claude_extra(hb_config: dict, python_results: list[str]) -> str | None: """Run Claude CLI if HEARTBEAT.md has extra instructions.""" from src.claude_session import CLAUDE_BIN, _safe_env @@ -457,7 +450,7 @@ def _run_claude_extra(hb_config: dict, python_results: list[str], return None data = json.loads(proc.stdout) result = data.get("result", "").strip() - if not result or result == "HEARTBEAT_OK": + if not result or "HEARTBEAT_OK" in result: return None return result except subprocess.TimeoutExpired: diff --git a/src/main.py b/src/main.py index e90b904..015e112 100644 --- a/src/main.py +++ b/src/main.py @@ -94,7 +94,7 @@ def main(): try: result = await asyncio.to_thread(run_heartbeat, config) logger.info("Heartbeat: %s", result) - if result != "HEARTBEAT_OK": + if result and "HEARTBEAT_OK" not in result: await _send_to_channel(hb_channel, result) except Exception as exc: logger.error("Heartbeat failed: %s", exc)