chore: auto-commit from dashboard

This commit is contained in:
2026-03-03 20:17:07 +00:00
parent 19e253ec43
commit 006123a63b
3 changed files with 13 additions and 20 deletions

View File

@@ -25,7 +25,7 @@
} }
}, },
"heartbeat": { "heartbeat": {
"enabled": true, "enabled": false,
"interval_minutes": 120, "interval_minutes": 120,
"channel": "echo-core", "channel": "echo-core",
"model": "haiku", "model": "haiku",
@@ -34,7 +34,7 @@
"email": true, "email": true,
"calendar": true, "calendar": true,
"kb_index": true, "kb_index": true,
"git": true "git": false
}, },
"cooldowns": { "cooldowns": {
"email": 1800, "email": 1800,

View File

@@ -53,6 +53,9 @@ def run_heartbeat(config: dict | None = None) -> str:
hour = datetime.now().hour # local hour hour = datetime.now().hour # local hour
is_quiet = _is_quiet_hour(hour, quiet_hours) is_quiet = _is_quiet_hour(hour, quiet_hours)
if is_quiet:
return "HEARTBEAT_OK"
state = _load_state() state = _load_state()
checks = state.setdefault("checks", {}) checks = state.setdefault("checks", {})
results = [] results = []
@@ -65,8 +68,8 @@ def run_heartbeat(config: dict | None = None) -> str:
results.append(email_result) results.append(email_result)
checks["email"] = now.isoformat() checks["email"] = now.isoformat()
# Check 2: Calendar — daily summary + next-event reminder (no quiet hours bypass) # Check 2: Calendar — daily summary + next-event reminder
if check_flags.get("calendar") and not is_quiet and _should_run("calendar", checks, now, cooldowns): if check_flags.get("calendar") and _should_run("calendar", checks, now, cooldowns):
cal_result = _check_calendar_smart(state, quiet_hours) cal_result = _check_calendar_smart(state, quiet_hours)
if cal_result: if cal_result:
results.append(cal_result) results.append(cal_result)
@@ -94,23 +97,14 @@ def run_heartbeat(config: dict | None = None) -> str:
checks["embeddings"] = now.isoformat() checks["embeddings"] = now.isoformat()
# Claude CLI: run if HEARTBEAT.md has extra instructions # Claude CLI: run if HEARTBEAT.md has extra instructions
if not is_quiet: claude_result = _run_claude_extra(hb_config, critical + results)
claude_result = _run_claude_extra( if claude_result:
hb_config, critical + results, is_quiet results.append(claude_result)
)
if claude_result:
results.append(claude_result)
# Update state # Update state
state["last_run"] = now.isoformat() state["last_run"] = now.isoformat()
_save_state(state) _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 all_results = critical + results
if not all_results: if not all_results:
return "HEARTBEAT_OK" return "HEARTBEAT_OK"
@@ -408,8 +402,7 @@ def _get_extra_instructions() -> str | None:
return "\n".join(meaningful).strip() return "\n".join(meaningful).strip()
def _run_claude_extra(hb_config: dict, python_results: list[str], def _run_claude_extra(hb_config: dict, python_results: list[str]) -> str | None:
is_quiet: bool) -> str | None:
"""Run Claude CLI if HEARTBEAT.md has extra instructions.""" """Run Claude CLI if HEARTBEAT.md has extra instructions."""
from src.claude_session import CLAUDE_BIN, _safe_env 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 return None
data = json.loads(proc.stdout) data = json.loads(proc.stdout)
result = data.get("result", "").strip() result = data.get("result", "").strip()
if not result or result == "HEARTBEAT_OK": if not result or "HEARTBEAT_OK" in result:
return None return None
return result return result
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:

View File

@@ -94,7 +94,7 @@ def main():
try: try:
result = await asyncio.to_thread(run_heartbeat, config) result = await asyncio.to_thread(run_heartbeat, config)
logger.info("Heartbeat: %s", result) logger.info("Heartbeat: %s", result)
if result != "HEARTBEAT_OK": if result and "HEARTBEAT_OK" not in result:
await _send_to_channel(hb_channel, result) await _send_to_channel(hb_channel, result)
except Exception as exc: except Exception as exc:
logger.error("Heartbeat failed: %s", exc) logger.error("Heartbeat failed: %s", exc)