From 399e1fc847384bc255ca851e336444989325beae Mon Sep 17 00:00:00 2001 From: Kanat Date: Wed, 25 Nov 2026 12:57:13 -0500 Subject: [PATCH] [AI-3870] Pin delegation's pinned-digest check; own SDK note for AI-3871 A delegation judges an http tool read-only only at the digest its grant pins: rows in ChildAgentsSuite kill the bindingSendsOut -> SendsOutTool mutant. The AI-3871 SDK note moves out of the AI-3676 note into its own file. Co-Authored-By: Claude Sonnet 5.5 --- .../skills/sdk/notes/2026-11-24-ai-3676.md | 4 +- .../skills/sdk/notes/2026-11-25-ai-3871.md | 1 + .../api/child_agents_sensitive_test.go | 61 +++++++++++++++++++ 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 .claude/skills/sdk/notes/2026-11-25-ai-3871.md diff --git a/.claude/skills/sdk/notes/2026-11-24-ai-3676.md b/.claude/skills/sdk/notes/2026-11-24-ai-3676.md index a3f9cf816f..84f6c9038d 100644 --- a/.claude/skills/sdk/notes/2026-11-24-ai-3676.md +++ b/.claude/skills/sdk/notes/2026-11-24-ai-3676.md @@ -1,3 +1 @@ -`createConnector` (`POST /v1/agents/connectors`) takes an HTTP API in place of an MCP server (AI-3676). `CustomConnectorRequest` has a new optional `http`, a `CustomHTTPAPI` `{base_url, tools}`. Each tool is a `CustomHTTPTool` `{name, description, method, path, parameters, read_only}`: `method` is one of `GET`, `HEAD`, `POST`, `PUT`, `PATCH` and `DELETE`, and `parameters` maps a name to a `CustomHTTPParameter` `{type, description, required}`, whose `type` is one of `string`, `number`, `integer` and `boolean`. `endpoint` is no longer required: a request sends a non-empty `endpoint` or `http`, not both. This breaks existing callers in four SDKs. In Go, `CustomConnectorRequest.Endpoint` is now a `*string` (`sdks/go/acceleration/generated.go`), and a caller that set it as a string now sets a pointer. In Rust, `CustomConnectorRequest.endpoint` is now an `Option` (`sdks/rust/src/types.rs`), so a struct literal or a read of a `String` no longer compiles. In PHP (`sdks/php/src/Generated/CustomConnectorRequest.php`) and Python (`plugins/stream`, `_generated/models/custom_connector_request.py`), `endpoint` moves from the first constructor argument to after `schemes`, so a positional call no longer matches; named and keyword arguments still work. The `Connector` the router answers is unchanged, so it shows neither `base_url` nor the tools. Go, JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP have the regenerated clients. Other SDKs need to update: a `connectors.create` resource method, where an SDK has one, takes `http` beside `endpoint`. Swift, Kotlin and Dart need nothing, since `createConnector` is not client-accessible. - -The `Connector` the router answers now has `sources` (AI-3871), a list of `ConnectorSource` `{kind}` whose `kind` is `mcp` or `http`: a custom connector made from an `endpoint` reads `mcp`, one made from `http` reads `http`, and a built-in names its own. It never carries a URL, a path or a tool. This adds a required field to a response, so a client that builds a `Connector` itself, or compares one whole, must give it `sources`. In Go it is `[]ConnectorSource`, and the constants are `ConnectorSourceKindMCP` and `ConnectorSourceKindHTTP`. Go, JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP have the regenerated clients; Swift, Kotlin and Dart generate nothing new. Other SDKs need to update: a resource method that returns a connector (`connectors.get`, `connectors.list`), where an SDK has one, exposes `sources`, so a caller can tell an http connector from an MCP one. +`createConnector` (`POST /v1/agents/connectors`) takes an HTTP API in place of an MCP server (AI-3676). `CustomConnectorRequest` has a new optional `http`, a `CustomHTTPAPI` `{base_url, tools}`. Each tool is a `CustomHTTPTool` `{name, description, method, path, parameters, read_only}`: `method` is one of `GET`, `HEAD`, `POST`, `PUT`, `PATCH` and `DELETE`, and `parameters` maps a name to a `CustomHTTPParameter` `{type, description, required}`, whose `type` is one of `string`, `number`, `integer` and `boolean`. `endpoint` is no longer required: a request sends a non-empty `endpoint` or `http`, not both. This breaks existing callers in four SDKs. In Go, `CustomConnectorRequest.Endpoint` is now a `*string` (`sdks/go/acceleration/generated.go`), and a caller that set it as a string now sets a pointer. In Rust, `CustomConnectorRequest.endpoint` is now an `Option` (`sdks/rust/src/types.rs`), so a struct literal or a read of a `String` no longer compiles. In PHP (`sdks/php/src/Generated/CustomConnectorRequest.php`) and Python (`plugins/stream`, `_generated/models/custom_connector_request.py`), `endpoint` moves from the first constructor argument to after `schemes`, so a positional call no longer matches; named and keyword arguments still work. The `Connector` the router answers is unchanged by this change, so it shows neither `base_url` nor the tools; AI-3871 gives it `sources` (`2026-11-25-ai-3871.md`). Go, JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP have the regenerated clients. Other SDKs need to update: a `connectors.create` resource method, where an SDK has one, takes `http` beside `endpoint`. Swift, Kotlin and Dart need nothing, since `createConnector` is not client-accessible. diff --git a/.claude/skills/sdk/notes/2026-11-25-ai-3871.md b/.claude/skills/sdk/notes/2026-11-25-ai-3871.md new file mode 100644 index 0000000000..45cf7918f9 --- /dev/null +++ b/.claude/skills/sdk/notes/2026-11-25-ai-3871.md @@ -0,0 +1 @@ +The `Connector` the router answers now has `sources` (AI-3871), a list of `ConnectorSource` `{kind}` whose `kind` is `mcp` or `http`: a custom connector made from an `endpoint` reads `mcp`, one made from `http` reads `http`, and a built-in names its own. It never carries a URL, a path or a tool. This adds a required field to a response, so a client that builds a `Connector` itself, or compares one whole, must give it `sources`. In Go it is `[]ConnectorSource`, and the constants are `ConnectorSourceKindMCP` and `ConnectorSourceKindHTTP`. Go, JavaScript, Python (`plugins/stream`), .NET, Ruby, Rust and PHP have the regenerated clients; Swift, Kotlin and Dart generate nothing new. Other SDKs need to update: a resource method that returns a connector (`connectors.get`, `connectors.list`), where an SDK has one, exposes `sources`, so a caller can tell an http connector from an MCP one. diff --git a/acceleration/internal/api/child_agents_sensitive_test.go b/acceleration/internal/api/child_agents_sensitive_test.go index 2fb0d10482..6d44f37c90 100644 --- a/acceleration/internal/api/child_agents_sensitive_test.go +++ b/acceleration/internal/api/child_agents_sensitive_test.go @@ -4,10 +4,13 @@ package api import ( "encoding/json" + "maps" "net/http" "strconv" "strings" + "github.com/GetStream/Vision-Agents/acceleration/internal/connectors/core" + httpsource "github.com/GetStream/Vision-Agents/acceleration/internal/connectors/sources/http" "github.com/GetStream/Vision-Agents/acceleration/internal/harness" "github.com/GetStream/Vision-Agents/acceleration/internal/store" ) @@ -126,6 +129,44 @@ func (s *ChildAgentsSuite) TestADelegationRunsBesideASensitiveChildTheParentDoes s.Contains(run.FinalText, "tool: be brief") } +// An http tool that only reads at the latest revision reads only for a grant that pins that +// revision's digest: a session opens it at the digest its grant pins, or pins one on first use. +// Beside a sensitive connector, in the parent or in a child, a delegation so runs for the pinned +// grant and is refused for a grant that pins no digest or another one (AI-3675). +func (s *ChildAgentsSuite) TestADelegationJudgesAnHTTPToolReadOnlyOnlyAtTheDigestItsGrantPins() { + s.useInternalApp() + id, digest := s.readOnlyHTTPConnector() + for name, c := range map[string]struct { + grant store.ToolGrant + refused bool + }{ + "pinned": {store.ToolGrant{Name: "get", SchemaDigest: digest}, false}, + "pinned nothing": {store.ToolGrant{Name: "get"}, true}, + "pinned another": {store.ToolGrant{Name: "get", SchemaDigest: strings.Repeat("0", len(digest))}, true}, + } { + api := store.ConnectorBinding{Name: "api", ConnectorID: id, Connection: store.ConnectionBinding{Type: "session"}, + Tools: []store.ToolGrant{c.grant}} + nessy := store.ConnectorBinding{Name: "customers", ConnectorID: "nessy", Connection: store.ConnectionBinding{Type: "session"}, + Tools: []store.ToolGrant{{Name: "org_lookup"}}} + for layout, bindings := range map[string][2]store.ConnectorBinding{"sensitive parent": {nessy, api}, "sensitive child": {api, nessy}} { + parent := s.agentWith("fanning/fanning-model", nil) + child := s.agentWith("echo/echo-model", nil) + s.delegate(parent, map[string]AgentConfig{"ask_a": child}) + s.change(parent.Id, func(config *store.AgentConfig) { config.Connectors = []store.ConnectorBinding{bindings[0]} }) + s.change(child.Id, func(config *store.AgentConfig) { config.Connectors = []store.ConnectorBinding{bindings[1]} }) + + run := s.run(CreateRunRequest{ConfigId: parent.Id, Input: "review this"}) + + if c.refused { + s.refusedAll(run) + } else { + s.NotContains(run.FinalText, "was not run", name+", "+layout) + s.Contains(run.FinalText, "tool: be brief", name+", "+layout) + } + } + } +} + // TestADelegationWithNoSensitiveConnectorRuns is the control: on the base, dca845c2e, the // same graph answered the same (author-1.md, «Control probe»). func (s *ChildAgentsSuite) TestADelegationWithNoSensitiveConnectorRuns() { @@ -195,3 +236,23 @@ func (s *ChildAgentsSuite) refusedAll(run Run) { s.NotContains(run.FinalText, name, "the tool error names nothing of a server-side config") } } + +// readOnlyHTTPConnector is a custom connector whose latest revision has one http tool, get, a +// read-only GET, and the digest a grant pins to open it as listed there. Its manifest is +// linear.yaml's with an http source in place of its mcp one (as in ConfigsSuite). +func (s *ChildAgentsSuite) readOnlyHTTPConnector() (string, string) { + ctx := s.T().Context() + linear, err := s.store.ConnectorDefinitions.Latest(ctx, s.customerID(), "linear") + s.Require().NoError(err) + tool := core.HTTPTool{Name: "get", Description: "Reads the API.", Method: http.MethodGet, Path: "/get", ReadOnly: true} + manifest := linear.Manifest + manifest.ID = "custom_t" + strings.ReplaceAll(s.utils.uuid(), "-", "") + manifest.Endpoints = maps.Clone(manifest.Endpoints) + manifest.Endpoints[core.SourceKindHTTP] = "https://8.8.8.8/api" + manifest.Sources = []core.SourceRule{{Kind: core.SourceKindHTTP, Endpoint: core.SourceKindHTTP, HTTPTools: []core.HTTPTool{tool}}} + _, err = s.store.ConnectorDefinitions.Revise(ctx, s.customerID(), manifest) + s.Require().NoError(err) + digest, err := httpsource.ToolSchemaDigest(tool) + s.Require().NoError(err) + return manifest.ID, digest +}