Repository navigation
[AI-3871] A connector's answer names its source kind - #2464
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kanat
left a comment
There was a problem hiding this comment.
VERDICT: GO
[security R1] No findings on e9bb176.
sourcesreaches only listConnectors, getConnector and createConnector. All three are server-side only, and none isx-client-accessible. No other operation inopenapi.yamlreferencesConnectororConnectorSource. Device, guest and anonymous tokens are refused there.connectorOfcopies onlykind. AI-837 withheldsourcesbecause a source rule holds an endpoint role, headers, tool and scope rules, read-only tool names and http tools. None of those is copied.- Every stored kind is
mcporhttp: built-ins are allmcp, and custom and imported manifests are rebuilt byCustomManifestwith constant kinds. - Probed on a local test DB for every built-in a non-internal app sees, plus a custom MCP and a custom http connector, in the list, read and create answers. Each source is exactly
{kind}. No endpoint, base URL, header, tool name, path or parameter appears. Another app gets a 404, and refusal bodies do not echo the input. - Mutation: a source answering its endpoint URL is caught by the integration suite (5 ConnectorsSuite tests fail). The unit
ConnectorSourcesSuitealone does not catch it withomitempty, but the integration coverage is enough.
kanat
left a comment
There was a problem hiding this comment.
VERDICT: GO
Reviewed e9bb176 (contains the base c94d490). CI: draft, every job skipped except labeler and GitGuardian (pass); the full CI run starts at gh pr ready.
Shape against the CLI. GetStream/cli internal/agents/connectors.go:20-28 decodes sources: [{kind}] with omitempty. The router answers exactly that: always an array of {"kind":"mcp"|"http"}, built-ins included (slack reads [{kind:mcp}]; the built-in manifests carry only kind: mcp). ConnectorSourceKind follows ConnectionOwnerType's pattern with x-enum-varnames; sources is required and non-nullable in the spec.
Checked. go test ./internal/api/ and the integration suites the PR lists (Connectors, Authorizations, Connections, ConnectionProxy, ConnectorProviderApps, ConnectorEvents, DataMove, OAuthClients, Configs, Posture) pass on my own DB; go vet with and without the tag is clean; sdks/go tests pass. generated.sh reports every generated file in step; go generate in sdks/go and plugins/stream/generate.py give no diff. Rust, .NET, Ruby and PHP were not regenerated here (no toolchain); their diffs read consistent with the spec.
The four changed tests are deliberate, none is weakened: the withheld-keys test now asserts exactly [{kind: mcp}] (stricter); the two controls gain the one expected key; the "http" -> "http": change is needed because the value http now appears as a kind, and it still kills a leaked http key (mutant run).
Mutations: 16 checked, 0 survived (loop dropped, hardcoded kind, nil list, first only, reversed, enum value dropped or swapped, varnames dropped or swapped, nullable dropped, omitempty on the list and on kind, additionalProperties dropped, an http or endpoint key added to the source).
Author question (unknown kind passes through): keep it. A custom connector is rebuilt by AsCustom from its custom fields, so only mcp or http can be stored for one; built-ins are all mcp. Dropping or failing on an unknown kind would make the CLI read that connector as MCP again, the bug this PR fixes. Rust's generated enum has an Unlisted fallback. No ticket.
One Nit goes to a ticket, not this PR (inline).
| @@ -1 +1,3 @@ | |||
| `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<String>` (`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. | |||
There was a problem hiding this comment.
[Nit] R1.1 This paragraph is another change (AI-3871) appended to AI-3676's note, but notes/README.md asks for one file per change, and the first paragraph above still says "The Connector the router answers is unchanged". Move it to its own file, e.g. 2026-11-25-ai-3871.md. An SDK update picks up either (it diffs the notes tree), so this does not block.
…871 (#2480) Targets `feature/ai-3669-http-connectors`, not main. Two small leftovers of AI-3669; tests and docs only, no router code changes. ``` acceleration/internal/api/child_agents_sensitive_test.go +TestADelegationJudgesAnHTTPToolReadOnlyOnlyAtTheDigestItsGrantPins .claude/skills/sdk/notes/2026-11-24-ai-3676.md Connector sentence true again .claude/skills/sdk/notes/2026-11-25-ai-3871.md new: the AI-3871 `sources` note, moved here ``` ## 1. Delegation judges an http tool by its pinned digest `bindingSendsOut` (`sensitive.go`) calls `GrantSendsOut`, which judges an http tool at the digest its grant pins. Replacing that call with `manifest.SendsOutTool(tool.Name)` passed every ChildAgentsSuite test. The new test wires, past the API, a parent and a child with nessy (sensitive) and an http connector whose latest revision has `get`, a read-only GET: | grant | sensitive parent, http child | sensitive child, http parent | |---|---|---| | pins the digest | runs | runs | | pins none | refused | refused | | pins another digest | refused | refused | Mutants (one script, `mutate.sh`): `bindingSendsOut` -> `SendsOutTool`, `digest != grant.SchemaDigest` -> `digest == ""` and `-> digest == grant.SchemaDigest` each fail the test; the head passes. ## 2. SDK notes #2464 appended the AI-3871 part to the AI-3676 note; `notes/README.md` asks one file per change, and the AI-3676 note said the `Connector` is unchanged. The AI-3871 paragraph is now `2026-11-25-ai-3871.md` unchanged; the AI-3676 note is back as #2344 wrote it, except that its `Connector` sentence says "unchanged by this change" and points to the new note. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Feature branch for [AI-3669](https://linear.app/stream/issue/AI-3669): the router gets an `http` tool source. A file `connectors/http/<name>.yaml` names a public https base URL and read-only tools. Once synced, an agent calls those tools with a user's credential. ## What it does ``` connectors/http/<name>.yaml │ CLI sync v POST /v1/agents/connectors (http block) │ v manifest, sources/http │ agent session offers the tool v session tool call -> base_url + path, with the connection's credential ``` Safety rules. Each is checked when the connector is saved, at each call, or both: | Rule | Effect | Checked | |---|---|---| | Public https only | `base_url` goes through the egress check; private and plain-http hosts are refused | save (`CheckBaseURL`), and every call, as the connection's client is the egress client | | `read_only` GET and HEAD | other methods are refused on `read_only` tools | save. A tool whose definition changed since its grant is not offered (the grant pins a digest of method, path and `read_only`) | | Override args refused | the model cannot change the method, host or headers | save refuses a parameter or header named like a method override; a call refuses an argument the tool does not declare, before anything is sent | | Path segments escaped | `..%2Fadmin` stays one segment | every call | | Size caps | 4 MiB read from the provider, 32 KiB to the model (with a marker) | every call | | Egress limits | the same egress client and the same 4 MiB read cap as the MCP source, and #2430's import limits | every call; import | ## Pieces All merged into this branch, each reviewed on its own PR. Three commits on the branch itself follow the last main sync: the feature's caps become core's after #2430, a subtest split of #2480's test, and a test that an http custom connector meets an MCP one's limits. | Piece | Ticket | PR | Merge commit | |---|---|---|---| | Manifest model for http tools | AI-3673 | [#2303](#2303) | 7d1d6b7 | | `sources/http` tool source | AI-3674 | [#2316](#2316) | 2a29dac | | Call-time safety | AI-3675 | [#2324](#2324) | 5a798ad | | API accepts http connectors (keystone) | AI-3676 | [#2344](#2344) | aed810a | | A connector's answer names its source kind | AI-3871 | [#2464](#2464) | c72f50f | | Pin delegation's digest check; own SDK note | AI-3870 | [#2480](#2480) | 73e80f2 | | Fake provider's CodeQL alert; SDK skill names http connectors | AI-3870 | [#2483](#2483) | 469960b | Main was merged into the branch 9 times; the last is main `f58ff6eb3`. An earlier one, main `c4119ba23`, carries [#2430](#2430 import limits. Imported http connectors are held to the same limits. The merge of main `8232d25af` brings in two changes that touch http connectors: - [#2485](#2485) refuses imported agent configs that break the sensitive-connector rule. An http connector's tools are weighed by their own rule: a tool that is not read-only, or a read-only tool granted without its digest, is refused. A test covers this (`TestAnImportedHTTPConnectorAnAgentBindsBesideASensitiveOneIsWeighedByItsTools`). - [#2434](#2434) adds `check_changes` to a custom connector create. An http connector takes the same path as an MCP one, and a test covers the http case (`TestACheckedSyncOfAnHTTPConnectorIsRefusedOnlyOverAnEditNoSyncWrote`). ## Acceptance AC-1..AC-9 are frozen in the epic. The staging window was opened twice on the branch build, then staging was restored. | AC | Result | Checked | |---|---|---| | AC-1 | pass | staging windows 1 and 2 (router part). The CLI line (first sync prints the connector id) is in [GetStream/cli#128](GetStream/cli#128) | | AC-2 | pass | staging window 1 and 2 | | AC-3 | pass | staging window 1 and 2: one tool call, the agent answered from it | | AC-4 | pass | staging window 1 and 2 | | AC-5 | pass | staging window 1 and 2 | | AC-6 | pass | local router: override args refused, the fake provider saw 0 requests | | AC-7 | pass | staging, by API and by CLI | | AC-8 | pass | staging window 1 and 2: a JSON body comes back as `application/json` | | AC-9 | pass | local router: 100 KiB cut to 32768 B with a marker, 5 MiB cut at the 4 MiB read cap | Rulings by Kanat (2026-11-25): - AC-4: the "no token" clause is read as a wrong token. A wrong token gives a tool error 401. A connection with no token at all stays `not_connected` and its tool is not offered, as before. - AC-5: the CLI refuses a `read_only` POST or DELETE locally, before any request. The router refuses the same with a 400 on a direct POST. ## Gates for the merge into main | Gate | What | |---|---| | a | Done: [#2481](#2481) merged into main (`96d535d9d`), which fixed main's integration build at `scheduled_unpaid_test.go:814`. This branch builds and vets with the integration tag merged onto main `aa4c2d4d9` | | b | Full CI green once this PR leaves draft (a draft runs none of the go or integration jobs) | | c | [GetStream/cli#128](GetStream/cli#128) merges after this is deployed, then the docs leaf AI-3678 | | d | SDK releases that carry `Connector.sources` go out only after the router deploy: the generated Python and Rust clients cannot parse a connector from an older router | | e | No migration, no flag. A rollback to the previous build fails closed: an http binding is unavailable, and every http tool counts as sending out | ## Breaking change From `CHANGELOG.md` on the branch, under Unreleased, Breaking Changes: **`CustomConnectorRequest`'s endpoint is optional in the Go, Rust, PHP and Python SDKs** - Go: `CustomConnectorRequest.Endpoint` is now `*string`. Set it with a pointer (for example `Endpoint: &url`); a caller that set a plain string no longer compiles. - Rust: `CustomConnectorRequest.endpoint` is now `Option<String>`. Set it with `Some(url)`; a struct literal with a plain `String`, or a read of one, no longer compiles. - PHP: the `CustomConnectorRequest` constructor takes `$endpoint` after `$schemes`, not first. A positional call no longer matches; named arguments work as before. - Python (`plugins/stream`): the generated `CustomConnectorRequest` takes `endpoint` after `schemes`, not first. A positional call no longer matches; keyword arguments work as before. ## Rollout ``` merge this PR -> deploy to staging -> recheck AC-3 and AC-8 live -> merge cli#128 -> docs (AI-3678) -> SDK releases with Connector.sources ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Targets the feature branch
feature/ai-3669-http-connectors, notmain. Fix leaf of AI-3669 (umbrella AI-3870).Why
With http connectors stored,
GET /v1/agents/connectors[/{id}]answered aConnectorwith no source kind, so the CLI could not tell an http custom connector from an MCP one. The cli#128 review showed it:agents mcp listlists http connectors as MCP servers, andagents mcp update <http one> <mcp url>with no local file turned an http connector into an MCP one. The CLI already decodessources: [{kind}](GetStream/cliinternal/agents/connectors.go:21); this makes the router answer it.How it works
kindis the named enumConnectorSourceKind(mcp|http), withx-enum-varnamesso the Go SDK getsConnectorSourceKindMCPandConnectorSourceKindHTTPand a later enum holdingmcporhttprenames nothing (as #2344 did forCustomHTTPToolMethod).sourcesis always an array,nullable: false.Changes
Connector.sourcesbuilt frommanifest.Sourcesby kind (connectors.goconnectorOf)TestConnectorSourcesSuite(order, empty list is[], nothing but kind);TestAConnectorShowsItsSourceKindAndNoAddress(create, read, list of an http and an MCP custom connector, and slack; nobase_url,endpoint, address, path or tool name in the answer)sourcesTestAnMCPConnectorIsAnsweredAsBefore,TestABuiltInReadsAsBeforeOnARouterWithoutAPublicURL;TestWhatTheRouterReadsToConnectIsNeverShownno longer withholdssourcesbut asserts it is[{kind: mcp}]openapi.yamland the clients regeneratedplugins/stream), .NET, Ruby, Rust and PHP changed; Kotlin, Swift and Dart checked, unchanged (Connectoris not client-accessible)TestConnectorSourceKindNamesItsConstants(sdks/go/acceleration/enums_test.go).claude/skills/sdk/notes/2026-11-24-ai-3676.mdValidation
go test ./internal/api/(unit) and, on my own test DB,go test -tags integration -run 'TestConnectorsSuite|TestAuthorizationsSuite|TestConnectionsSuite|TestConnectionProxySuite|TestConnectorProviderAppsSuite|TestConnectorEventsSuite|TestDataMoveSuite|TestOAuthClientsSuite|TestConfigsSuite' ./internal/api/pass;go vetwith and without-tags integrationclean;go test ./acceleration/insdks/gopasses.TestConnectorSourcesSuite); enum value dropped, varnames dropped,nullable:"false"dropped (each killed byTestPostureSuite, the spec check; the varnames one also failsenums_test.goaftergo generate).🤖 Generated with Claude Code