Files
goclaw/internal/mcp/crud_agent_links_contract_test.go
T
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

39 lines
1.0 KiB
Go

package mcp
import (
"encoding/json"
"strings"
"testing"
"github.com/nextlevelbuilder/goclaw/internal/store"
)
func TestAgentLinkMaxConcurrentSchemaIsCompatibilityMetadata(t *testing.T) {
srv := newTestMCPServer()
var links store.AgentLinkStore
registerAgentLinkCRUDTools(srv, links)
for _, toolName := range []string{
"goclaw_agent_links_create",
"goclaw_agent_links_update",
} {
registered := srv.GetTool(toolName)
if registered == nil {
t.Fatalf("%s was not registered", toolName)
}
property, ok := registered.Tool.InputSchema.Properties["max_concurrent"]
if !ok {
t.Fatalf("%s omitted max_concurrent compatibility field", toolName)
}
encoded, err := json.Marshal(property)
if err != nil {
t.Fatalf("marshal %s max_concurrent schema: %v", toolName, err)
}
description := strings.ToLower(string(encoded))
if !strings.Contains(description, "compatibility metadata") ||
!strings.Contains(description, "not enforced") {
t.Fatalf("%s exposes a misleading max_concurrent contract: %s", toolName, encoded)
}
}
}