25 Commits

Author SHA1 Message Date
weitongtong
e0ba568089 fix(cron): 修复固定间隔任务因 store 并发替换导致的重复执行
_on_timer 中 await _execute_job 让出控制权期间,前端轮询触发的
list_jobs 调用 _load_store 从磁盘重新加载覆盖 self._store,
已执行任务的状态被旧值回退,导致再次触发。
引入 _timer_active 标志位,在任务执行期间阻止并发 _load_store
替换 store。同时修复 store 为空时未重新 arm timer 的问题。

Made-with: Cursor
2026-04-11 16:15:01 +08:00
weitongtong
1a51f907aa feat(cron): 添加 CronService.update_job 方法
支持更新已有定时任务的名称、调度计划、消息内容、投递配置等可变字段。
系统任务(system_event)受保护不可编辑。包含完整的单元测试覆盖。

Made-with: Cursor
2026-04-10 19:03:13 +08:00
Xubin Ren
142cb46956 fix(cron): preserve manual run state and merged history
Keep manual runs from flipping the scheduler's running flag, rebuild merged run history records from action logs, and avoid delaying sub-second jobs to a one-second floor. Add regression coverage for disabled/manual runs, merged history persistence, and sub-second timers.

Made-with: Cursor
2026-04-08 23:34:47 +08:00
xinnan.hou
0f1e3aa151 fix 2026-04-08 23:34:47 +08:00
xinnan.hou
fd2bb3bb7d fix comment 2026-04-07 22:48:40 +08:00
xinnan.hou
4e914d0e2a fix not reload job config 2026-04-07 22:48:40 +08:00
Xubin Ren
408a61b0e1 feat(memory): protect Dream cron and polish migration UX 2026-04-04 09:01:42 +00:00
chengyongru
b9616674f0 feat(agent): two-stage memory system with Dream consolidation
Replace single-stage MemoryConsolidator with a two-stage architecture:

- Consolidator: lightweight token-budget triggered summarization,
  appends to HISTORY.md with cursor-based tracking
- Dream: cron-scheduled two-phase processor that analyzes HISTORY.md
  and updates SOUL.md, USER.md, MEMORY.md via AgentRunner with
  edit_file tools for surgical, fault-tolerant updates

New files: MemoryStore (pure file I/O), Dream class, DreamConfig,
/dream and /dream-log commands. 89 tests covering all components.
2026-04-02 22:42:25 +08:00
Xubin Ren
09ad9a4673 feat(cron): add run history tracking for cron jobs
Record run_at_ms, status, duration_ms and error for each execution,
keeping the last 20 entries per job in jobs.json. Adds CronRunRecord
dataclass, get_job() lookup, and four regression tests covering
success, error, trimming and persistence.

Closes #1837

Made-with: Cursor
2026-03-21 02:28:35 +08:00
Re-bin
9877195de5 chore(cron): remove redundant timer comment 2026-03-02 06:37:57 +00:00
yzchen
dba93ae83a cron: reload jobs store on each timer tick 2026-03-02 11:19:45 +08:00
Re-bin
3c6c49cc5d Merge branch 'main' into pr-1339
Made-with: Cursor

# Conflicts:
#	nanobot/cron/service.py
2026-03-01 06:06:01 +00:00
Re-bin
89e5a28097 fix(cron): auto-reload jobs.json when modified externally 2026-03-01 06:01:47 +00:00
JK_Lu
977ca725f2 style: unify code formatting and import order
- Remove trailing whitespace and normalize blank lines
- Unify string quotes and line breaks for long lines
- Sort imports alphabetically across modules
2026-02-28 20:55:43 +08:00
Re-bin
2b8c082428 Merge branch 'main' into pr-763 2026-02-20 08:04:48 +00:00
Re-bin
73fdd0dd45 fix: complete ensure_ascii=False and UTF-8 encoding migration 2026-02-20 07:59:32 +00:00
Re-bin
37252a4226 fix: complete loguru native formatting migration across all files 2026-02-20 07:55:34 +00:00
Nikolas de Hor
53b83a38e2 fix: use loguru native formatting to prevent KeyError on messages containing curly braces
Closes #857
2026-02-19 17:19:36 -03:00
chtangwin
c7b5dd9350 Fix: Ensure UTF-8 encoding for all file operations 2026-02-18 18:28:54 -08:00
Alexander Minges
4a85cd9a11
fix(cron): add service-layer timezone validation
Adds `_validate_schedule_for_add()` to `CronService.add_job` so that
invalid or misplaced `tz` values are rejected before a job is persisted,
regardless of which caller (CLI, tool, etc.) invoked the service.

Surfaces the resulting `ValueError` in `nanobot cron add` via a
`try/except` so the CLI exits cleanly with a readable error message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 19:33:23 +01:00
Re-bin
6bae6a617f fix(cron): fix timezone display bug, add tz validation and skill docs 2026-02-17 08:30:52 +00:00
jopo
ae903e983c fix(cron): improve timezone scheduling and tz propagation 2026-02-16 17:49:19 -08:00
Ahwei
d3f6c95ceb refactor(cron): simplify timezone logic and merge conditional branches
With tz: Use the specified timezone (e.g., "Asia/Shanghai").
Without tz: Use the local timezone (datetime.now().astimezone().tzinfo) instead of defaulting to UTC
2026-02-14 10:27:09 +08:00
Ahwei
153c83e340 fix(cron): add timezone support for accurate next run time calculation
When schedule.tz is present, use the specified timezone to calculate the next execution time, ensuring scheduled tasks trigger correctly across different timezones.
2026-02-14 10:23:54 +08:00
Re-bin
d4cc48afd5 🐈nanobot: hello world! 2026-02-01 07:36:42 +00:00