updateConfig method

void updateConfig(
  1. WorkflowConfig next
)

Hot-swaps the active workflow config.

Called by WorkflowWatcher listeners after WORKFLOW.md is reloaded. Subsequent reads of config.* inside ticks, dispatches, and retries observe the new values immediately. If polling.interval changed, the pending poll timer is cancelled and rescheduled with the new value so the change takes effect without waiting for the previously scheduled tick to fire.

In-flight agent sessions are not restarted; callers that need to react to changes in tracker.kind, agent.runner, or workspace.root should surface their own operator-visible warnings before invoking this method.

Implementation

void updateConfig(WorkflowConfig next) {
  final previous = _config;
  if (identical(previous, next)) return;

  _config = next;
  final intervalChanged = previous.polling.interval != next.polling.interval;

  _record(
    'config_reloaded',
    'Workflow config reloaded '
        '(poll=${next.polling.interval.inMilliseconds}ms, '
        'max_concurrent=${next.agent.maxConcurrentAgents}, '
        'max_turns=${next.agent.maxTurns}).',
    data: <String, dynamic>{
      'interval_changed': intervalChanged,
      'max_concurrent_agents': next.agent.maxConcurrentAgents,
      'max_turns': next.agent.maxTurns,
    },
  );

  if (intervalChanged && _running_ && !_shuttingDown) {
    _scheduleNextTick();
  }
}