fix: handle accountId in session key parsing for send policy and Discord exec approvals#27842
Closed
scz2011 wants to merge 1 commit into
Closed
fix: handle accountId in session key parsing for send policy and Discord exec approvals#27842scz2011 wants to merge 1 commit into
scz2011 wants to merge 1 commit into
Conversation
…ord exec approvals PR openclaw#27750 changed session key format for group/channel keys to include accountId: - Old: agent:<agentId>:<channel>:<peerKind>:<peerId> - New: agent:<agentId>:<channel>:<accountId>:<peerKind>:<peerId> This broke two critical features: 1. deriveChannelFromKey in send-policy.ts expected parts[1] to be peerKind, but it's now accountId. This caused channel-scoped deny rules to be skipped for group/channel keys, especially on first-use sessions. 2. extractDiscordChannelId regex /discord:(?:channel|group):(\d+)/ no longer matched the new format discord:<accountId>:channel:<id>. This broke channel-targeted approval workflows. Fixes: - Updated deriveChannelFromKey to check both parts[1] and parts[2] for peerKind, supporting both old and new formats - Updated extractDiscordChannelId regex to optionally match accountId segment - Added comprehensive tests for both old and new session key formats
Contributor
Greptile SummaryFixes two regressions from PR #27750's session key format change that added Changes:
Impact:
Confidence Score: 5/5
Last reviewed commit: 2893c61 |
Member
|
Superceded by existing commits on main |
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 two regressions introduced by PR #27750 which changed the session key format for group/channel keys to include
accountId.Problem
PR #27750 changed the session key format:
agent:<agentId>:<channel>:<peerKind>:<peerId>agent:<agentId>:<channel>:<accountId>:<peerKind>:<peerId>This broke two critical features:
1. Channel derivation in send policy (
deriveChannelFromKey)parts[1]to bepeerKind(group/channel)parts[1]isaccountId, causing channel-scoped deny rules to be skipped2. Discord exec approvals channel extraction (
extractDiscordChannelId)/discord:(?:channel|group):(\d+)/no longer matches new formatdiscord:<accountId>:channel:<id>Solution
Updated
deriveChannelFromKeyparts[1]andparts[2]for peerKind markersUpdated
extractDiscordChannelId/discord:(?:[^:]+:)?(?:channel|group):(\d+)/[^:]+:Testing
Added comprehensive test cases:
All tests passing.