Skip to content

[AI-3674] HTTP connectors: sources/http tool source - #2316

Merged
kanat merged 16 commits into
feature/ai-3669-http-connectorsfrom
connectors/http-source
Nov 24, 2026
Merged

kanat merged 16 commits into
feature/ai-3669-http-connectorsfrom
connectors/http-source

Conversation

@kanat

@kanat kanat commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Leaf 2 of 4 of AI-3669 (router runs http connectors). Targets feature/ai-3669-http-connectors, not main. No connector of kind http can be stored until the API leaf (AI-3676): the API takes none yet, and POST /v1/data/import now refuses one too (importableDefinition, store/datamove.go, until AI-3676 lifts it), so nothing changes for users yet.

Why

AI-3673 (#2303) taught core to describe an http connector: a base_url and tools, each with a method, a path, scalar parameters and read_only. Nothing could list or call those tools yet. Only mcp is in Registry.ToolSources (cmd/router/main.go:556). This PR adds the http tool source. Validate and the session already find each source by its kind (sourceKinds, internal/api/connection_tools.go:785, internal/session/connector_tools.go:687).

How it works

Discover(binding)            sends nothing: the manifest is the list
  for each sources[kind=http].http_tools[]
    input schema  {type: object, properties: {p: {type, description}},
                   required: [...]}
    digest        sha256(name, description, schema, method, path, read_only)

Open(binding, grants)
  keep a tool    granted by name AND digest unchanged
  offer as       <alias>__<name>
  client         copy of binding.HTTP, Timeout >= 35 s (as mcp)

Call(name, arguments)
  ├─ unknown name / schema refuses  -> error, nothing sent
  ├─ URL    = base_url (one trailing / dropped) + path   (text join)
  ├─ {p}    -> url.PathEscape(value): one segment
  ├─ others ├─ GET, HEAD, DELETE   -> query
  │         └─ POST, PUT, PATCH    -> JSON object body ({} when none)
  │         only declared parameters; numbers as the model wrote them
  ├─ send through binding.HTTP (credential, 401 renewal, egress)
  └─ answer (read up to 4 MiB)
       ├─ 2xx        -> text (non-UTF-8 -> "not text"), cut at 32 KiB
       └─ otherwise  -> core.ToolError "The API answered <status>[: body]"
AI-3673 review requirement Done here Test
R1.3: the pinned revision decides read_only The digest covers method, path and read_only. A grant made for revision 2's read-only GET x never opens revision 1's POST x, and the reverse. TestSourceSuite/TestAGrantForAnotherRevisionOfAToolIsNeverOpened, TestTheDigestCoversEveryFieldOfTheTool
R1.4: parameter names that model APIs take ~ is no longer allowed in a parameter name. The rule is now ^[A-Za-z0-9_.-]{1,64}$, Anthropic's input_schema property-key pattern as its 400s quote it. A live probe was not possible: the provider keys we hold were refused. TestHTTPSourceSuite/TestAnHTTPSourceBreakingARuleIsRefused ("a tilde")

Changes

  • New internal/connectors/sources/http (source.go, toolset.go, AGENTS.md, CLAUDE.md), modelled on sources/mcp.
  • cmd/router/main.go registers it beside mcp.
  • core/http_tools.go: the parameter-name rule as above, and a new rule: sources[].tools (the needs_scopes rules) is refused on an http source, which reads none (leftOutGrant reads only the mcp source).

Left for AI-3675 (call-time safety), as sources/http/AGENTS.md lists: refusing an undeclared argument before sending (it is dropped today), refusing a . or .. path value, override names at Open, redirect rules beyond egress's, and redacting arguments from log lines.

Validation

Change Test that fails without it
Source contract (digest, grants, schema check, 32 KiB cut, tool error) TestHTTPSourceContract (core/contracttest.SourceContract)
GET: path parameter in the path (escaped), the others in the query, a left-out one not sent, source header and bearer on it TestAGETSendsItsPathParameterInThePathAndTheOthersInTheQuery
POST: JSON body, 2^53+1 kept exact TestAPOSTSendsItsOtherParametersAsAJSONBody
Where each of the six methods sends a parameter; {} when none TestEachMethodSendsItsParametersWhereTheRuleSays
Text join, not ResolveReference; no doubled /; no empty ? TestTheEndpointsOwnPathIsKeptAndItsTrailingSlashNotDoubled, TestNoArgumentsAtAllAreAnEmptyObject
2xx bounds (299 ok, 300 error), status and body in the tool error, error cut TestAnAnswerThatIsNotA2xxIsAToolErrorNamingItsStatus, TestAToolErrorOverTheCapIsCutWithTheMarker
4 MiB read cap, binary body, a body cut short TestABodyIsReadOnlyUpToTheCap, TestABodyThatIsNotTextReadsAsNotText, TestABodyCutShortIsAnErrorNotAnAnswer
Timeouts: toolset client >= 35 s, a longer one kept, Binding.Timeout bounds a call TestAnOpenedToolsetWaitsPastTheConnectionsClientTimeout, TestAClientWaitingLongerThanCallTimeoutKeepsItsTimeout, TestTheBindingsTimeoutBoundsACall
Registered by kind cmd/router TestConnectorRegistrySuite/TestWithConnectorsOnBothToolSourcesAreRegisteredByKind

The tests ran on the branch at the feature-branch head 7d1d6b7: go test ./internal/connectors/... ./cmd/router/ ./internal/store/, go test -race ./internal/connectors/sources/http, go vet ./... and go vet -tags integration ./.... One batched script applied 46 mutants, one per added guard, constant and digest field, and all 46 were killed. The guards no input can reach (marshal and compile errors of values the source builds itself, and a 1xx final status) are listed in the review notes.

🤖 Generated with Claude Code

kanat and others added 4 commits November 24, 2026 00:13
…perty keys (no ~)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eout)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the docs label Nov 23, 2026
kanat and others added 2 commits November 24, 2026 00:31
…ch ignores it

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ccepted it, update AGENTS.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kanat

kanat commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-review change (orchestrator decision, 15672c5): sources[].tools (the needs_scopes rules) is now refused on an http source in core validation (checkHTTPSource, core/http_tools.go), because the http source reads none and leftOutGrant reads only the mcp source. Test: TestHTTPSourceSuite/TestAnHTTPSourceBreakingARuleIsRefused (rows "needs_scopes" and "needs_scopes on a source with no tool"); it fails with the rule off. No built-in manifest or fixture of kind http sets tools.

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: NO-GO

[security R1] Reviewed head 15672c5 on the feature branch's current head. The SSRF, redirect, credential-scope, smuggling, read_only and tenant-isolation checks hold: every request goes through the connection's egress client (dial-time public-IP check, same-origin and same-method redirects only), path values are escaped as one segment, only declared parameters are sent, and the digest pins method, path and read_only. 14 mutants on the security-relevant guards, 13 killed.

  • [Should fix] S1.1 toolset.go:109, :114: a transport or egress failure's text is what the model reads and the conversation keeps (method, full URL with the model's argument values, egress/DNS/dial text), and the text differs by what egress found. Use one fixed sentence for every such failure, and keep the cause for errors.Is and the log line.
  • [Question → AI-3675] S1.2 toolset.go:121-125: a non-2xx body goes to the model unredacted, so an API that echoes the request's credential puts it in the conversation. Exchange.Redact covers only log lines.
  • [Question → AI-3675] S1.3 toolset.go:140-144: the planned ./.. refusal must judge the segments of the built path, not each value alone (empty values, segments built from two placeholders, values holding /).
  • [Nit] S1.4 core/http_tools.go:100: no test refuses a parameter name with a character outside the set; widening the regex passes every test.
  • [Question → AI-3676] S1.5: when leaf 4 stores a base_url, run egress.ValidatePublicHTTPSURL on it (core/custom.go:34 leaves that to the caller).

The fixer gets the test rows from the orchestrator.

}
response, err := t.client.Do(request)
if err != nil {
return core.Result{}, stack.Wrap(fmt.Errorf("http: %s: %w", call.Name, err))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should fix] S1.1 The model reads this error verbatim (didNotWork + err, agent/telephony.go:737), and the conversation stores it. A *url.Error here carries the method, the full URL with the model's argument values, and the egress/DNS/dial text. A private host and an unresolvable one give different text. With CGO_ENABLED=0 a DNS failure also names the cluster resolver (.claude/skills/go/errors.md «HTTP», security go.md rules 6 and 7). Fix: make Error() one fixed sentence for every transport, egress and body-read failure (for example http: <tool>: the API could not be reached). Keep the cause reachable through Unwrap for errors.Is (the existing io.ErrUnexpectedEOF and DeadlineExceeded tests) and for the dispatcher's log line. The same applies to :114.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7f2bd29: every transport, egress and body-read failure is now a *core.UnreachedError whose Error() is one sentence ("http: : the API could not be reached, or its answer did not arrive whole"). The cause stays behind Unwrap (errors.Is still finds io.ErrUnexpectedEOF and context.DeadlineExceeded) and core.LoggedMessage appends it to the log line. Tests: TestSourceSuite/TestACallThatReachesNoAPIReadsOneSentence (127.0.0.1 and a .invalid host give the same text; the log line keeps "egress"), TestSourceSuite/TestABodyCutShortIsAnErrorNotAnAnswer, TestLoggedMessageSuite/TestAnUnreachedErrorAddsWhatFailed. Reverting either wrap, the Unwrap, or the log-line append makes those tests fail.

if response.StatusCode < 200 || response.StatusCode > 299 {
message := fmt.Sprintf("The API answered %s", response.Status)
if len(body) > 0 {
message += ": " + text

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Question → AI-3675] S1.2 The API's error body reaches the model as is. If an API echoes the request's credential in its error, the credential lands in the conversation, where end users of an app-owned connection can read it. Exchange.Redact already knows the credential's strings but only redacts log lines. Proposal for the call-time safety leaf: redact model-facing tool errors with the same redaction.

path := placeholder.ReplaceAllStringFunc(tool.Path, func(match string) string {
name := match[1 : len(match)-1]
inPath[name] = true
return url.PathEscape(fmt.Sprint(arguments[name]))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Question → AI-3675] S1.3 For AI-3675's dot-segment refusal: judge the segments of the built path, not each value alone. An empty value turns an item URL into its collection URL. Two placeholders in one segment can build a dot segment together. A value holding / goes out as %2F, which some servers decode.

// should match pattern '^[a-zA-Z0-9_.-]{1,64}$'» (quoted in anthropics/claude-code issues
// 24272, 34771 and 92648; not probed live, AI-3674: the keys in .env were refused). Each of
// these characters is RFC 3986 unreserved, so a name also goes into a query as it is.
httpParameterName = regexp.MustCompile(`^[A-Za-z0-9_.-]{1,64}$`)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit] S1.4 Widening this regex (for example, allowing /) passes every test. Add a refused row for a name outside the set to the http rule table.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8050965: added a row "a slash" (a/b) to TestHTTPSourceSuite/TestAnHTTPSourceBreakingARuleIsRefused. Mutant M12 ([A-Za-z0-9_./-]) now fails that test.

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: NO-GO

Main review, round 1. I reviewed 15672c5 merged onto feature/ai-3669-http-connectors at 7d1d6b7; the merge was a no-op. CI: the PR is a draft, so go and integration were skipped; they run at gh pr ready. Locally these passed: go test ./internal/connectors/... ./cmd/router/, -race on sources/http, the unit tests of store, api and session, and go vet with and without -tags integration.

Verdict: request changes, for R1.1 (an imported http connector now runs), R1.2 (text over 4 MiB can read as "not text") and R1.3 (three mutants survive).

[Question → AI-3675] R1.6 (toolset.go:167, outside the diff hunks): a POST, PUT or PATCH body is sent again on a 307 or 308, because bytes.Reader sets GetBody. AI-3675's cross-origin redirect test should use a body method. S1.3 already covers the empty path value.

[Nit] R1.7 (source.go:162): a manifest with two http sources validates, but only the first is read (core.HTTPSource, as MCPSource does). CustomManifest builds only one, so this is unreachable today. Ticket: refuse a second http source in Validate.

Checked and sound:

  • MCP is unchanged. main.go only adds httpsource.New(). sourceKinds is untouched. The http_tools.go rules apply only under Kind == http. Mutants that drop either registry entry are killed by TestWithConnectorsOnBothToolSourcesAreRegisteredByKind.
  • The contract matches sources/mcp: the digest and the grant must both match; alias__name; arguments are checked before anything is sent; a non-2xx is a ToolError and a transport or read failure is an error; the client timeout is at least 35 s; Binding.Timeout bounds a call; ctx reaches the request.
  • Requirement 1: the digest covers method, path and read_only, and the stale-pin test holds.
  • Requirement 2: the rule equals Anthropic's pattern. internal/llm passes property keys as they are (anthropic/messages.go:784, openai/openai.go:672), so the router sends nothing looser. The live probe is still unverified.
  • Author Q2 (needs_scopes refused) is verified: its mutant is killed. Q1 is ticketed on AI-3675. Q3 is accepted, and AI-3678's docs must say a wrong key shows only on the first call.
  • Mutations: 13 checked, 3 survived (R1.3).

// The tool sources a manifest's sources[].kind may name; a new one is one more entry.
sources := map[string]core.ToolSource{}
for _, source := range []core.ToolSource{mcp.New()} {
for _, source := range []core.ToolSource{mcp.New(), httpsource.New()} {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should fix] R1.1 This makes an imported http connector run before AI-3675's call-time safety. POST /v1/data/import is open to any server-side customer (api/datamove.go:348). It stores a custom definition through importableDefinition (store/datamove.go:831, :1656), which calls Manifest.AsCustom. Since #2303, AsCustom takes an http manifest (core/custom.go:100-107). On the base, validate answered such a connection with "this deployment has no http tool source" (api/connection_tools.go:457-459), and a session could not open it. With this entry, validate runs Discover, and a session opens and calls its tools. That breaks the PR body's line "No stored connector has kind http until the API leaf (AI-3676)".

Shown by: a scratch test in package store. importableDefinition took {"id":"custom_crm","manifest":<CustomManifest, base_url https://api.example.com, DELETE /items/{id}>} and returned err=nil. I did not run import, connect, validate and call end to end.

Exposure today is none: the feature branch is not deployed, and #2312 is a draft.

Fix: importableDefinition refuses a definition that has an http source (ErrNotACustomConnector) until AI-3676 lifts the refusal, with a unit row. Or, if the orchestrator decides so: keep the import path, correct the PR body, and keep #2312 draft and undeployed until AI-3675 merges.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 15ae6e4 and 66f7535 (doc dfff182): importableDefinition refuses a definition with an http source, using ErrNotACustomConnector ("an http connector cannot be imported yet"). The check runs after AsCustom, so the custom rules still name what is wrong first, and AI-3676 lifts it. Tests: TestImportableDefinitionSuite/TestAnHTTPConnectorIsRefusedAndAnMCPOneKept (unit, with an MCP control row) and TestDataMoveSuite/TestAnImportedHTTPDefinitionIsRefused (integration, replaces the old "arrives as it was sent" row). Removing the check makes both fail. I corrected the PR body line.

return core.Result{}, stack.Wrap(fmt.Errorf("http: %s: read the answer: %w", call.Name, err))
}
text := nonText
if utf8.Valid(body) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should fix] R1.2 A valid UTF-8 body over 4 MiB reads as "not text" when the 4 MiB cut lands inside a multi-byte character. LimitReader cuts mid-rune, and utf8.Valid then refuses the whole body.

Shown by this probe row: the body is 4 MiB - 1 bytes of a followed by éééé. Head answers nonText.

Fix: when len(body) == maxResponseBytes, drop a trailing incomplete rune before utf8.Valid. Walk back over at most utf8.UTFMax bytes to the utf8.RuneStart, and cut there if !utf8.FullRune. I checked this candidate in a scratch copy: the package and the probe rows pass. Add the probe as a SourceSuite row.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0867470: the body is now read up to maxResponseBytes+1 and cut with core.CutAtRune at the cap, so valid text that the cap cuts inside a rune is still text. A body of exactly 4 MiB that ends in a broken rune still reads as not text. Test: TestSourceSuite/TestTextTheCapCutsInsideARuneIsStillText (4 MiB-1 a + éééé). Reverting the fix makes it fail.

// (mcp.maxResponseBytes, 4 MiB), which AI-3669 reuses («MCP's size caps are reused»), so an API
// that answers without end cannot exhaust the router's memory. The model reads at most
// core.MaxResultBytes of it.
const maxResponseBytes = 4 << 20

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should fix] R1.3 (1 of 2) A lower cap survives: maxResponseBytes = 1 << 20 and 4<<20 - 1 both pass the suite. TestABodyIsReadOnlyUpToTheCap pins only the upper side.

Row to add: a body of 4 MiB - 1 bytes of a followed by 0xff must read as nonText. I checked it in a scratch copy: it passes on head and fails under both mutants.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 89267d1: TestSourceSuite/TestTheLastByteUnderTheCapIsRead (4 MiB-1 a + 0xff reads as not text). It fails under both 1 << 20 and 4<<20 - 1.

if response.StatusCode < 200 || response.StatusCode > 299 {
message := fmt.Sprintf("The API answered %s", response.Status)
if len(body) > 0 {
message += ": " + text

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should fix] R1.3 (2 of 2) The mutant ": " + text → ": " + string(body) survives. A binary error body would then reach the model as raw bytes, and no test notices.

Row to add: /broken (a 500 with PNG bytes) must give ToolError.Message == "The API answered 500 Internal Server Error: " + nonText. I checked it in a scratch copy: it passes on head and fails under the mutant.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 89267d1: TestSourceSuite/TestAToolErrorWithABodyThatIsNotTextSaysItIsNotText checks that /broken gives exactly "The API answered 500 Internal Server Error: " + nonText. The raw-bytes mutant now fails it.

}
return core.Result{}, stack.Wrap(&core.ToolError{Message: core.CutResult(message)})
}
return core.Result{Parts: llm.TextParts(core.CutResult(text))}, nil

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit] R1.5 An empty 2xx gives the model an empty result: llm.TextParts("") is nil. That covers a 204 from a DELETE and every HEAD. The model cannot tell that the call worked. Ticket: answer The API answered <status> when the body is empty.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5a89c73: an empty 2xx now answers with its status line, for example "The API answered 204 No Content.". Every HEAD gets the same treatment. Test: TestSourceSuite/TestAnEmpty2xxIsItsStatus (DELETE 204, HEAD 200). With the branch off, it fails.

`sensitive: true` marks a connector that reads private data, and `sources[].outbound: false` says a source offers only tools that read, and `sources[].read_only_tools` names the ones that read on a source that also offers tools that write; left out, a tool may write and counts as sending data out. A config binding a sensitive connector is refused beside any binding granting a tool that may send out (`providers/AGENTS.md`, `sensitiveBindingsComplaint`).

A source of kind `http` (`SourceKindHTTP`, `http_tools.go`) lists its own tools in `sources[].http_tools`: each a name, a description, a method, a path under the source's endpoint with `{name}` placeholders, scalar `parameters` and `read_only`. `read_only` is allowed only on GET and HEAD, and it is where an http source says a tool only reads: `read_only_tools` and `outbound: false` are refused on one. A parameter or source header named as a method override (`X-HTTP-Method-Override`, `X-HTTP-Method`, `X-Method-Override`, `_method`, in any case) is refused, so a read-only GET cannot be run as a write. A custom connector is an MCP endpoint or an http `base_url` with tools (`CustomManifest`), under the endpoint role `http`. No source runs http tools yet.
A source of kind `http` (`SourceKindHTTP`, `http_tools.go`) lists its own tools in `sources[].http_tools`: each a name, a description, a method, a path under the source's endpoint with `{name}` placeholders, scalar `parameters` and `read_only`. `read_only` is allowed only on GET and HEAD, and it is where an http source says a tool only reads: `read_only_tools` and `outbound: false` are refused on one. A parameter or source header named as a method override (`X-HTTP-Method-Override`, `X-HTTP-Method`, `X-Method-Override`, `_method`, in any case) is refused, so a read-only GET cannot be run as a write. A custom connector is an MCP endpoint or an http `base_url` with tools (`CustomManifest`), under the endpoint role `http`. `sources/http` runs its tools.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit] R1.4 This line lists read_only_tools and outbound: false as refused on an http source. Since 15672c5, sources[].tools (needs_scopes) is refused too. Add it here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 496b8e5: the line now also names sources[].tools (needs_scopes) as refused on an http source. It also says a manifest has at most one http source, which is R1.7, refused in 415bc4f with the row "a second http source".

kanat and others added 10 commits November 24, 2026 00:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e goes to the log line (S1.1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o they still name what is wrong (R1.1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce, and one http source at most (R1.4, R1.7)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: GO

Delta round 2, head 496b8e5 on base 7d1d6b7 (unchanged, no merge needed). Draft, so CI skipped (labeler and GitGuardian pass).

Prior findings:

  • R1.1 fixed. importableDefinition refuses an http source after AsCustom, so the custom rules keep their own messages. An MCP import still works (unit row TestAnHTTPConnectorIsRefusedAndAnMCPOneKept); TestDataMoveSuite is green on the head (268 s). Mutants "refuse any custom source" and if false && are killed.
  • R1.2 fixed. Probe TestProbeTextOverTheCapCutInsideARune now reads text; a mutant that cuts at cap+1 is killed. A CutAtRune that steps back only one byte is killed by core's existing row.
  • R1.3 fixed. Rows TestTheLastByteUnderTheCapIsRead and TestAToolErrorWithABodyThatIsNotTextSaysItIsNotText pass on head and fail under the lowered cap and the raw-body mutants.
  • R1.4 fixed (doc).
  • R1.5 fixed. A mutant that prints the status code only is killed.
  • R1.7 fixed. Compare-to-first-source and if false && mutants are killed.
  • S1.1 fixed. P1 now reads the same sentence for 127.0.0.1, localhost. and an unresolvable host. A mutant that puts the cause in the model text is killed. A type assertion in place of errors.AsType, and redact before the cause, are both killed.
  • S1.4 fixed (row "a slash").
  • R1.6, S1.2, S1.3, S1.5 stay routed to AI-3675 and AI-3676. Probes P2 and P3 are unchanged, as expected.

Checked outside sources/http. LoggedMessage has two callers (api/connection_tools.go:467, session/dispatcher.go:241). MCP errors are never an UnreachedError, so the added branch finds nothing and they get the old KeepHosts plus redact path. The model text is Message only (telephony.go:737 formats with %s; stack.withStack.Error is the inner Error). The log line and the invocation row get Message: cause, through KeepHosts and redact, cut at MessageBytes. The cause text is what that line already carried before the delta, and its URLs are cut to scheme and host.

New finding, a Nit that does not block:

  • N2.1 core/provider_text.go:58: the unreached.Err != nil guard is untested (dropping it survives, and a nil Err would panic). Drop the guard or add a row with a nil Err.

Details: reviewer-2.md in the ledger dir.

text := KeepHosts(err.Error())
text := err.Error()
// What an UnreachedError hides from the model is what the line is for.
if unreached, ok := errors.AsType[*UnreachedError](err); ok && unreached.Err != nil {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit] N2.1 The unreached.Err != nil guard is not tested: dropping it passes every suite, and a nil Err would then panic. Every constructor passes a cause, so drop the guard, or add a row with a nil Err.

@kanat
kanat marked this pull request as ready for review November 24, 2026 00:11
@kanat
kanat merged commit 2a29dac into feature/ai-3669-http-connectors Nov 24, 2026
11 checks passed
@kanat
kanat deleted the connectors/http-source branch November 24, 2026 00:11
kanat added a commit that referenced this pull request Nov 24, 2026
Leaf 3 of AI-3669 (router: run HTTP connectors). Targets
`feature/ai-3669-http-connectors`, not `main`. No API change; that is
leaf 4 (AI-3676).

## Why

Values the model picks go into the URL and the body of an http tool's
request (`sources/http`, #2316). Before leaf 4 lets anyone store an http
connector, these cases must be impossible: a write through a read_only
tool, a method override, a path that names another resource, a
credential echoed into the conversation, and a write resent by a
redirect. The checklist comes from the AI-3673 and AI-3674 reviews: Q1
stale pin, R1.6, S1.2, S1.3 and R2.1.

## How it works

```
Toolset.Call(call)                                  sources/http/toolset.go
├─ an argument the tool does not declare  -> refused, nothing sent (AC-6)
├─ arguments vs input schema              -> refused, nothing sent
├─ path built segment by segment (builtPath)
│    a segment with a {name} that is "", "." or ".." -> refused (S1.3)
│    "../admin" -> "..%2Fadmin"   "..%2F" -> "..%252F"  (one segment)
├─ send through binding.HTTP (credential + egress)
│    redirect: GET/HEAD follow (same origin, egress policy)
│              POST/PUT/PATCH/DELETE -> the 3xx is the answer (R1.6)
├─ write's 301/302/303 -> result "The API answered 303 See Other; the request may have run."
├─ non-2xx -> ToolError "The API answered <status>: <body>"
│            body -> Exchange.Redact (credential, path, query) -> cut 32 KiB
└─ 2xx     -> body -> Exchange.RedactCredential (credential values only) -> cut 32 KiB
   <status> = code + http.StatusText, never the API's reason phrase

Source.Open                                         sources/http/source.go
└─ core.CheckHTTPSource(rule): Validate's http rules again
     (override names, read_only only on GET/HEAD, a description, ...) -> error, nothing offered
```

Stale pin (AI-3674 Q1). A session opens an http tool only at the digest
its grant pins, and the digest covers method, path and read_only. So
`internal/api` now judges an http tool read-only only when the grant
pins the latest revision's read-only digest (`grantSendsOut`):

```
revision 1: x = POST /x       revision 2: x = GET /x, read_only
fixed connection stays on revision 1, lists x at digest D1

                              before                after
GET .../connections/{id}/tools x read_only: true    false
config beside nessy, x@D1      201 (POST runs)      400 "api" x
config beside nessy, x by name 201                  400
config beside nessy, x@D2      201                  201 (rev 1 never opens D2)
```

An MCP tool stays judged on the latest revision's `read_only_tools`.
`TestReadOnlyIsTheConnectorsLatestRevisionsAsAConfigSaveChecks` pins
that, and it is unchanged.

## Changes

- `sources/http`: refuse undeclared arguments; judge the built path;
follow redirects only for GET and HEAD (with net/http's limit of 10 when
a client has no policy); redact tool errors with the call's Exchange
(`core.Observed`: the dispatcher's, or one of the call's own); recheck
the source at `Open`.
- `core`: `CheckHTTPSource` (the http rules of `Validate`, exported for
`Open`) and `Observed`.
- `core`: `Exchange.RedactCredential`, the credential's secret values
alone, for a 2xx answer. A scheme whose secret also holds a name says
which strings are values (`core.SecretValuer`; api_key: the key, not its
header name). Redaction takes the longest string out first, so a key
that holds its header name goes out whole.
- `core`: an http tool with no description is refused by `Validate` and
at `Open`: a session refuses such a tool (`harness.Tools.Validate`), so
the sync says so first.
- `api`: `grantSendsOut` in `bindingSendsOut` (config check) and in
`listConnectionTools` (the same class).
- `fakeprovider`: an HTTP API at `/rest` (api_key header,
`/bytes/<n>?then=<m>`, `/echo-credential` with `?status=200`, request
log), for AC-6 and AC-9.
- Docs: `sources/http/AGENTS.md`, `core/AGENTS.md`,
`fakeprovider/AGENTS.md`, `.claude/skills/connectors/SKILL.md`.

Decisions:

| Case | Decision | Reason |
| --- | --- | --- |
| empty path value (`DELETE /items/`) | refused | it names the
collection |
| `{a}{b}` = `.` + `.` | refused | it is judged as built, so it is `..`
|
| `../admin` | sent as `..%2Fadmin` | AC-6 of AI-3669 |
| `..%2F` | sent as `..%252F` | the `%` is escaped, so it is no dot
segment |
| 307/308 on a POST, PUT or PATCH | not followed, the 3xx is the answer
| net/http would resend the body to a path the manifest does not name |
| 3xx on a DELETE | not followed | a write's path is the manifest's |
| 301/302/303 on a POST, PUT, PATCH or DELETE | a result: "The API
answered <code> <text>; the request may have run." | only a 307 or 308
asks for the request again; after the others the write may have run, so
the model must not read a failure and retry (R1.2) |
| status the model reads | code + `http.StatusText` | the API's reason
phrase is its own text and may echo the credential (S1.1) |
| http tool with no description | refused at validation | a session
refuses it anyway (Q0.3) |
| GET/HEAD redirect | followed, same origin only | the egress policy,
unchanged |
| 2xx body | the credential's secret values redacted; path, query and
api_key's header name kept | an API that echoes the key in a 200 must
not put it in the conversation; an answer names its resource by its path
(Q1) and may name its own header (R1.1) |
| `/` in a path value (`../admin`) | stays escaped as one segment
(`..%2Fadmin`) | AC-6 of AI-3669; an API that decodes `%2F` before
routing is out of the router's control, and the docs leaf says so (Q2) |
| stale pin | an http tool reads only when the grant pins the latest
revision's read-only digest | side effect, accepted as fail-closed: an
http read-only tool granted by name beside a sensitive connector is
refused; the docs leaf says so (Q3) |

## Validation

| Rule | Test | Mutations killed |
| --- | --- | --- |
| undeclared argument refused |
`TestSourceSuite/TestAnArgumentTheToolDoesNotDeclareIsRefusedBeforeSending`
(7 shapes x GET/POST),
`TestAcceptanceSuite/TestAnOverrideIsRefusedBeforeSendingAndAValidCallIsOneGET`
(AC-6) | T1, T2 |
| built path |
`TestSourceSuite/TestAPathValueThatNamesAnotherResourceIsRefusedBeforeSending`
(18 rows) | T3, T6-T12 |
| Open recheck |
`TestSourceSuite/TestOpenRefusesASourceThatBreaksARuleOfValidation` |
S1, C1 |
| redirects | `TestSourceSuite/TestOnlyAReadFollowsARedirect` (a write's
301/302/303 is a result, a read's 302 with no Location stays an error),
`TestARedirectToAnotherOriginNeverCarriesTheCredential`,
`TestAClientWithNoRedirectPolicyStopsAfterTenRedirects` | S2-S9; R1.2:
rule off, rule for reads too, 307 added, 302 dropped |
| status text | `TestSourceSuite/TestAnEmpty2xxIsItsStatus` (reason
phrase echoing the token),
`TestAnAnswerThatIsNotA2xxIsAToolErrorNamingItsStatus` (own phrase,
unknown code) | each `response.Status` put back |
| description required |
`TestHTTPSourceSuite/TestAnHTTPSourceBreakingARuleIsRefused` row "no
description" | check off |
| key holding its header name |
`TestLoggedDescriptionSuite/TestASecretHoldingAnotherIsTakenOutWhole` |
sort removed |
| header name kept in a 2xx |
`TestAcceptanceSuite/TestA2xxKeepsTheKeysHeaderName` (a 403 still
redacts it) | transport back to every string, api_key values with the
header, api_key values nil, `SecretValuer` ignored |
| redaction |
`TestSourceSuite/TestAToolErrorEchoingTheCredentialIsRedacted` (also a
token the 32 KiB cut falls in),
`TestAToolErrorIsRedactedWithNoExchangeOfTheCallers`,
`TestAcceptanceSuite/TestA403EchoingTheKeyIsRedacted` | T4, T5, C2, C3 |
| logs |
`TestAcceptanceSuite/TestALogLineHoldsNoArgumentAndNoCredential` |
(KeepHosts is the base's) |
| AC-9 |
`TestAcceptanceSuite/TestAnAnswerIsReadUpTo4MiBAndReadAsAtMost32KiB` |
F5 |
| stale pin |
`TestConfigsSuite/TestAnHTTPToolReadsOnlyAtTheDigestItsGrantPins`. It
fails with `grantSendsOut` reverted: listing true, config 201 | A1-A7 |
| stale pin, in a session |
`TestSessionConnectorsSuite/TestAStalePinNeverRunsAWriteAsARead`: a
fixed connection on revision 1 (echo POST); beside nessy, echo at
revision 1's digest is refused, at revision 2's (read-only GET) accepted
and the session leaves crm out, nothing reaches the API; without nessy
the session runs the POST | grantSendsOut reverted (config 201),
Source.Open digest pin reverted (crm offered) |
| 2xx redaction |
`TestSourceSuite/TestA2xxEchoingTheCredentialIsRedactedAndKeepsItsPath`
(bearer, Authorization),
`TestAcceptanceSuite/TestA200EchoingTheKeyIsRedacted` (api_key header) |
no RedactCredential, Redact in its place (path lost), identity
redaction, no secret |
| R2.1 |
`TestLoggedMessageSuite/TestAnUnreachedErrorWithNoCauseIsItsMessage` |
C4 |
| fake API |
`TestFakeProviderSuite/TestTheHTTPAPITakesItsKeyRecordsEachRequestAndAnswersByPath`
| F1-F6 |

The mutation script applies, tests and restores each of 38 mutants. All
38 were killed. The author's notes keep the list.

Round 1 fixes (Q0.3, S1.1, S1.2, R1.1, R1.2) ran: `go vet` with and
without the `integration` tag; unit `./internal/connectors/...
./internal/api ./internal/session ./internal/store ./internal/harness
./cmd/router`; `-race` on `sources/http`, `core`, `schemes`; integration
`TestConfigsSuite|TestConnectionToolsSuite|TestSessionConnectorsSuite|TestSessionToolsSuite`
in `./internal/api` (455 passed) and `TestDataMoveSuite` in
`./internal/store`.

The author ran:
- `go test ./internal/connectors/... ./cmd/router ./internal/api
./internal/session` (unit)
- `go test -race ./internal/connectors/sources/http
./internal/connectors/fakeprovider`
- `go test -tags integration -run
'TestConfigsSuite|TestConnectionToolsSuite|TestSyncSuite|TestSessionConnectorsSuite|TestSessionToolsSuite'
./internal/api` on its own database (539 tests)
- `go vet` with and without the `integration` tag

All passed. The full integration run is not done.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
kanat added a commit that referenced this pull request Nov 25, 2026
Targets the feature branch `feature/ai-3669-http-connectors`, not
`main`. Leaf 4 of 4 in the router for AI-3669 (the keystone): until it
merges, no API stores an http connector.

## Why

The CLI writes `connectors/http/<name>.yaml` (base_url + tools), and the
router can run such tools since leaves 1-3 (#2316 manifest, #2324
call-time safety). `POST /v1/agents/connectors` took only an MCP
`endpoint`, and AI-3674 made `POST /v1/data/import` refuse an http
connector until this leaf. The AI-3674 reviews asked for two things:
`base_url` is checked with `egress.ValidatePublicHTTPSURL` on create and
on every new revision (S1.5), and import and create open at the same
time with the same checks (R1.1).

## How it works

```
POST /v1/agents/connectors  (CustomConnectorRequest)
├─ endpoint set == http set (both, or neither) -> 400 "exactly one of them"
├─ scheme not on this deployment              -> 400 (as before)
├─ http set
│  ├─ core.CheckBaseURL(base_url) fails: over 2048, not https://,
│  │  a {name}, or egress.ValidatePublicHTTPSURL refuses
│  │     -> 400 "base_url must be a public https URL
│  │             without userinfo, query or fragment"   (AC-7, one answer)
│  ├─ core.CustomManifest(base_url, tools) refuses
│  │     -> 400 core's reason, naming the tool          (AC-5)
│  └─ ok -> store revision (the same path as MCP)
└─ endpoint set: exactly as before                     (control test)

POST /v1/data/import  (importableDefinition)
├─ http source -> core.CheckBaseURL before AsCustom, the same message
│                 (AI-3674's refusal is gone)
└─ a change set: every definition checked before applyChanges'
   transaction opens, so no DNS lookup runs inside it

GET /v1/agents/connectors[/{id}]  (connectorOf, unchanged)
└─ copies fields by name: no base_url, no tools          (AC-1)
```

The request shape:

```
CustomConnectorRequest
├─ endpoint   string, now optional      MCP server
└─ http       CustomHTTPAPI, new        HTTP API
   ├─ base_url   string <= 2048
   └─ tools[]    CustomHTTPTool, 1 to 128
      ├─ name ^[A-Za-z0-9_-]{1,63}$, description <= 1000, path <= 2048
      ├─ method      GET|HEAD|POST|PUT|PATCH|DELETE
      ├─ read_only   only with GET or HEAD
      └─ parameters  {name: CustomHTTPParameter}, up to 64
                       type  string|number|integer|boolean
                       description <= 1000, required
```

The base_url is checked before the manifest's rules, so `http://...`, a
`{name}` in it or one over 2048 gets the fixed message too (core would
answer it in its own words), on create and on import alike. The schema
carries core's caps and tool name pattern, and core holds them as well
(a parameter's description and the base_url included), so an import,
which has no request schema, stores nothing the API would refuse.
Egress's own error never reaches the caller on create or import: it
tells a name that does not resolve from a private one.

## Changes

- `internal/api/connectors.go`: `http` beside `endpoint` on
`CustomConnectorRequest` (new `CustomHTTPAPI`, `CustomHTTPTool`,
`CustomHTTPParameter`, each refusing unknown fields); `customManifest`
checks exactly-one and the base_url, then builds through
`core.CustomManifest`. `createConnector` is untouched, so #2302
(`ReviseSynced`) merges beside it.
- `internal/connectors/core`: `CheckBaseURL`, the one base_url check
create and import share; `Manifest.Validate` caps a parameter's
description (1000) and the http endpoint (2048).
- `internal/store/datamove.go`: `importableDefinition` takes `ctx` and
checks an http connector's base_url in place of AI-3674's refusal;
`importableRow` checks a definition before `importRow`, and
`applyChanges` runs it for the whole change set before its transaction.
- The new enums name their constants (`x-enum-varnames`), so the Go SDK
keeps `Array`, `Boolean`, `Null`, `Number`, `Object` and `String`;
`sdks/go/acceleration/enums_test.go` pins them.
- `api/openapi.yaml` and the Go, JS, Python, .NET, Ruby, Rust and PHP
clients regenerated; Kotlin, Swift and Dart generate nothing new
(`createConnector` is not client-accessible).
- SDK note `.claude/skills/sdk/notes/2026-11-24-ai-3676.md`;
`connectors` and `add-connector` skills name `http`;
`sources/http/AGENTS.md` says who stores an http connector now.

## Validation

| Rule | Test |
| --- | --- |
| AC-1: stored at revision 1 as the source's manifest; no answer shows
base_url or tools |
`ConnectorsSuite/TestACustomHTTPConnectorIsStoredAndItsAPIIsNeverShown`
|
| AC-2: a none connection validates connected; tools list says read_only
| `ConnectorsSuite/TestAConnectionToAnHTTPConnectorListsItsReadOnlyTool`
|
| AC-5: read_only POST / DELETE -> 400 naming the tool, nothing stored |
`ConnectorsSuite/TestAReadOnlyToolThatWritesIsRefusedNamingIt` |
| AC-7 + S1.5: 127.0.0.1, 10.0.0.1, 169.254.169.254, http://, ::1,
.invalid, query, userinfo, fragment -> one message, nothing stored |
`ConnectorsSuite/TestAnHTTPConnectorWhoseAPIIsNotPublicHTTPSIsRefused` |
| A new revision is checked again; a refused one leaves revision 1 |
`ConnectorsSuite/TestANewRevisionOfAnHTTPConnectorIsCheckedAgain` |
| Both / neither / empty endpoint -> 400 |
`ConnectorsSuite/TestAConnectorWithBothOrNeitherOfEndpointAndHTTPIsRefused`
|
| Schema edges (method/type enums, lowercase method, unknown fields,
base_url > 2048, null tools, no base_url, no type, no tool, 129 tools,
bad name, description / path / parameter description over cap, 65
parameters) -> `validation_failed` |
`ConnectorsSuite/TestAnHTTPToolTheSchemaRefusesIsAValidationFailure` |
| Core's reasons through the API (oauth2_code, `_method`) |
`ConnectorsSuite/TestAnHTTPConnectorTheManifestRefusesIsRefusedWithItsReason`
|
| Control: MCP create and its refusals answer as on 5a798ad (keys,
values, messages from a probe run there) |
`ConnectorsSuite/TestAnMCPConnectorIsAnsweredAsBefore` (passes on base
and head) |
| Core caps: a parameter description over 1000, a base_url over 2048 |
`HTTPSourceSuite/TestAnHTTPSourceBreakingARuleIsRefused`,
`ImportableDefinitionSuite/TestAnOversizedHTTPConnectorIsRefused` |
| A change set's definitions are checked before its transaction opens |
`store
DataMoveSuite/TestAChangesDefinitionsAreCheckedBeforeItsTransactionOpens`
|
| Go SDK constant names kept | `sdks/go/acceleration`
`TestInvocationArgumentTypeKeepsItsConstantNames`,
`TestCustomHTTPToolMethodNamesItsConstants` |
| Import: http kept, MCP kept; private / .invalid / http:// / {name}
base_url refused with the fixed message | `ImportableDefinitionSuite`,
`store DataMoveSuite/TestAnImportedHTTP*`, `api
DataMoveSuite/TestAnImportedHTTPConnectorIsCheckedAsTheAPIChecksIt` |

The AC tests fail on the base (run there with this branch's test file),
except the schema test, which the base also passes by refusing `http` as
an unknown field. Each changed condition, field copy and schema tag was
mutated; the list is in the author log.

## Open points

- An imported MCP definition's endpoint gets no public-address check (as
on the base); the MCP source's egress client still checks each address
it dials.
- Breaking for SDK callers (CHANGELOG Breaking Changes): Go
`CustomConnectorRequest.Endpoint` is `*string`, Rust's `endpoint` is
`Option<String>`, and PHP's and Python's constructors take `endpoint`
after `schemes`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
kanat added a commit that referenced this pull request Nov 26, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant