feat(config): watch runtime configuration changes (#5026)

This commit is contained in:
chengyongru authored and GitHub committed 2026-07-22 13:08:39 +08:00
1 parent 7bf7469d90
commit 3748f664b2
11 files changed
+190 -7

No files matched your search

+10
View File
@@ -1609,6 +1609,7 @@ def _run_gateway(
from nanobot.bus.queue import MessageBus
from nanobot.bus.runtime_events import RuntimeEventBus
from nanobot.channels.manager import ChannelManager
from nanobot.config.watcher import watch_config_file
from nanobot.cron.bound_runner import run_bound_cron_job
from nanobot.cron.service import CronJobSkippedError, CronService
from nanobot.cron.session_turns import is_bound_cron_job
@@ -2070,7 +2071,16 @@ def _run_gateway(
)
try:
await cron.start()
# Re-read once on first admission to close the watcher subscription window.
agent.runtime_resolver.invalidate()
tasks = [
asyncio.create_task(
watch_config_file(
Path(config_path),
lambda: agent.runtime_resolver.invalidate(),
),
name="nanobot-config-watcher",
),
asyncio.create_task(agent.run(), name="nanobot-agent-loop"),
asyncio.create_task(channels.start_all(), name="nanobot-channels"),
asyncio.create_task(