Three related provisioning fixes: 1. **tools.exec.host auto-configuration**: Add `_tools_exec_host_patch()` that ensures `tools.exec.host` is set to `"gateway"` during `patch_agent_heartbeats()`. Without this, heartbeat-driven agents cannot execute `curl`, `bash`, or any shell command — making HEARTBEAT.md instructions unexecutable. The function is idempotent and respects existing user configuration. 2. **agents.update hot-reload race**: After `agents.create` writes to disk, the gateway triggers a ~500ms debounced hot-reload. If `agents.update` arrives before the reload completes, it returns "agent not found". Fix: add a 750ms delay after create + exponential backoff retry (5 attempts, 0.5s → 4s) on the update call. 3. **Skip no-op config.patch**: When `patch_agent_heartbeats()` detects no changes to agents, channels, or tools config, skip the `config.patch` RPC entirely. Each unnecessary patch triggers a gateway SIGUSR1 restart that rotates agent tokens and breaks active sessions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 KiB
43 KiB