#Hook System: Sender Identity Not Preserved in Cross-Gateway Messaging
1 messages · Page 1 of 1 (latest)
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-HookAgentPayloadtype (missingfromAgentId)src/gateway/server/hooks.ts:33-dispatchAgentHookdoesn't pass sender identitysrc/cron/types.ts:22-CronPayload.agentTurnhas nofromAgentIdfieldsrc/infra/outbound/deliver.ts:138-deliverOutboundPayloadsdelivers using agent config
Recommended Fix (Option 1)
Add fromAgentId field through the entire chain:
- Hook payload (
src/gateway/hooks.ts): AddfromAgentId?: string - Cron job (
src/cron/types.ts): AddfromAgentIdtoCronPayload.agentTurn - Agent turn (
src/cron/isolated-agent/run.ts): PassfromAgentIdto delivery
- Delivery (
src/infra/outbound/deliver.ts): Accept and usefromAgentId
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.