Sidecar lifecycle:
- Move startSideCar() out of register() into an api.on("gateway_start", ...)
handler. register() runs in every CLI subprocess that loads plugins
(e.g. `openclaw completion`, `openclaw doctor`); eagerly spawning a
long-lived process there hung `openclaw update`'s post-update steps.
- Spawn the sidecar with detached: true, stdio routed to a log file fd,
and call .unref() so the host's event loop is never held by the child.
Even if a future caller invokes startSideCar in a non-gateway context,
it can no longer block that host from exiting.
- Sidecar logs now go to ~/.openclaw/logs/dirigent-sidecar.log instead of
being piped through the host logger.
Plugin SDK convention update:
- Wrap default export with definePluginEntry({ id, name, description, register })
per the current openclaw plugin authoring contract.
- Switch all imports from the deprecated root barrel "openclaw/plugin-sdk"
to focused subpaths "openclaw/plugin-sdk/core" and
"openclaw/plugin-sdk/plugin-entry".
- Modernize openclaw.plugin.json: drop entry/version, add description,
declare contracts.tools[] for the 6 tools, set activation.onStartup: true
so gateway_start fires for this plugin at boot.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two bugs that prevented turn-manager dormancy from ever triggering:
1. isEmptyTurn too strict: agents output multi-line text ending with
"NO_REPLY" on the last line, but the regex ^NO_REPLY$ required the
entire string to match. Now checks only the last non-empty line.
2. blocked_pending counter inflation: non-speaker suppressions incremented
the counter but their stale NO_REPLYs were discarded at the
!isCurrentSpeaker early return without decrementing. Over a full cycle
the counter inflated by the number of suppressions, causing the agent's
real empty turn to be misidentified as stale when it finally arrived.
Fix: at both early-return points in agent_end (!isCurrentSpeaker and
!isTurnPending), drain blocked_pending when the turn is empty.
Also fixed: pollForTailMatch now uses any-message detection (instead of
tail-fingerprint content matching) with a 30 s timeout, avoiding infinite
polling when agents send concise Discord messages after verbose LLM output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The moderator bot's own idle reminder message triggered message_received,
which saw senderId != currentSpeaker and called wakeFromDormant, immediately
undoing the dormant state just entered.
Fix: derive the moderator bot's Discord user ID from the token and skip
wake-from-dormant when the sender is the moderator bot itself.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Complete rewrite of the Dirigent plugin turn management system to work
correctly with OpenClaw's VM-context-per-session architecture:
- All turn state stored on globalThis (persists across VM context hot-reloads)
- Hooks registered unconditionally on every api instance; event-level dedup
(runId Set for agent_end, WeakSet for before_model_resolve) prevents
double-processing
- Gateway lifecycle events (gateway_start/stop) guarded once via globalThis flag
- Shared initializingChannels lock prevents concurrent channel init across VM
contexts in message_received and before_model_resolve
- New ChannelStore and IdentityRegistry replace old policy/session-state modules
- Added agent_end hook with tail-match polling for Discord delivery confirmation
- Added web control page, padded-cell auto-scan, discussion tool support
- Removed obsolete v1 modules: channel-resolver, channel-modes, discussion-service,
session-state, turn-bootstrap, policy/store, rules, decision-input
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>