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>
In busy channels, many messages arrive during a non-speaker turn,
each incrementing the blocked-pending counter. Without a cap the
counter grows faster than it drains, causing the speaker to spin
indefinitely consuming NO_REPLY completions.
Cap at MAX_BLOCKED_PENDING=3 in both incrementBlockedPending and
markTurnStarted (retroactive cap to recover from accumulated debt).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
message-received.ts:
- message_received ctx has channelId/accountId/conversationId (not
sessionKey). Add extraction from ctx.channelId and metadata.to
("channel:ID" format) before the conversation_info fallback.
agent-end.ts:
- When tail-match is interrupted, only call wakeFromDormant() if the
channel is actually dormant. For non-dormant interrupts (e.g. the
moderator bot's own trigger messages firing message_received on
other agents), fall through to normal advanceSpeaker() so the turn
cycle continues correctly instead of re-triggering the same speaker.
- Import isDormant from turn-manager.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
auth: "gateway" requires Bearer token in Authorization header,
which browser direct navigation never sends (no session cookies).
auth: "plugin" allows unauthenticated access on loopback, which
is sufficient since gateway is bound to 127.0.0.1 only.
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>
When the turn manager determines it's an agent's turn (checkTurn.allowed),
the rules engine's evaluateDecision() could still override the model to
no-reply with reason 'rule_match_no_end_symbol'. This happened because:
1. The sender of the triggering message (another agent) was not in the
humanList, so the rules fell through to the end-symbol check.
2. getLastChar() operates on the full prompt (including system content
like Runtime info), so it never found the end symbol even when the
actual message ended with one.
Fix: return early from before_model_resolve after the turn check passes,
skipping the rules-based no-reply override entirely. The turn manager is
the authoritative source for multi-agent turn coordination.
Tested: 3-agent counting chain ran successfully (3→11) with correct
NO_REPLY handling when count exceeded threshold.
Problems fixed:
1. before_message_write treated empty content (isEmpty) as NO_REPLY.
Tool-call-only assistant messages (thinking + toolCall, no text)
had empty extracted text, causing false NO_REPLY detection.
In single-agent channels this immediately set turn to dormant,
blocking all subsequent responses for the entire model run.
2. Added explicit toolCall/tool_call/tool_use detection in
before_message_write — skip turn processing for intermediate
tool-call messages entirely.
3. no-reply-api/server.mjs: default model name changed from
'dirigent-no-reply-v1' to 'no-reply' to match the configured
model id in openclaw.json, fixing model list discovery.
Changes:
- plugin/hooks/before-message-write.ts: toolCall detection + remove isEmpty
- plugin/hooks/message-sent.ts: remove isEmpty from wasNoReply
- no-reply-api/server.mjs: fix default model name
- dist/dirigent/index.ts: same fixes applied to monolithic build
- dist/no-reply-api/server.mjs: same model name fix
- Add waitIdentifier config (default: 👤) to DirigentConfig and plugin schema
- Prompt injection: tells agents to end with 👤 when they need a human reply,
warns to use sparingly (only when human is actively participating)
- Detection in before_message_write and message_sent hooks
- Turn manager: new waitingForHuman state
- checkTurn() blocks all agents when waiting
- onNewMessage() clears state on human message
- Non-human messages ignored while waiting
- resetTurn() also clears waiting state
- All agents routed to no-reply model during waiting state
- Update docs (FEAT.md, CHANGELOG.md, TASKLIST.md, README.md)