Files
loki/scripts
g-but 483b9b74e2 fix(daemon): sync agent-projects.conf on startup + every 5 min
agent-projects.conf is the local mirror of user_projects (name, dir,
agent_pref). sync-agent-runtime-config.py fetches /api/agent/projects
and rewrites the file — but only ran from agent-hook-bridge.sh on
agent stop hooks. So a pref change made via the web Settings page sat
unapplied until the next agent stopped: could be hours.

a6b8658 just made _resolve_live_adapter read this conf as a fallback
to honor the user's agent pref. Pairing that with a daemon that never
re-reads the cloud meant the fallback would silently use stale data.

Fix: run sync once at daemon startup (non-blocking, background), and
schedule a _conf_sync_loop that re-syncs every 300s. Both also write
to the same conf file via tempfile+os.replace, so reads are atomic
and never see a half-written file. _CONF_SYNC_PID is killed in the
existing _shutdown trap so SIGTERM cleans both background loops.

Bounded staleness: any pref change in cloud Settings now propagates
to the local daemon within 5 min (or instantly on next daemon restart),
without needing an agent stop event to trigger sync.
2026-05-31 01:31:35 +02:00
..