fix: bypass DM sessions without metadata and make tool globally visible #4
Reference in New Issue
Block a user
Delete Branch "fix/dm-bypass-and-tool-visibility"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Changes
1. DM session bypass (fixes no-reply on DM)
When neither
senderIdnorchannelIdcan be extracted from the prompt, this is a DM session where OpenClaw does not inject untrusted conversation metadata. Previously these sessions hitrule_match_no_end_symboland were silenced.Fix: add early return in
evaluateDecision— if both are missing, bypass the gate withdm_no_metadata_bypassreason and inject end-marker normally.2. Tool visibility (fixes agents not seeing whispergateway_tools)
registerToolwas called with{ optional: true }, requiring each agent to havetools.allow: ["whispergate"]. Onlymainhad this. Changed to{ optional: false }so the tool is visible to all agents by default.Affected agents: administrative-secretary, agent-resource-director, developer, operator, manager, mentor, recruiter, dispatcher.
getLastChar was checking the last character of the full event.prompt, which includes Conversation/Sender metadata blocks appended by OpenClaw after the actual message. This meant end symbols like 🔚 at the end of the message body were invisible — the last char was always backtick or whitespace from the metadata JSON block. Fix: strip trailing '(untrusted metadata)' blocks before extracting the last character. This only affects non-humanList senders (humanList senders bypass end symbol check via human_list_sender reason).getLastChar used t[t.length-1] which only gets the trailing surrogate of emoji like 🔚 (U+1F51A, a surrogate pair in UTF-16). This meant end symbol matching ALWAYS failed for emoji symbols, causing every non-humanList message to hit rule_match_no_end_symbol -> no-reply. Fix: use Array.from(t) to correctly split by Unicode code points.