Skip to content

Your lightweight open-source personal agent.

fix(cron): sanitize migrated legacy metadata

Xubin Ren1ac1b35c8413
diff --git a/nanobot/cron/service.py b/nanobot/cron/service.py
index 4ddfccc44..6ef5aa1bc 100644
--- a/nanobot/cron/service.py
+++ b/nanobot/cron/service.py
@@ -153,7 +153,7 @@ def _normalize_agent_turn_job(job: CronJob) -> bool:
payload.origin_channel = payload.origin_channel or payload.channel
payload.origin_chat_id = payload.origin_chat_id or payload.to
if not payload.origin_metadata:
- payload.origin_metadata = dict(payload.channel_meta or {})
+ payload.origin_metadata = _persistable_origin_metadata(payload.channel_meta or {})
payload.deliver = False
payload.channel = None
diff --git a/tests/cron/test_cron_service.py b/tests/cron/test_cron_service.py
index 1e4fb3f3c..2d7429db1 100644
--- a/tests/cron/test_cron_service.py
+++ b/tests/cron/test_cron_service.py
@@ -293,7 +293,12 @@ def test_load_store_migrates_legacy_delivery_context(tmp_path) -> None:
"deliver": True,
"channel": "telegram",
"to": "user-1",
- "channelMeta": {"message_thread_id": 42},
+ "channelMeta": {
+ "message_thread_id": 42,
+ RUNTIME_CONTEXT_INPUT_META: [
+ {"source": "webui_quote", "content": "stale quote"}
+ ],
+ },
"sessionKey": "telegram:user-1:topic:42",
},
"state": {},