mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-13 00:14:33 +00:00
* feat(collaboration): isolate delegated artifacts and child runs Isolate delegated inputs and outputs behind secure artifact exchange lifecycles. Scope Agent Link tasks by tenant and root agent, and enforce delegation spawn-tree boundaries. Add process-wide child-run admission and preserve logical media paths across native, MCP, and sandbox execution. * fix(collaboration): harden delegated task isolation Enforce tenant and root-agent task scope across migrations and stores. Add exactly-once async completion delivery, delegated sandbox boundaries, and confined artifact and media recovery across runtime surfaces. * fix(collaboration): recover interrupted async tasks * fix(collaboration): normalize persisted child-run status --------- Co-authored-by: ntduc <ntduc@cpp.ai.vn>
48 lines
1.6 KiB
Go
48 lines
1.6 KiB
Go
package tools
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
func TestSubagentAnnounceBatchKeyScopesRoutingAndAuthority(t *testing.T) {
|
|
base := SubagentTask{
|
|
OriginTenantID: uuid.New(),
|
|
RootAgentID: uuid.New(),
|
|
RootAgentKey: "root",
|
|
OriginSessionKey: "session",
|
|
OriginChannel: "telegram",
|
|
OriginChatID: "chat",
|
|
OriginPeerKind: "group",
|
|
OriginLocalKey: "topic",
|
|
OriginUserID: "user",
|
|
OriginSenderID: "sender",
|
|
OriginRole: "operator",
|
|
}
|
|
want := subagentAnnounceBatchKey(&base)
|
|
|
|
cases := map[string]func(*SubagentTask){
|
|
"tenant": func(v *SubagentTask) { v.OriginTenantID = uuid.New() },
|
|
"root id": func(v *SubagentTask) { v.RootAgentID = uuid.New() },
|
|
"root key": func(v *SubagentTask) { v.RootAgentKey += "-other" },
|
|
"session": func(v *SubagentTask) { v.OriginSessionKey += "-other" },
|
|
"channel": func(v *SubagentTask) { v.OriginChannel += "-other" },
|
|
"chat": func(v *SubagentTask) { v.OriginChatID += "-other" },
|
|
"peer kind": func(v *SubagentTask) { v.OriginPeerKind += "-other" },
|
|
"local key": func(v *SubagentTask) { v.OriginLocalKey += "-other" },
|
|
"user": func(v *SubagentTask) { v.OriginUserID += "-other" },
|
|
"sender": func(v *SubagentTask) { v.OriginSenderID += "-other" },
|
|
"role": func(v *SubagentTask) { v.OriginRole += "-other" },
|
|
}
|
|
for name, mutate := range cases {
|
|
t.Run(name, func(t *testing.T) {
|
|
got := base
|
|
mutate(&got)
|
|
if key := subagentAnnounceBatchKey(&got); key == want {
|
|
t.Fatalf("batch key did not change when %s changed", name)
|
|
}
|
|
})
|
|
}
|
|
}
|