#Hook System: Sender Identity Not Preserved in Cross-Gateway Messaging

1 messages · Page 1 of 1 (latest)

sacred currentBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

humble ferryBOT
#

I've investigated the sender identity issue in the codebase. Here's what I found:

Root Cause

When Scotty (Pi) sends via /hooks/agent to Ada (main), the name field ("Scotty") is only used as the cron job name - not as the sender identity for delivery. The message delivery uses Ada's identity instead.

Key Files

  • src/gateway/hooks.ts:115 - HookAgentPayload type (missing fromAgentId)
  • src/gateway/server/hooks.ts:33 - dispatchAgentHook doesn't pass sender identity
  • src/cron/types.ts:22 - CronPayload.agentTurn has no fromAgentId field
  • src/infra/outbound/deliver.ts:138 - deliverOutboundPayloads delivers using agent config

Recommended Fix (Option 1)

Add fromAgentId field through the entire chain:

  1. Hook payload (src/gateway/hooks.ts): Add fromAgentId?: string
  2. Cron job (src/cron/types.ts): Add fromAgentId to CronPayload.agentTurn
  3. Agent turn (src/cron/isolated-agent/run.ts): Pass fromAgentId to delivery
#
  1. Delivery (src/infra/outbound/deliver.ts): Accept and use fromAgentId

This preserves the original sender identity across the hook→agent→delivery pipeline.

Priority: Medium - Attribution is wrong but functionality works. Fix ensures correct sender identity is preserved in cross-gateway messaging.