mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-17 04:15:05 +00:00
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:
1 parent
496b7ffce6
commit
bb7712a9ff
186 files changed
+18858
-1233
No files matched your search
@@ -114,6 +114,12 @@ func (t *WriteFileTool) Execute(ctx context.Context, args map[string]any) *Resul
|
||||
if path == "" {
|
||||
return ErrorResult("path is required")
|
||||
}
|
||||
if err := rejectDelegationInputMutation(ctx, path); err != nil {
|
||||
return ErrorResult(err.Error())
|
||||
}
|
||||
if IsDelegationArtifactRun(ctx) {
|
||||
deliver = false
|
||||
}
|
||||
|
||||
// Group write permission check
|
||||
if t.permStore != nil {
|
||||
@@ -123,7 +129,7 @@ func (t *WriteFileTool) Execute(ctx context.Context, args map[string]any) *Resul
|
||||
}
|
||||
|
||||
// Virtual FS: route context files to DB
|
||||
if t.contextFileIntc != nil {
|
||||
if !IsDelegationArtifactRun(ctx) && t.contextFileIntc != nil {
|
||||
if handled, err := t.contextFileIntc.WriteFile(ctx, path, content); handled {
|
||||
if err != nil {
|
||||
return ErrorResult(fmt.Sprintf("failed to write context file: %v", err))
|
||||
@@ -133,7 +139,7 @@ func (t *WriteFileTool) Execute(ctx context.Context, args map[string]any) *Resul
|
||||
}
|
||||
|
||||
// Virtual FS: route memory files to DB
|
||||
if t.memIntc != nil {
|
||||
if !IsDelegationArtifactRun(ctx) && t.memIntc != nil {
|
||||
if mwr, err := t.memIntc.WriteFile(ctx, path, content, appendMode); mwr.Handled {
|
||||
if err != nil {
|
||||
return ErrorResult(fmt.Sprintf("failed to write memory file: %v", err))
|
||||
@@ -244,7 +250,7 @@ func (t *WriteFileTool) executeInSandbox(ctx context.Context, path, content, san
|
||||
if err != nil {
|
||||
return ErrorResult(err.Error())
|
||||
}
|
||||
containerCwd, cwdErr := sandboxCwdForHostPath(mountWorkspace, mountWorkspace, sandbox.DefaultContainerWorkdir)
|
||||
containerCwd, cwdErr := sandboxCwdForHostPath(mountWorkspace, mountWorkspace, sandboxContainerWorkdir(ctx))
|
||||
if cwdErr != nil {
|
||||
return ErrorResult(fmt.Sprintf("sandbox path mapping: %v", cwdErr))
|
||||
}
|
||||
@@ -288,7 +294,7 @@ func (t *WriteFileTool) executeInSandbox(ctx context.Context, path, content, san
|
||||
}
|
||||
|
||||
func (t *WriteFileTool) getFsBridge(ctx context.Context, sandboxKey, mountWorkspace, containerCwd string) (*sandbox.FsBridge, error) {
|
||||
sb, err := t.sandboxMgr.Get(ctx, sandboxKey, mountWorkspace, SandboxConfigFromCtx(ctx))
|
||||
sb, err := acquireToolSandbox(ctx, t.sandboxMgr, sandboxKey, mountWorkspace)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user