Files
goclaw/internal/tools/delegation_artifacts_linux.go
Duc Nguyenandntduc bb7712a9ff 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>
2026-07-30 14:17:40 +07:00

33 lines
720 B
Go

//go:build linux
package tools
import (
"errors"
"golang.org/x/sys/unix"
)
func (r *artifactSecureRoot) renameNoReplace(oldName, newName string) error {
oldPath, err := validateArtifactRelativePath(oldName)
if err != nil {
return err
}
newPath, err := validateArtifactRelativePath(newName)
if err != nil {
return err
}
err = unix.Renameat2(r.fd, oldPath, r.fd, newPath, unix.RENAME_NOREPLACE)
if errors.Is(err, unix.EEXIST) {
return errors.Join(ErrArtifactPublishConflict, err)
}
if errors.Is(err, unix.ENOSYS) || errors.Is(err, unix.EINVAL) {
return errors.Join(ErrArtifactSecureUnavailable, err)
}
return err
}
func isArtifactNotExist(err error) bool {
return errors.Is(err, unix.ENOENT)
}