Compare commits

...

5 Commits

Author SHA1 Message Date
1b2b37a6bb chore: auto-commit from dashboard 2026-04-23 21:24:43 +00:00
277a43b81f chore(cron): shift heartbeat window to 09-23 Bucharest time
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 20:05:01 +00:00
04d49e7ea3 chore(cron): shift heartbeat window to 09-23 Bucharest time
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 20:04:15 +00:00
537bab465c refactor(main): remove unused Python heartbeat in favor of cron job
Heartbeat is now handled exclusively by the Claude-based cron job
(heartbeat-2h in jobs.json), which is more flexible.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 20:02:23 +00:00
0c02f0de50 fix(scheduler): suppress channel send when result is HEARTBEAT_OK
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 19:59:11 +00:00
6 changed files with 36 additions and 40 deletions

View File

@@ -37,9 +37,9 @@
"report_on": "changes",
"timeout": 120,
"enabled": true,
"last_run": "2026-04-22T16:00:00.001042+00:00",
"last_run": "2026-04-23T16:00:00.001018+00:00",
"last_status": "ok",
"next_run": "2026-04-23T10:00:00+00:00"
"next_run": "2026-04-24T10:00:00+00:00"
},
{
"name": "security-audit-daily",
@@ -263,14 +263,14 @@
},
{
"name": "heartbeat-2h",
"cron": "0 7-23/2 * * *",
"cron": "0 6-18/2 * * *",
"channel": "echo-work",
"model": "sonnet",
"prompt": "Heartbeat check. Rulează src/heartbeat.py printr-un scurt raport de status.\nDacă nu e nimic de raportat (email=0, calendar nu are evenimente <2h, kb ok), răspunde doar cu HEARTBEAT_OK și oprește-te — nu trimite mesaj.\nDacă e ceva: raport scurt pe Discord #echo-work.",
"allowed_tools": [],
"enabled": true,
"last_run": "2026-04-23T09:00:00.001275+00:00",
"last_run": "2026-04-23T21:00:00.000995+00:00",
"last_status": "ok",
"next_run": "2026-04-23T11:00:00+00:00"
"next_run": "2026-04-23T23:00:00+00:00"
}
]

View File

@@ -1,5 +1,5 @@
{
"last_sent": 14,
"last_sent": 15,
"year": 2026,
"last_sent_at": "2026-04-09T14:23:55.586085+00:00"
"last_sent_at": "2026-04-23T14:10:50.295027+00:00"
}

View File

@@ -13,7 +13,7 @@
"ok": true,
"status": "OK",
"message": "Nicio modificare detectată",
"lastCheck": "22 Apr 2026, 16:00",
"lastCheck": "23 Apr 2026, 16:00",
"changesCount": 0
}
}

View File

@@ -83,37 +83,6 @@ def main():
scheduler = Scheduler(send_callback=_send_to_channel, config=config)
client.scheduler = scheduler # type: ignore[attr-defined]
# Heartbeat: register as periodic job if enabled
hb_config = config.get("heartbeat", {})
if hb_config.get("enabled"):
from src.heartbeat import run_heartbeat
interval_min = hb_config.get("interval_minutes", 30)
hb_channel = hb_config.get("channel", "echo-core")
async def _heartbeat_tick() -> None:
"""Run heartbeat and send findings to channel."""
try:
result = await asyncio.to_thread(run_heartbeat, config)
logger.info("Heartbeat: %s", result)
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)
from apscheduler.triggers.interval import IntervalTrigger
scheduler._scheduler.add_job(
_heartbeat_tick,
trigger=IntervalTrigger(minutes=interval_min),
id="__heartbeat__",
max_instances=1,
)
logger.info(
"Heartbeat registered (every %d min, channel: %s)",
interval_min, hb_channel,
)
# Newsletter Cercetași checker (optional)
newsletter_config = config.get("newsletter_cercetasi", {})
if newsletter_config.get("enabled"):

View File

@@ -374,7 +374,7 @@ class Scheduler:
self._save_jobs()
# Send output via callback if we have something to send
if result_text and self._send_callback:
if result_text and "HEARTBEAT_OK" not in result_text and self._send_callback:
try:
await self._send_callback(job["channel"], result_text)
except Exception as exc:
@@ -393,6 +393,7 @@ class Scheduler:
CLAUDE_BIN, "-p", job["prompt"],
"--model", job["model"],
"--output-format", "json",
"--dangerously-skip-permissions",
]
try:

View File

@@ -955,3 +955,29 @@
[2026-04-22 16:00:01] OK: SIT_FIN_AN_2025
[2026-04-22 16:00:01] OK: DESCARCARE_DECLARATII
[2026-04-22 16:00:01] === Monitor complete ===
[2026-04-23 10:00:00] === Starting ANAF monitor v2.1 ===
[2026-04-23 10:00:00] OK: D100
[2026-04-23 10:00:00] OK: D101
[2026-04-23 10:00:00] OK: D300
[2026-04-23 10:00:00] OK: D390
[2026-04-23 10:00:00] OK: D394
[2026-04-23 10:00:00] OK: D205
[2026-04-23 10:00:00] OK: D406
[2026-04-23 10:00:01] OK: BILANT_2025
[2026-04-23 10:00:01] OK: SIT_FIN_SEM_2025
[2026-04-23 10:00:01] OK: SIT_FIN_AN_2025
[2026-04-23 10:00:01] OK: DESCARCARE_DECLARATII
[2026-04-23 10:00:01] === Monitor complete ===
[2026-04-23 16:00:00] === Starting ANAF monitor v2.1 ===
[2026-04-23 16:00:00] OK: D100
[2026-04-23 16:00:00] OK: D101
[2026-04-23 16:00:00] OK: D300
[2026-04-23 16:00:00] OK: D390
[2026-04-23 16:00:00] OK: D394
[2026-04-23 16:00:00] OK: D205
[2026-04-23 16:00:01] OK: D406
[2026-04-23 16:00:01] OK: BILANT_2025
[2026-04-23 16:00:01] OK: SIT_FIN_SEM_2025
[2026-04-23 16:00:01] OK: SIT_FIN_AN_2025
[2026-04-23 16:00:01] OK: DESCARCARE_DECLARATII
[2026-04-23 16:00:01] === Monitor complete ===