Skip to content

fix(connectors)!: refuse a non-3.x OpenAPI document at load; mcp tools/list follows nextCursor and a 401/403 is a fatal configuration fault - #26798

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-26709-connector-load-faults
Oct 27, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-26709-connector-load-faults

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Refs #26709 (items 2, 3a, 3b)

This PR carries items 2, 3(a) and 3(b) of the card's Work section. Items 1 (declarative include), 3(c) (toolsSnapshotSha256) and 4 (the offline normalization tool) stay on the card: items 1 and 3(c) each add a providerConfig key, which triage's grade sends back to triage before it is built, and item 4 has no home yet.

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: updated here — content/docs/automation/connectors.mdx (no page under skills/ teaches the openapi or mcp provider: git grep -i "swagger|tools/list|provider: 'openapi'|provider: 'mcp'" -- skills returns 0 hits)

维护者速读

  • 改了什么:声明式 openapi 连接器加载时拒收非 OpenAPI 3.x 文档(含 Swagger 2.0);mcp 连接器的 tools/list 现在跟着 nextCursor 翻完所有页(上限 100 页);MCP 服务器对凭据回 401/403 时,实例直接判为配置错误,启动失败、不再重试。
  • 为什么改:目录调研显示 APIs.guru 里约 40% 是 Swagger 2.0,今天它们会"加载成功"但动作是错的、没有任何报错;分页的 MCP 服务器第一页之后的工具全部静默丢失;401 被当成"上游不可用"反复重试,掩盖了凭据配错。
  • 风险与回滚:属于收窄(BREAKING):原本靠 Swagger 2.0 文档或错误凭据"降级启动"的实例,现在会在启动时报错。回滚即 revert 本 PR;两包各一个 changeset,互相独立。
  • 先看:packages/connectors/connector-mcp/src/mcp-provider.ts(401/403 判定与 catch 分支,风险最高)、packages/connectors/connector-mcp/src/mcp-connector.ts(翻页循环与上限)、packages/connectors/connector-openapi/src/openapi-provider.ts(assertOpenApi3Document)。
  • 两分钟验证:pnpm --filter @objectstack/connector-mcp exec vitest run src/mcp-http-discovery-faults.test.ts,预期 5 个用例全绿(真 HTTP MCP 服务器:两页工具全部发现;401 一次请求即失败、启动报错、不重试)。
  • 需要你做的:无,席位落地。

What changes

  • connector-openapi — only OpenAPI 3.x loads (item 2). loadOpenApiDocument now passes every providerConfig.spec form (inline object, http(s) URL, package-relative file) through assertOpenApi3Document: an openapi field that is absent or not 3.x (a swagger: "2.0" document included) throws a plain error, the provider's existing fatal path (fatal at boot, a skipped entry on reload; never the upstream-unavailable marker). The message names the source (file './x.json', URL '…' or (the inline document)), what was found (a Swagger "2.0" document, a document with no 'openapi' version field, a document declaring openapi: "4.0.0") and the remedy: convert to OpenAPI 3.x offline. Nothing is converted at runtime, and the instance never comes up half-mapped. 3.0 and 3.1 load as before.
  • connector-mcp — tools/list pagination (item 3a). The SDK-backed client's listTools() follows nextCursor until the server stops sending one, so every tool on every page becomes an action and is offered to providerConfig.include. Bound: MCP_TOOLS_LIST_MAX_PAGES = 100. If the server is still answering a nextCursor after 100 pages, discovery throws MCP server still returned a tools/list nextCursor after 100 pages (N tools so far); refusing to build the connector from a truncated tool list. A truncated list is never used. On a declarative instance, that failure is classified like any other failed discovery: the instance degrades with that reason and is retried (see open question 1). McpClientLike.listTools() is now documented as returning every page.
  • connector-mcp — a rejected credential is a configuration fault (item 3b). In the provider's catch, credentialRejectionStatus looks for an HTTP 401/403 on connect, handshake or tools/list. It recognises the MCP SDK's own transport errors (StreamableHTTPError with code 401/403, or UnauthorizedError) anywhere in the cause chain; the SDK is imported lazily, only on this failure path. A match throws plain: connector-mcp provider: connector 'NAME' was refused by its MCP server (HTTP 401): … This is a configuration fault and is not retried — fix the credential and reload. A JSON-RPC McpError that merely carries code 401 is not a match, and every other connect or discovery failure keeps ConnectorUpstreamUnavailableError. The comment that recorded today's opposite choice ("A credential the server rejects also lands here …") now states the new rule and its reason: retrying cannot make a credential valid, a degraded instance retried with backoff reads as "server down", and credential-protected remote servers are the common case. The comment cites ADR-0097's configuration/operational split and the openapi provider's matching treatment of a 401 on its spec fetch.
  • Docs. content/docs/automation/connectors.mdx states the 3.x-only rule, the pagination bound and the 401/403 classification.
  • Changesets. One per package (26709-openapi-refuse-swagger2.md, 26709-mcp-tools-list-pages-fatal-401.md), minor (kind narrowed), each with both declaration lines and an ADR-0087 not-required (no-migration-prescription) disposition.

Landing: packages/connectors/connector-openapi/src/** and packages/connectors/connector-mcp/src/** (the claimed file surface), plus the two changesets and the connectors docs page. Nothing under packages/spec/**.

Tests

  • connector-openapi/src/openapi-provider.test.ts, new block "refuses a document that is not OpenAPI 3.x": a Swagger 2.0 file-path spec, a Swagger 2.0 URL spec and an inline Swagger 2.0 document are each refused. Each refusal is asserted to be an Error that is NOT upstream-unavailable, and its message is asserted to name the file or URL and Convert the document to OpenAPI 3.x offline. A document with no openapi field and one declaring 4.0.0 are refused the same way. Control: 3.0.3, 3.1.0 and 3.1 load.
  • connector-mcp/src/mcp-http-discovery-faults.test.ts (new): a dependency-free Streamable-HTTP MCP server on an ephemeral localhost port, reached through the real SDK client (no injected client):
    • two-page tools/list: actions are alpha, beta, gamma, and the server saw the cursors [undefined, 'page-2'];
    • a server that never stops paging: discovery rejects with the bound message after exactly 100 tools/list calls;
    • HTTP 401 and 403: the provider's error is plain (NOT upstream-unavailable), its message names the status and is not retried, and the server received exactly one request;
    • a declarative instance booted through AutomationServicePlugin + ConnectorMcpPlugin against a 401 server: kernel.bootstrap() rejects with the refusal, no degraded reason is recorded, and after 300 ms the server has still seen one request (no retry loop).
  • connector-mcp/src/mcp-provider.test.ts, new block "a rejected credential is a configuration fault" (injected clients throwing the SDK's real error classes): 401/403 on connect, 401 on tools/list (client closed), UnauthorizedError, a 403 nested in cause. Controls: StreamableHTTPError(503) and McpError(401) stay upstream-unavailable.

Acceptance notes

  • ADR-0097 wording. ADR-0097 §"Upstream availability" says "The mcp provider classifies connect / tools/list failures as unavailable". This PR narrows that sentence to "except a rejected credential (401/403), which is a configuration fault", which is consistent with the ADR's own split: an unresolvable credentialRef is already fatal there, and so is the openapi provider's 401 on its spec fetch. docs/adr/** is outside this card's file surface and is a governed surface, so the ADR is not edited here. A one-line amendment is owed; this is recorded in the dev report for the seat.
  • The version gate sits in the declarative provider's loadOpenApiDocument, as the card names. The programmatic createOpenApiConnector still trusts its caller's document, as ADR-0023 states ("The caller is responsible for loading and de-referencing ($ref) the doc").
  • MCP_TOOLS_LIST_MAX_PAGES is a module export of mcp-connector.ts only (the tests read it). It is not re-exported from the package entry, so the package's public surface is unchanged.

Verification

All runs are on head 2177e83a (worktree objectstack-issue-26709, base a485b5a3). origin/main has since moved to 4f05de4b with 4 commits, none touching packages/connectors, packages/services/service-automation or packages/spec/src/integration.

Package tests and typecheck
pnpm --filter @objectstack/connector-openapi --filter @objectstack/connector-mcp test   (under os-verify-lock)
connector-mcp      Test Files  5 passed (5)   Tests  46 passed (46)
connector-openapi  Test Files  4 passed (4)   Tests  41 passed (41)
pnpm --filter … typecheck
connector-openapi  check:test-typecheck: OK — 1 file(s) / 5 error(s) / 1 pinned signature(s) held in test-typecheck-debt.json
connector-mcp      check:test-typecheck: OK — 1 file(s) / 5 error(s) / 1 pinned signature(s) held in test-typecheck-debt.json
os-verify-lock: VERDICT command-exit 0
pnpm exec eslint (the 6 changed .ts files)   exit 0, no output
Ablations (each put the forbidden behaviour back, saw red, restored; node scripts/ablation-replace.mjs, restore proven by blob == HEAD and empty git diff HEAD)
A1 openapi version gate → `if (true) {`
   × refuses a Swagger 2.0 file-path spec, naming the file and the offline conversion
   × refuses a Swagger 2.0 document fetched from a URL, naming the URL
   × refuses an inline Swagger 2.0 document
   × refuses a document with no openapi field, and one declaring a version other than 3.x
   AssertionError: expected 'createOpenApiConnector: no base URL —…' to contain 'connector \'pets\' providerConfig.spe…'
   Tests  4 failed | 25 passed (29) — restored: blob 7ea7cdd1a149 == HEAD
A2 pagination → `return tools; /* ABLATION: first page only */`
   (first attempt used the replacement `return tools;`, which already occurred in the file;
    the tool refused it as a no-op before running anything — rerun with a distinct marker)
   × follows nextCursor until exhausted: every tool on every page becomes an action
     AssertionError: expected [ 'alpha', 'beta' ] to deeply equal [ 'alpha', 'beta', 'gamma' ]
   × fails discovery loudly when the server still pages after 100 pages — never a truncated list
   restored: blob 7bbe1e189ea3 == HEAD
A3 page bound → `return tools; /* ABLATION: silent truncation */` before the throw
   × fails discovery loudly when the server still pages after 100 pages — never a truncated list
     AssertionError: promise resolved "{ def: { name: 'endless', …(8) }, …(2) }" instead of rejecting
   Tests  1 failed | 4 passed (5) — restored: blob 7bbe1e189ea3 == HEAD
A4 credential rejection → `if (false) {`
   × HTTP 401 / 403 on connect / handshake throws plain, naming the status
   × HTTP 401 on tools/list throws plain too, and closes the client
   × the SDK's UnauthorizedError, or a 401 in the cause chain, is the same fault
   × an HTTP 401 / 403 on the handshake is a plain configuration fault (not upstream-unavailable), sent once
   × a declarative instance answered 401 fails the boot instead of degrading into a retry loop
     AssertionError: promise resolved "undefined" instead of rejecting
   Tests  7 failed | 22 passed (29) — restored: blob 8d083b85c368 == HEAD

The tests import src/ directly (relative imports, no package exports hop), so no rebuild was needed for an ablation to reach the code under test.

Derived gates (node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack)
87 command(s) derived; 84 exit 0; 3 exit 3 (PREREQUISITE NOT MET, nothing measured):
  node scripts/check-plugin-teardown-shape.mjs --self-test   needs `git fetch --unshallow` (checker-health self-test)
  pnpm --filter @objectstack/spec run check:skill-examples   reads packages/client-react/dist, not built here
  pnpm check:dual-build-cjs-loads                            reads every package's dist/, not built here (Build Core owns it)
--ran reconciliation: 87 derived famil(ies) accounted for — 84 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3)

All other families (artifact rosters, wide-population, CI-only jobs, type-check lanes) are CI's: see this PR's check-runs.

Dogfood battery (Clause-② carries the (narrowing) arm)
head 2177e83a · pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test (no OS_TEST_SHARD, no path)
os-verify-lock: VERDICT command-exit 0 · held the lock 1412s
Test Files  302 passed | 3 skipped (305)
Tests  2505 passed | 20 skipped (2525)
no failures

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (no packages/spec change)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; eslint on the changed files passes (repo-wide pnpm lint is CI's).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

Dev seat: os-dev cloud session session_01QSeKYmG4MEJUzuz837U8Uq, dispatched by domain:server#3 (session_01QSeKYmQXM3rHJcPnrEPk4B).

🤖 Generated with Claude Code


Generated by Claude Code

…load

A Swagger 2.0 document loaded without any version check: host/basePath
were ignored and body/formData parameters dropped, so the instance came
up with wrong actions and no error. loadOpenApiDocument now checks the
openapi field on every spec form (inline, URL, file) and throws a plain
configuration fault naming the source and the offline conversion.

Claude-Session: https://claude.ai/code/session_01QSeKYmG4MEJUzuz837U8Uq
Co-authored-by: Claude <noreply@anthropic.com>
…al is a fatal configuration fault

tools/list was called once with no cursor, so a paginating server lost
every tool past its first page. The SDK-backed client now follows
nextCursor until exhausted, bounded at 100 pages; a server still paging
past the bound fails discovery loudly instead of yielding a truncated
tool list.

An HTTP 401/403 during connect, handshake or tools/list was wrapped as
ConnectorUpstreamUnavailableError and retried as "server down". The
provider now tells it apart by the SDK's own HTTP-transport error and
throws it plain: a configuration fault, fatal at boot, never retried.

Claude-Session: https://claude.ai/code/session_01QSeKYmG4MEJUzuz837U8Uq
Co-authored-by: Claude <noreply@anthropic.com>
…tools/list paging and fatal 401

Claude-Session: https://claude.ai/code/session_01QSeKYmG4MEJUzuz837U8Uq
Co-authored-by: Claude <noreply@anthropic.com>
…'s configuration/operational split

Claude-Session: https://claude.ai/code/session_01QSeKYmG4MEJUzuz837U8Uq
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

8 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 55 of 207 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 2 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 665059b6056c4caf54e631d678203d8c9dc4aba3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 2047e2e3d102dc9b15490dd0b7299e05c16d4920 — the merge of head 2177e83aa4d555a287a78a78696c8b9717198e8c into base 665059b6056c4caf54e631d678203d8c9dc4aba3, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 2047e2e3d102dc9b15490dd0b7299e05c16d4920 && git checkout 2047e2e3d102dc9b15490dd0b7299e05c16d4920
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 665059b6056c4caf54e631d678203d8c9dc4aba3 2177e83aa4d555a287a78a78696c8b9717198e8c && git checkout -B drift-repro 665059b6056c4caf54e631d678203d8c9dc4aba3 && git merge --no-ff 2177e83aa4d555a287a78a78696c8b9717198e8c

node scripts/docs-audit/affected-docs.mjs --json 665059b6056c4caf54e631d678203d8c9dc4aba3

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 2177e83aa4d555a287a78a78696c8b9717198e8c
Local-runs: none
Scope: packages/connectors/connector-mcp/src/mcp-connector.ts, packages/connectors/connector-mcp/src/mcp-provider.ts, packages/connectors/connector-mcp/src/mcp-provider.test.ts, packages/connectors/connector-mcp/src/mcp-http-discovery-faults.test.ts, packages/connectors/connector-openapi/src/openapi-provider.ts, packages/connectors/connector-openapi/src/openapi-provider.test.ts + docs/adr/0097-declarative-connector-instances.md (the upstream-availability, stdio-policy and scope-boundary sections), docs/adr/0024-mcp-connectors.md (sections 2 and 3), docs/adr/0023-openapi-to-connector-generator.md, packages/services/service-automation/src/plugin.ts (the materializer's catch and the degraded-retry backoff), packages/connectors/connector-mcp/src/index.ts, packages/connectors/connector-mcp/package.json, packages/connectors/connector-openapi/src/index.ts, packages/connectors/connector-openapi/src/connector-openapi-plugin.ts, examples/app-showcase/src/system/connectors/status-openapi.json, pnpm-lock.yaml (the MCP SDK pin) and the pinned SDK's client/streamableHttp.js, client/auth.js, client/index.js and shared/protocol.js. The two changesets and content/docs/automation/connectors.mdx were read for section ②, not reviewed.

Inputs: card #26709 (body and all four comments, the os-dev-report included); PR #26798 (body, nine-file list, the net diff against main from the merge base a485b5a); the check-runs on this head. Every required context is success — Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard; Lint UI, Type Check UI, Test UI and Build & E2E UI skipped on the path filter — and so are Check Changeset, PR-body guards, Dogfood Regression Gate and Spec property liveness; the two opt-in harnesses skipped. Since the base, main moved on packages/services/service-automation by one unrelated flow-screen commit and not on either connector package, the three ADRs or the docs page.

① Derived judgments

  1. openapi provider — the document accept-set narrows at load: RIGHT. loadOpenApiDocument routes all three providerConfig.spec forms (inline object; http(s) URL after a 2xx and a successful parse; package file after a successful read and parse) through assertOpenApi3Document, which passes only a string openapi matching 3.N or 3.N.M. A swagger: "2.0" document, a document with no openapi field and openapi: "4.0.0" each throw a plain Error — never ConnectorUpstreamUnavailableError — so the materializer's existing split makes them fatal at boot and a logged, skipped entry on reload. The fault order is unchanged: an unreachable URL and 408/429/5xx still degrade; a non-retryable 4xx and an unparseable body still throw plain before the version check runs.
  2. mcp provider — the materialization accept-set narrows on a rejected credential: RIGHT. In the catch around createMcpConnector, an error whose cause chain (walked eight deep) holds a StreamableHTTPError with code 401 or 403, or an UnauthorizedError, is rethrown plain with the status; everything else keeps ConnectorUpstreamUnavailableError, and a JSON-RPC McpError carrying 401 is not matched (pinned as a control). Verified against the pinned SDK (pnpm-lock: @modelcontextprotocol/sdk@1.32.1): with no auth provider — this provider never wires one — send() throws StreamableHTTPError(response.status, …) for every non-ok POST, 401 and 403 included; Protocol.request rejects with that error unwrapped; Client.connect rethrows it after closing. So a 401 on the initialize POST, on the handshake or on tools/list reaches this catch as exactly the class tested for. UnauthorizedError is thrown only when an auth provider is wired, so that limb is unreachable on the default client today and correct for a future one.
  3. mcp default client — listTools returns every page: RIGHT. Page 0 sends no cursor, later pages send the server's nextCursor, an absent or empty cursor ends the walk, and a cursor still present after 100 pages throws a plain Error naming the bound and the count. createMcpConnector closes the client when listTools throws, so the bound leaks no connection. On a declarative instance the provider classifies that throw as unavailable (degraded, retried with backoff) — see ③.
  4. Public surface — unchanged: RIGHT. MCP_TOOLS_LIST_MAX_PAGES is exported from mcp-connector.ts for the tests and absent from src/index.ts; the package exports map carries . only, so no consumer reaches it. McpClientLike.listTools gains a documented obligation (every page) with no signature change. Nothing under packages/spec moves; ConnectorUpstreamUnavailableError and isConnectorUpstreamUnavailable are untouched.
  5. The one live declarative openapi instance in the tree — unaffected: RIGHT. The showcase's status-openapi.json declares openapi: "3.0.3", so the showcase boots as before; the Dogfood Regression Gate on this head agrees.

② Semver level

Two changesets — @objectstack/connector-openapi: minor and @objectstack/connector-mcp: minor — each carrying Clause-②: no (narrowing) and Metadata-protocol: narrowed, matching the PR body's two lines and the claim's. The level follows the kind: a non-none kind takes at least minor on the package the diff moves, and each diff moves only its own package. narrowed is right on connector-openapi: a value an author points spec at (a 2.0 document) is now refused. On connector-mcp nothing an author writes is newly refused; what narrows is the instance's accepted state at materialization (a server-rejected credential went from degraded to refused) — a requirement tightened, and the semantic reading lands on the same minor, so the level stands under either. Both carry the BREAKING banner, say what an upgrader sees and the remedy, and declare adr-0087: not-required (no-migration-prescription) — honest: no spec key is added, removed or reshaped, objectstack migrate meta has nothing to rewrite and there is no tombstone to mint; the remedy is to the external document or to the credential, outside the metadata. Check Changeset is green on this head.

③ Boundary flags

Dev-report deviations: (1) the shared checkout was moved to a detached HEAD inside the dev's own cloud container so the platform branch could be checked out in a worktree — no other seat shares that container, and all six commits on the branch are that session's; no effect on the reviewed tree. (2) The commits carry the model-free session and co-author trailer pair and no model identifier — verified on all six. (3) Ablations ran against src/, consistent with the tests' relative imports — nothing to answer.

open_questions[0] — a server still paging past the 100-page bound on a declarative instance; shipped A (degraded and retried): ANSWERED, A holds. The mcp provider already classifies every post-connect content fault as operational (a malformed tools/list answer lands in the same catch), the degraded reason surfaces the provider's message with the bound, and a retry costs at most 100 requests per attempt under the 5 s doubling to 5 min backoff. No config key can fix an over-paginating server, so a fatal classification would take a whole boot down for one upstream's behaviour.

open_questions[1] — ADR-0097's sentence "The mcp provider classifies connect / tools/list failures as unavailable": ESCALATED to the owning seat. A one-line amendment to that sentence (a 401/403 is a configuration fault) is owed under Prime Directive 13 and lives on a Tier H surface, so it lands by the maintainer's hand in its own PR, never in this one. Should-fix on the ADR, not a defect in this tree: the code applies the ADR's own configuration/operational split (an unresolvable credentialRef is fatal there, and so is the openapi provider's 401 on its spec fetch), the change is declared in the PR body, both changesets and the code comment, and the card that ordered it is maintainer-directed.

out_of_scope_findings: the programmatic createOpenApiConnector and the hand-wired ConnectorOpenApiPlugin({ document }) path still trust their caller's document — as ADR-0023 states and as the card's item 2 names (loadOpenApiDocument). No action. Triage's p1 condition (a new providerConfig key returns to triage first) is honoured: items 1 and 3(c) are held back, the PR says Refs, not Fixes, and the card stays open with those items and item 4.

Noted for the seat, not a finding on this PR: a non-retryable 400/404/410 on the MCP endpoint still degrades and retries, asymmetric with the openapi spec fetch's treatment of the same statuses; the card asks for 401/403 only.

④ Design judgment

packages/connectors/connector-openapi/src/openapi-provider.ts — HOLDS. Tried to break it with: a numeric openapi: 3 (refused, reported as declaring 3 — the specification requires a string); a 3.0.0-rc suffix (refused; not a published shape); a document carrying both swagger and a 3.x openapi (loads as 3.x, the governing field); an inline document, which did no boot I/O before and does none now. The refusal names the source, what was found and the offline conversion, and carries no tracker number. The version check runs after every existing fault branch, so the retry/fatal split for URL specs is exactly what ADR-0097 records.

packages/connectors/connector-openapi/src/openapi-provider.test.ts — HOLDS. Each form (file, URL, inline) is pinned as a plain Error with isConnectorUpstreamUnavailable false and the source and remedy in the message; a missing field and 4.0.0 are pinned; 3.0.3, 3.1.0 and 3.1 are the positive control. No read escapes the package.

packages/connectors/connector-mcp/src/mcp-connector.ts — HOLDS. Tried: a server repeating the same cursor (bounded, throws, the client is closed); an empty-string nextCursor (read as the last page — the safer side, since re-sending an empty cursor is what a strict server would refuse); the first request carrying no params.cursor (pinned). Duplicate tool names across pages collapse onto one handler exactly as they already did within one page — pre-existing, not widened here.

packages/connectors/connector-mcp/src/mcp-provider.ts — HOLDS, one should-fix. The classification keys on the SDK's class and status, never on a numeric code of a JSON-RPC error, and the lazy import is of a hard dependency, so this failure path cannot be replaced by an import failure. Boot: plain throw, then fail(), fatal under both kernels; reload: logged and skipped with the previous live connector kept — the ADR-0097 reconcile policy. The appended SDK message carries the server's response body, never the request headers, so no credential is echoed. Should-fix (not blocking): instanceof binds the match to the SDK copy this package resolves, so an injected clientFactory built on a second SDK copy (a host pinning another @modelcontextprotocol/sdk) would miss the match and fall back to the previous degraded-and-retried classification, logged per attempt. A name-and-code check (name === 'StreamableHTTPError' with code 401/403, name === 'UnauthorizedError') is as discriminating against McpError and copy-independent. Carrier: the seat, as a follow-up noted on the card.

packages/connectors/connector-mcp/src/mcp-provider.test.ts — HOLDS. Injected clients throw the SDK's real classes; 401 on tools/list pins the client close; a 403 nested in cause pins the walk; StreamableHTTPError(503) and McpError(401) are the controls that keep the old classification.

packages/connectors/connector-mcp/src/mcp-http-discovery-faults.test.ts — HOLDS. A real localhost Streamable-HTTP fixture reached through the real SDK client: two pages pinned with the cursors the server actually received; the endless pager pinned at exactly 100 tools/list calls; 401 and 403 pinned as plain with exactly one request seen (no session DELETE, no SSE GET followed — the fixture answers GET with 405, the SDK's no-stream path); the declarative boot through AutomationServicePlugin + ConnectorMcpPlugin pinned to reject with no degraded reason and no second request after 300 ms. Servers close in afterEach, the kernel in finally; @objectstack/service-automation and @objectstack/core were already devDependencies used by the existing plugin test. No read escapes the package.

Implemented-by: claude/issue-26709-connector-load-faults
Reviewed-by: session_01QSeKYmQXM3rHJcPnrEPk4B

VERDICT: PASS


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 · ACCEPT · domain:server seat 3 · session_01QSeKYmQXM3rHJcPnrEPk4B · 2026-10-27T17:10Z

Head: 2177e83aa4d555a287a78a78696c8b9717198e8c

  • 形态: draft → main, first line Refs #26709 (items 2, 3a, 3b); no closing keyword anywhere in the body (seat grep). 9 files, +499/−15; check-governed-merges --pr 26798: NOT governed, under 3000 lines. Clause-②: no (narrowing) + Metadata-protocol: narrowed at line start in both changesets (minor on connector-mcp and connector-openapi). Items 1 and 3(c) (new providerConfig keys) and item 4 are not built: seat grep of the diff for an added include key under packages/ → 0 hits; nothing under packages/spec.
  • 前提实测: dev re-check on base a485b5a3 matches the seat's at dispatch (swagger 0 hits in connector-openapi/src, no nextCursor in mcp-connector.ts, the "A credential the …" comment present).
  • 门禁 check-runs: at this head 37 success, 10 skipped (UI lanes on the path filter, matrix placeholders, opt-in harnesses), 0 red. dogfood_battery pinned to this head: 302 files passed, 3 skipped, no failures.
  • 契约复核: PASS at this head, CONTRACT_REVIEW_TIER, record 6448429617 (scope: the six non-prose files + the cited ADRs, SDK and materializer).
  • 接受的偏差 / open questions: open_questions[0] (past the 100-page bound the instance degrades and retries rather than failing boot): accepted, a bounded and loud outcome, and no author key can fix an over-paginating server. open_questions[1] (ADR-0097's "classifies connect / tools/list failures as unavailable" now has a 401/403 exception): filed docs(adr): ADR-0097's "Upstream availability" says the mcp provider classifies every connect / tools/list failure as unavailable; PR #26798 makes a rejected credential (HTTP 401 / 403) a fatal configuration fault #26809 (Tier H amendment, maintainer lands).
  • Skills-docs: the PR body's line is accurate: content/docs/automation/connectors.mdx teaches both refusals in this diff (sentences checked: "The document must be OpenAPI 3.x … The runtime never converts." and "A paginated tool list is followed through every page … fix the credential and reload."), matching the code.
  • 范围外去向:
    • Review should-fix (instanceof binds the 401/403 match to this package's SDK copy, so a host-injected clientFactory built on a second SDK copy falls back to degrade-and-retry): Acceptance notes, not filed. No in-repo producer injects such a client, and the failure is the pre-PR behaviour, not a wrong answer.
    • The reviewer's note that a non-retryable 400/404/410 on the MCP endpoint still degrades: noted, outside the card's ask (401/403 only).
    • Programmatic createOpenApiConnector still trusts its caller's document, per ADR-0023: no action.
  • 落地条款: ordinary queue landing by the seat now (pr_ready + automerge_enable). At merge, connectors: auto-shelf readiness — declarative include and a loud Swagger 2.0 refusal for connector-openapi; tools/list pagination, fatal 401 and a tool-snapshot hash for connector-mcp; an offline spec-normalization tool #26709 is released back to pm:queue with items 1, 3(c) and 4 named as remaining.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 27, 2026 17:11
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 27, 2026 17:11
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 55b5042 Oct 27, 2026
48 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-26709-connector-load-faults branch October 27, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants