fix: add default values for optional config fields #3

Merged
hzhang merged 34 commits from feat/whispergate-mvp into main 2026-02-27 15:31:33 +00:00
Collaborator

Add default values for enableDiscordControlTool, enableWhispergatePolicyTool, discordControlApiBaseUrl, enableDebugLogs, debugLogChannelIds to fix issue where whispergateway_tools tool was not exposed due to missing config fields in openclaw.json

Add default values for enableDiscordControlTool, enableWhispergatePolicyTool, discordControlApiBaseUrl, enableDebugLogs, debugLogChannelIds to fix issue where whispergateway_tools tool was not exposed due to missing config fields in openclaw.json
orion added 28 commits 2026-02-26 23:50:16 +00:00
Root cause: installer called 'openclaw gateway restart' (async via systemd)
then immediately validated model visibility — race condition caused validation
to fail and rollback the correct config.

Fix: remove restart + validation from script entirely. Script only writes config.
User restarts gateway manually after install completes.

Also fix CONFIG.example.json: contextWindow 4096->200000, maxTokens 64->8192
(OpenClaw requires minimum 16000 contextWindow).
Root cause: PluginHookAgentContext in before_model_resolve only has
agentId, sessionKey, sessionId, workspaceDir, messageProvider.
senderId, channelId, input are NOT available in this hook phase.

The plugin was reading ctx.senderId (undefined) -> inHumanList=false
for ALL Discord sessions -> shouldUseNoReply=true -> all silenced.

Fix: use event.prompt which contains the full user message including
the 'Conversation info (untrusted metadata)' JSON block, and extract
sender_id from there. Same fix applied to before_prompt_build.
Reviewed-on: orion/WhisperGate#2
- Add default values for enableDiscordControlTool, enableWhispergatePolicyTool,
  discordControlApiBaseUrl, enableDebugLogs, debugLogChannelIds
- Merge defaults in both baseConfig and getLivePluginConfig
- Fixes issue where whispergateway_tools tool was not exposed due to missing
  config fields in openclaw.json
hzhang added 6 commits 2026-02-27 15:30:12 +00:00
1. DM bypass: when neither senderId nor channelId can be extracted from
   the prompt (DM sessions lack untrusted conversation info), skip the
   no-reply gate and allow the message through with end-marker injection.

2. Tool visibility: change whispergateway_tools registration from
   optional=true to optional=false so all agents can see the tool
   without needing explicit tools.allow entries.
PLUGIN_PATH defaulted to /root/.openclaw/workspace-operator/... regardless
of which workspace the installer was run from. Now resolves relative to
the script location (../dist/whispergate).
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).
- buildEndMarkerInstruction() replaces hardcoded END_MARKER_INSTRUCTION,
  dynamically using the resolved policy's endSymbols
- Instruction now explicitly exempts gateway keywords (NO_REPLY, HEARTBEAT_OK)
  from requiring end symbols
- Export resolvePolicy from rules.ts for reuse in before_prompt_build hook
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.
Reviewed-on: orion/WhisperGate#4
hzhang merged commit 52a613fdcc into main 2026-02-27 15:31:33 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nav/Dirigent#3