fix: correctly respect session flag in agent command
Previously, the session flag was ignored in the agent command, with custom session keys being replaced by the default routing session. The issue was caused by the code only honoring session keys that started with the prefix 'agent:'. This fix modifies the condition on how the session key is selected to honor any custom session key provided via command line --session flag, regardless of prefix. Now the custom session keys like "foobar" will generate "foobar.json" file instead of "agent_main_main.json". FIXES #1039 🤖 AI Assisted - Human designed the solution, AI helped implement it
This commit is contained in:
parent
b20099c411
commit
86a6dd48ce
1 changed files with 7 additions and 5 deletions
|
|
@ -485,11 +485,13 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
|
|||
}
|
||||
}
|
||||
|
||||
// Use routed session key, but honor pre-set agent-scoped keys (for ProcessDirect/cron)
|
||||
sessionKey := route.SessionKey
|
||||
if msg.SessionKey != "" && strings.HasPrefix(msg.SessionKey, "agent:") {
|
||||
sessionKey = msg.SessionKey
|
||||
}
|
||||
// Use custom session key if provided directly via ProcessDirect, else use route's default
|
||||
// Previously only honored agent: prefixed keys, now honors all custom keys
|
||||
sessionKey := route.SessionKey
|
||||
if msg.SessionKey != "" {
|
||||
sessionKey = msg.SessionKey
|
||||
}
|
||||
|
||||
|
||||
logger.InfoCF("agent", "Routed message",
|
||||
map[string]any{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue