mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix(session): tighten main-session alias detection to exact 3-part format
Only match agent:X:main, not agent:X:direct:main or agent:X:slack:channel:main. Review feedback from afjcjsbx.
This commit is contained in:
+6
-2
@@ -268,9 +268,13 @@ func isMainSessionAlias(alias string) bool {
|
||||
if alias == "" {
|
||||
return false
|
||||
}
|
||||
// Legacy form: "agent:main:main" (case-insensitive)
|
||||
// Legacy form: "agent:main:main" (exactly 3 colon-separated parts)
|
||||
// Must not match "agent:sales:direct:main" etc.
|
||||
if strings.HasPrefix(alias, "agent:") && strings.HasSuffix(alias, ":main") {
|
||||
return true
|
||||
parts := strings.SplitN(alias, ":", 4)
|
||||
if len(parts) == 3 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// Opaque form: "sk_v1_" + SHA256("agent:main:main")
|
||||
if strings.HasPrefix(alias, "sk_v1_") {
|
||||
|
||||
Reference in New Issue
Block a user