fix(cron): preserve channel ID case in MCP loopback delivery context (#75261)#75303
Closed
hclsys wants to merge 1 commit into
Closed
fix(cron): preserve channel ID case in MCP loopback delivery context (#75261)#75303hclsys wants to merge 1 commit into
hclsys wants to merge 1 commit into
Conversation
…penclaw#75261) Thread the inbound x-openclaw-current-channel-id header through the MCP loopback request context into resolveGatewayScopedTools and on to the cron tool's currentDeliveryContext. Without this, the loopback path had no currentChannelId so inferDeliveryFromSessionKey fell back, which runs the session key through parseAgentSessionKey (normalizeOptionalLowercaseString) and lowercases the Matrix room ID in cron delivery.to. Adds regression test: x-openclaw-current-channel-id header preserved case-sensitively through to tool resolution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #75261 — cron jobs created via
mcp__openclaw__cron action=addwithsessionTarget=currentfrom a Claude CLI subprocess (MCP loopback path) stored a lowercased Matrix room ID indelivery.to, causingM_UNKNOWN: non-create event for room of unknown version [500]on every cron run.Root cause: The MCP loopback tool resolution path (
resolveGatewayScopedToolscalled fromMcpLoopbackToolCache) had nocurrentChannelId. The cron tool fell back toinferDeliveryFromSessionKey, which passes the session key throughparseAgentSessionKey→normalizeOptionalLowercaseString→ lowercase.The fix from #71798 (
inferDeliveryFromContext) already preserves the channel ID correctly, but only activates whencurrentChannelIdis populated. This PR threads the case-sensitive channel ID through the entire loopback pipeline:RunCliAgentParams.currentChannelId(new field)OPENCLAW_MCP_CURRENT_CHANNEL_IDenv var →x-openclaw-current-channel-idheaderMcpRequestContext.currentChannelId(parsed from header, not normalized to lowercase)McpLoopbackToolCache.resolve→resolveGatewayScopedTools→createOpenClawToolsTest plan
x-openclaw-current-channel-idheader with mixed-case Matrix room ID is passed unchanged toresolveGatewayScopedTools(currentChannelId: "!c9p9XFWiH5Szl4yZiP:matrix.example")createMcpLoopbackServerConfigtest updated to assert the new header template is presentmcp-http.test.tstests pass; 1799/1799 gateway tests pass🤖 Generated with Claude Code