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

+3 -18
View File
@@ -10,9 +10,9 @@ import "context"
type Scope string
const (
ScopePersonal Scope = "personal" // single user, isolated
ScopeTeam Scope = "team" // team context, shared or isolated
ScopeDelegate Scope = "delegate" // delegated task, scoped access
ScopePersonal Scope = "personal" // single user, isolated
ScopeTeam Scope = "team" // team context, shared or isolated
ScopeDelegate Scope = "delegate" // delegated task, scoped access
)
// WorkspaceContext is resolved ONCE at run start, immutable for the entire run.
@@ -24,13 +24,6 @@ type WorkspaceContext struct {
// Scope describes the access boundary type.
Scope Scope
// ReadOnlyPaths are additional paths the agent can read but NOT write.
ReadOnlyPaths []string
// SharedPath is the shared delegate area (read/write by both delegator + delegatee).
// nil when not in delegation context.
SharedPath *string
// TeamPath is the team workspace root (nil if not in team context).
TeamPath *string
@@ -65,7 +58,6 @@ type ResolveParams struct {
PeerKind string // "direct" | "group"
TeamID *string
TeamConfig *TeamWorkspaceConfig
DelegateCtx *DelegateContext
BaseDir string
}
@@ -81,13 +73,6 @@ func (c *TeamWorkspaceConfig) IsShared() bool {
return c != nil && c.WorkspaceScope == "shared"
}
// DelegateContext carries delegation-specific workspace overrides.
type DelegateContext struct {
LinkID string
SharedPath string
ExportPaths []string // read-only exports from delegator
}
// DefaultEnforcementLabel returns a human-readable workspace description
// for system prompt injection based on scope and sharing mode.
func DefaultEnforcementLabel(scope Scope, shared bool) string {