Skip to content

[AI-3870] Pin delegation's pinned-digest check; own SDK note for AI-3871 - #2480

Merged
kanat merged 1 commit into
feature/ai-3669-http-connectorsfrom
connectors/http-p5-small
Nov 25, 2026
Merged

kanat merged 1 commit into
feature/ai-3669-http-connectorsfrom
connectors/http-p5-small

Conversation

@kanat

@kanat kanat commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

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

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 <noreply@anthropic.com>
@github-actions github-actions Bot added the docs label Nov 25, 2026

@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

Reviewed 399e1fc merged onto bc0700e (already up to date). TestChildAgentsSuite passes on the head on a private test DB (go vet -tags integration ./internal/api/ clean). Checks on the head: labeler and GitGuardian pass; go and integration are skipped (draft), so CI runs at gh pr ready.

Mutations of internal/connectors/sensitive/sensitive.go, each run against the whole TestChildAgentsSuite, each killed only by the new test: bindingSendsOut -> SendsOutTool (R1), digest != grant.SchemaDigest -> ==, -> grant.SchemaDigest == "" (pinned-another case), -> grant.SchemaDigest != "" && digest != ... (pinned-nothing case), -> (digest == "") != (grant.SchemaDigest == ""), -> digest == "" && ..., -> err != nil || (grant.SchemaDigest == "" && digest != ""). 7 checked, 0 survived. The err != nil branch is unreachable (the digest is JSON of strings and maps) and is not a rule.

Notes: the AI-3871 paragraph in 2026-11-25-ai-3871.md is byte-identical to the one #2464 appended (line 3 of the old AI-3676 note); the AI-3676 note differs from #2344's only in the Connector sentence. sdk/SKILL.md says a later PR that settles part of a note edits that note's file, and notes/README.md asks one file per change: the move follows both. The new note's name is <date>-<ticket>.md. On the author's question: keep the sentence as it is. "Unchanged by this change, so it shows neither base_url nor the tools" stays true after AI-3871 (the sources entry never carries a URL, a path or a tool), and the pointer to the new file stops a reader of the AI-3676 note from missing the field.

One Nit (ticket, not this PR): see the inline comment.

run := s.run(CreateRunRequest{ConfigId: parent.Id, Input: "review this"})

if c.refused {
s.refusedAll(run)

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.1 refusedAll has fixed messages, so a failing refused case does not say which of the 4 refused cases (grant x layout) broke: under the SendsOutTool mutant the output is four identical the graph breaks the rule whichever child is called lines, while the run case names name+", "+layout. Wrapping the loop body in s.Run(name+", "+layout, ...) would name it. Ticket, not a blocker; map loops are the norm in this package (ConfigsSuite.TestAnHTTPToolReadsOnlyAtTheDigestItsGrantPins does the same).

@kanat
kanat marked this pull request as ready for review November 25, 2026 18:03
@kanat
kanat merged commit 73e80f2 into feature/ai-3669-http-connectors Nov 25, 2026
11 checks passed
@kanat
kanat deleted the connectors/http-p5-small branch November 25, 2026 18:04
kanat added a commit that referenced this pull request Nov 25, 2026
…runs as its own subtest (#2480 R1.1)

A failure now names its case, the refused ones too.

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