mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-12 18:11:51 +08:00
fix(v2/delivery): allow agent self-messages without a destination row
Approval follow-up prompts (e.g. the post-rebuild "Packages installed, verify they work" note) are written with channel_type='agent' and platform_id=<self agent_group_id>, and were dropped by the agent-to-agent authorization check because no self-destination row exists. Agents are always authorized to message themselves; skip the hasDestination check when source == target. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -319,7 +319,12 @@ async function deliverMessage(
|
||||
log.warn('Agent message missing target agent group ID', { id: msg.id });
|
||||
return;
|
||||
}
|
||||
if (!hasDestination(session.agent_group_id, 'agent', targetAgentGroupId)) {
|
||||
// Self-messages are always allowed — used for system notes injected back
|
||||
// into an agent's own session (e.g. post-approval follow-up prompts).
|
||||
if (
|
||||
targetAgentGroupId !== session.agent_group_id &&
|
||||
!hasDestination(session.agent_group_id, 'agent', targetAgentGroupId)
|
||||
) {
|
||||
log.warn('Unauthorized agent-to-agent message — dropping', {
|
||||
source: session.agent_group_id,
|
||||
target: targetAgentGroupId,
|
||||
|
||||
Reference in New Issue
Block a user