fix(collaboration): harden delegated task isolation (#1486)

* 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>
This commit is contained in:
Duc Nguyenandntduc authored and GitHub committed 2026-07-30 14:17:40 +07:00
1 parent 496b7ffce6
commit bb7712a9ff
186 files changed
+18858 -1233

No files matched your search

@@ -6,6 +6,8 @@ import (
"strings"
"testing"
"github.com/google/uuid"
"github.com/nextlevelbuilder/goclaw/internal/providers"
"github.com/nextlevelbuilder/goclaw/internal/store"
usagecaps "github.com/nextlevelbuilder/goclaw/internal/usage/caps"
@@ -46,8 +48,11 @@ func TestSubagentSpawn_CapturesOriginContextWindow(t *testing.T) {
// Calling agent configured at 128k/8192, propagated via ctx (as injectContext does).
ctx := store.WithAgentContextWindow(context.Background(), 128_000)
ctx = store.WithAgentMaxTokens(ctx, 8_192)
ctx = store.WithTenantID(ctx, uuid.New())
ctx = store.WithAgentID(ctx, uuid.New())
ctx = WithToolAgentKey(ctx, "parent")
_, _, err := manager.RunSync(ctx, "parent", 0, "task", "label", "", "chan", "chat")
_, _, _, err := manager.RunSync(ctx, "parent", 0, "task", "label", "", "chan", "chat")
if err != nil {
t.Fatalf("RunSync error: %v", err)
}