Skip to content

feat: connect Agents API sessions to HTTP MCP servers - #160931

Merged
sjf-oa merged 5 commits into
mainfrom
sjf/agentsapi-http-mcp
Sep 29, 2026
Merged

sjf-oa merged 5 commits into
mainfrom
sjf/agentsapi-http-mcp

Conversation

@sjf-oa

@sjf-oa sjf-oa commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Agents API sessions currently ignore configured HTTP MCP servers, so operators cannot use those services through the harness. This adds native HTTP MCP configuration while deferring stdio support.

User Impact

Enabled Streamable HTTP servers from mcp.servers and plugin bundles are supplied to the official SDK. Connections originate from the session's execution environment. The native API owns discovery and execution; the Gateway does not create another transport.

Explicit headers, environment-backed headers, exact tool allowlists and session server overrides are supported. Unsupported definitions log an error and are omitted. Supported servers use the API's optional initialization default, so an unavailable service does not block an unrelated conversation.

Stdio, requester-scoped connections, Gateway OAuth profiles, legacy SSE and custom TLS are outside this first step. URL-only definitions retain the existing SSE interpretation. Exclusions require an explicit include list so the native API can enforce them.

Implementation

Reuse shared MCP configuration merging and connection-scope partitioning through a lazy harness SDK helper. The shared configuration module also owns explicit-transport precedence over legacy type aliases, used by both the core MCP runtime and Agents API. Keep API-specific translation in the Agents API plugin. Include effective native MCP definitions in the existing session-binding fingerprint.

Accepted MVP Limitation

Existing native sessions do not adopt changed MCP settings automatically. Upgrading an existing conversation with an already-configured HTTP server may require /new, even without a separate configuration edit. The maintainer explicitly accepted this limitation; no saved-binding migration or automatic session replacement is intended. Recorded maintainer decision.

Evidence

Implementation was pushed before validation. Live evidence on 6077a1d6c1b uses native ARM64 Docker, an OpenAI-hosted Linux environment and ordinary Slack messages. A real unavailable MCP initialization failed while the same turn successfully used the documentation MCP and delivered its reply. Eight unsupported definitions logged errors and were omitted. A genuine pre-feature saved conversation was backed up and restored into the feature image, rejected before native execution, then recovered through /new. The native session ended idle, OpenClaw ended done, and both delivery queues were empty. No mocks, fake bindings or special test modes were used in that live exercise.

The current head is 9bc7723fa3f27b23f4a005b2e377b2c0578c0a18. The rebase resolves the conflict with main while retaining both hosted-network-policy and MCP session-binding checks. The maintainer-approved transport fix moves the existing precedence rule into one shared resolver used by the core MCP runtime and the Agents API adapter. Explicit HTTP transport now overrides a stale stdio type alias; command-bearing definitions remain omitted. The fix commit quotes the ClawSweeper request.

The new no-mock regression, forwards explicit HTTP transport over a stale type alias while excluding command-bearing servers, exercises real configuration merging and adapter output in extensions/agentsapi/agentsapi-mcp.test.ts. It passed in current-head CI in 3 ms; its 45-file shard took 77.48 seconds. The current-head persistence regression also passed in its CI job in 4.669 seconds, with a six-file shard duration of 36.61 seconds. These are CI measurements, not standalone file wall times. No unit tests were run locally. Changed-file formatting and whitespace checks passed after publication. Independent P0-P2 diff review completed scoped-clean. ClawSweeper revision 7 reviewed the current head and found no actionable findings or remaining before-merge items. Current-head CI completed successfully on its first attempt. The earlier live exercise does not claim execution of this mixed-alias case or the rebased head.

The existing persistence fixture expectation was amended into the original feature commit. CI passed that case at an earlier head in 4.296 seconds; its containing shard took 36.65 seconds. Earlier CI also encountered a native Bun SIGSEGV without an assertion result; one diagnostic replay passed in 723 seconds without establishing the crash cause.

A subsequent earlier-head attempt exposed a separate subagent archive test failure: starts delete-mode retention when its terminal lifecycle event completes expected execution.status: "terminal" but received "running". The other 24 cases passed. The registry and fixture were unchanged by this PR, and the fixture does not run the Agents API harness. Bounded source inspection found no causal path from the MCP changes, but did not establish the asynchronous completion failure's cause or an owning fix. No timeout increase, blind rerun or unrelated lifecycle change was made. This historical result is separate from the current-head CI run.

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: agentsapi size: S labels Sep 29, 2026
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-http-mcp branch from 474896c to e110509 Compare September 29, 2026 03:43
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-http-mcp branch from e110509 to ce0e8dd Compare September 29, 2026 03:49
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 3:26 AM ET / 07:26 UTC (Revision 7).

ClawSweeper review

What this changes

The Agents API plugin translates configured Streamable HTTP MCP servers into native session tools, with shared configuration handling, filtering, tests, and reset guidance.

Merge readiness

✅ Ready for maintainer review

Current main does not connect configured MCP servers to Agents API sessions. The current branch addresses the prior transport-precedence finding, and the recorded live exercise supports the central behavior. No new actionable defect was found.

Priority: P2
Reviewed head: 9bc7723fa3f27b23f4a005b2e377b2c0578c0a18

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong real-path evidence and a focused SDK adapter support a good patch rating, with the final alias case covered at the adapter boundary.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The recorded ARM64 Docker Gateway, hosted Linux, and Slack run exercised native HTTP MCP calls, optional-server failure, reply delivery, and restored-session recovery through /new. That run predates the current head's transport-precedence fix; a new adapter regression covers the mixed-alias case, but no live mixed-alias run is claimed. The saved-binding change has an observed and documented upgrade recovery path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The recorded ARM64 Docker Gateway, hosted Linux, and Slack run exercised native HTTP MCP calls, optional-server failure, reply delivery, and restored-session recovery through /new. That run predates the current head's transport-precedence fix; a new adapter regression covers the mixed-alias case, but no live mixed-alias run is claimed. The saved-binding change has an observed and documented upgrade recovery path.
Evidence reviewed 8 items Current main lacks this capability: The current-main Agents API session creation sends web search and Gateway functions, with no MCP tool configuration.
Introduced native MCP path: The PR adapter merges configured servers, omits requester-scoped and unsupported definitions, and emits HTTP MCP tools for session creation.
Prior finding addressed: The shared resolver gives explicit transport precedence over a legacy type alias; the new adapter regression covers that case and excludes a command-bearing definition.
Findings None None.
Security None None.

How this fits together

OpenClaw loads operator and plugin MCP definitions during an Agents API conversation attempt. The plugin selects supported servers for native session creation, after which the service runs MCP calls and OpenClaw delivers the reply.

flowchart LR
  A[Operator and plugin MCP settings] --> B[Shared configuration merge]
  B --> C[Scope and transport selection]
  C --> D[Session binding check]
  D --> E[Agents API session]
  E --> F[Native MCP calls]
  F --> G[Conversation reply]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +165, Tests +43, Docs +77. Total +285 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 7 176 11 +165
Tests 3 44 1 +43
Docs 2 77 0 +77
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 297 12 +285

Review metrics

Metric Value Why it matters
Production and validation growth production +165, tests +43, docs +77 lines Most production growth implements the new native adapter and shared SDK path for a previously unsupported capability.

Technical review

Best possible solution:

The Agents API harness should use the official SDK for supported static HTTP MCP servers, diagnose omitted definitions, and retain the documented /new upgrade path for existing native sessions.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction: current-main source does not forward MCP tools in Agents API session creation, and the branch's changed behavior has a recorded live exercise.

Is this the best way to solve the issue?

Yes. The adapter reuses shared configuration handling and the official SDK's native MCP tool contract, keeping transport execution with the Agents API.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fc312928cfb2.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded improvement to an optional Agents API harness workflow.
  • merge-risk: 🚨 compatibility: Existing native conversations with configured HTTP MCP may require /new after upgrade; the recorded MVP tradeoff and live recovery exercise cover that limitation.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The recorded ARM64 Docker Gateway, hosted Linux, and Slack run exercised native HTTP MCP calls, optional-server failure, reply delivery, and restored-session recovery through /new. That run predates the current head's transport-precedence fix; a new adapter regression covers the mixed-alias case, but no live mixed-alias run is claimed. The saved-binding change has an observed and documented upgrade recovery path.
  • proof: sufficient: Contributor real behavior proof is sufficient. The recorded ARM64 Docker Gateway, hosted Linux, and Slack run exercised native HTTP MCP calls, optional-server failure, reply delivery, and restored-session recovery through /new. That run predates the current head's transport-precedence fix; a new adapter regression covers the mixed-alias case, but no live mixed-alias run is claimed. The saved-binding change has an observed and documented upgrade recovery path.

Evidence

What I checked:

Likely related people:

  • sjf-oa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Raw commit d4f6966 adds src/agents/native-mcp-policy.ts:62 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d4f6966dbf3b; files: src/agents/native-mcp-policy.ts)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-29T03:57:26.604Z sha ce0e8dd559a5d765fd61af9e41976121b99242bc :: needs real behavior proof before merge. :: [P1] Preserve existing bindings when MCP activates | [P1] Keep unsupported global MCP servers from failing unrelated turns | [P2] Respect the URL-only server's SSE transport
  • reviewed 2026-09-29T04:22:15.051Z sha ce0e8dd559a5d765fd61af9e41976121b99242bc :: blocked before merge. :: [P1] Keep existing bindings usable when MCP activates | [P1] Skip unsupported shared servers without failing the turn | [P2] Honor the URL-only server's SSE default
  • reviewed 2026-09-29T05:18:33.157Z sha 7318030461baec3ce5ff6f9e97ffb8af9e74b128 :: blocked before merge. :: [P1] Preserve existing bindings when MCP activates | [P1] Keep unrelated unavailable servers from failing every turn
  • reviewed 2026-09-29T05:36:45.370Z sha 6077a1d6c1b0e2df396b7f7b4483c378afc9802b :: blocked before merge. :: none
  • reviewed 2026-09-29T06:10:34.691Z sha 6077a1d6c1b0e2df396b7f7b4483c378afc9802b :: needs changes before merge. :: [P2] Honor explicit HTTP transport before the stdio type alias
  • reviewed 2026-09-29T06:21:31.915Z sha 6077a1d6c1b0e2df396b7f7b4483c378afc9802b :: blocked before merge. :: [P2] Honor explicit HTTP transport before rejecting the stdio alias

@sjf-oa

sjf-oa commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Live Docker and hosted-environment evidence

Ran the ordinary Slack conversation flow against a native linux/arm64 Docker Gateway and real OpenAI-hosted environments on 2026-09-28, 21:00-21:12 PDT. No mocks, fake services, special test mode, or Gateway restart.

Built source: e110509029522dd5c43c5965c5d6870314389466. PR head ce0e8dd559a5d765fd61af9e41976121b99242bc differs only by formatter import ordering. Image ID: sha256:e629b5c93f2c6f643055d7357b2966e2143f7675d5ca262335cb0b0a6ad32a04.

Used the anonymous public example in the official MCP guide, https://developers.openai.com/mcp, configured explicitly as streamable-http.

  • Native execution and MCP: a real hosted Linux command returned MCP_HTTP_VM_160931 and Linux, exit code 0. A native mcp_call to openai_docs.search_openai_docs completed with real documentation results. Both tool calls/results were persisted in OpenClaw history, and Slack received the final answer. The retrieved native session confirms environment.type=openai_hosted and connection_origin=environment.
  • Tool filter and excluded requester connection: the include list contained search_openai_docs and fetch_openai_doc, with fetch_openai_doc excluded. The native session contained only allowed_tools: ["search_openai_docs"]. A separate auth=oauth, oauth.identity=per-requester server was absent from the native session's MCP definitions. An actual native attempt to access it failed with resources/list failed: unknown MCP server 'requester_docs'. The static HTTP search succeeded in the same turn. Slack received both results, the native turn completed, and OpenClaw reached done.
  • Configuration change and reset: removing that tool exclusion hot-reloaded without restarting the Gateway. Continuing the bound conversation failed with Agents API model, credential, environment, or MCP configuration changed; reset the OpenClaw session before continuing. The old native session's turn list remained unchanged. Sending the ordinary /new command in Slack created a replacement hosted session with both allowed tools, completed a real MCP search, delivered its answer, and settled the OpenClaw run as done with no active runs.
  • Settlement: after the final exercise, the outbound delivery queue and context-engine turn outbox both contained zero rows.

Observed limitation: the first exercise encountered API HTTP 503, The service is temporarily unavailable. Although native execution/MCP and Slack delivery succeeded, OpenClaw recorded that outer run as failed. The fresh-session and reset exercises subsequently completed normally. This is not a claim that provider-error recovery was fixed.

Offline image verification, changed-file formatting, and git diff --check passed. No unit tests were run. ClawSweeper's behavior decisions remain pending; this evidence does not waive them or the CI gates.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 29, 2026
@sjf-oa

sjf-oa commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

The maintainer accepts the MVP limitation that existing native sessions cannot adopt changed MCP definitions. No live configuration update or automatic session replacement will be implemented in this PR. The existing /new or /reset path remains the documented way to start a fresh session, with live recovery evidence already attached.

Documented in a30c73da71f. This commit changes documentation only; the implementation and retained live-test evidence are unchanged. The other requested behavior changes are still awaiting the maintainer's decision.

@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-http-mcp branch from 50bb48c to 7318030 Compare September 29, 2026 05:10
@sjf-oa

sjf-oa commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the unsupported-definition and transport-default findings in 7318030461baec3ce5ff6f9e97ffb8af9e74b128. Each unsupported MCP definition now logs an error and is omitted; supported native connections remain required. URL-only definitions retain the existing SSE interpretation and are omitted unless Streamable HTTP is selected explicitly. The commit quotes the review requests.

The maintainer accepted the remaining session-update limitation for this MVP: existing native sessions do not adopt changed MCP settings automatically. The existing reset guidance is documented, and the earlier live proof exercised normal /new recovery. No additional reset/update implementation is intended in this PR.

The existing persistence test expectation was amended into the original feature commit to match the expanded reset error. Independent review of the current head found no actionable issues through P2. Real Docker verification of the new skip-and-log behavior is in progress.

@sjf-oa

sjf-oa commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision for this MVP: accept the documented reset requirement, including upgrading an existing Agents API conversation when a Streamable HTTP server was already configured. That conversation may require /new before it can continue with the new MCP tool set. Do not add automatic saved-binding migration or session replacement in this PR.

The explicit direction was: “we dont need to support resset for mvp, just document the gap.” The README documents this limitation. The previous live evidence proves configuration-change rejection and recovery through /new; it does not claim a pre-feature saved-state upgrade test.

Please treat the reset behavior as an accepted MVP limitation. The separate, newly raised unavailable-server policy is being reviewed independently.

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@sjf-oa

sjf-oa commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Applied the approved transport-precedence fix in 6a6c0152931.

The core MCP runtime and Agents API now use one resolver in the existing shared MCP configuration module. An explicit transport: "streamable-http" wins over a leftover type: "stdio"; command-bearing definitions are still omitted by the Agents API HTTP adapter. URL-only definitions retain the existing SSE default. The commit message quotes the review request.

Formatting and whitespace checks passed after the commit was pushed. The prior hosted live evidence remains bound to its recorded head; the mixed-alias path has not had a new live run. The separate subagent CI failure was not changed, and the current branch conflicts with main.

sjf added 4 commits September 29, 2026 00:11
ClawSweeper requested:

> The loader reads global and bundled MCP definitions. An enabled SSE, Gateway OAuth, or custom TLS server now throws before any Agents API message proceeds, even when that server is for another runtime. Omit unsupported definitions with a clear diagnostic so they cannot disable unrelated conversations.

> The existing MCP resolver treats a server with `url` but no transport as SSE. This adapter accepts it and declares Streamable HTTP instead, so an existing URL-only definition is sent to the wrong native transport. Require an explicit Streamable HTTP selection before forwarding.

Log an error and omit each unsupported server, including unsupported tool filters and unresolved headers. Keep supported native connections required and reuse the existing transport-alias mapping.
ClawSweeper requested:

> Every enabled supported server becomes required during native initialization, including a shared server unreachable from an OpenAI-hosted environment. That can stop otherwise unrelated Agents API conversations. The earlier review mentioned this availability risk; this is a late line-level finding for its unchanged trigger.

Use the native optional initialization default so conversations can continue when an MCP service is unavailable.
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-http-mcp branch from 6a6c015 to f4fba46 Compare September 29, 2026 07:11
Use the existing shared MCP configuration module to resolve explicit transport
before legacy type aliases in both the core transport runtime and Agents API.
Command-bearing definitions remain outside Agents API HTTP forwarding.

ClawSweeper request:
"Late discovery: a valid server with `transport: "streamable-http"`, a URL, and legacy `type: "stdio"` is skipped here, although canonical configuration and the new docs give explicit transport precedence. Compute the effective transport before rejecting a stale type alias; continue to omit command-bearing definitions."
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-http-mcp branch from f4fba46 to 9bc7723 Compare September 29, 2026 07:13
@sjf-oa

sjf-oa commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review current head 9bc7723fa3f27b23f4a005b2e377b2c0578c0a18. The approved transport-precedence fix now shares one resolver between the core MCP runtime and Agents API. A no-mock regression exercises the actual config merge and adapter, covering explicit HTTP with a stale stdio alias and omission of command-bearing definitions. The rebase preserves main's hosted-network-policy identity check alongside the MCP identity check, and GitHub reports the PR mergeable.

Current-head CI is running. Formatting and whitespace checks passed. Earlier accepted live Docker/hosted Linux/Slack evidence remains pinned to 6077a1d6c1b0e2df396b7f7b4483c378afc9802b, not the new mixed-alias case. The PR body preserves the accepted /new MVP limitation and historical CI failures without claiming they passed.

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@sjf-oa sjf-oa self-assigned this Sep 29, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@sjf-oa
sjf-oa merged commit b4ae783 into main Sep 29, 2026
262 checks passed
@sjf-oa
sjf-oa deleted the sjf/agentsapi-http-mcp branch September 29, 2026 07:31
@sjf-oa

sjf-oa commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 29, 2026
…shipped

Main has been red since b4ae783 (feat: connect Agents API sessions to
HTTP MCP servers, #160931): it added three callable exports to
src/plugin-sdk/agent-harness-runtime.ts without the surface ratchet update,
so test/scripts/plugin-sdk-surface-report.test.ts failed 2/10 (public exports
4594 > 4591, callable 2698 > 2695). Its parent passes 10/10 and the counts at
b4ae783 equal current main, so the whole delta is that merged, reviewed
feature.

Raise publicExports 4591 -> 4594 and publicFunctionExports 2695 -> 2698,
exactly that growth with no headroom. Removing the exports would break the
landed feature. @sjf-oa (Sarah Fortune), please review whether these three
exports should stay public or move behind a narrower seam.

Proof: plugin-sdk-surface-report.test.ts 10/10 (was 2 failed / 8 passed).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
* feat: connect Agents API sessions to HTTP MCP servers

* docs(agentsapi): document deferred MCP session updates

* fix(agentsapi): skip unsupported MCP definitions

ClawSweeper requested:

> The loader reads global and bundled MCP definitions. An enabled SSE, Gateway OAuth, or custom TLS server now throws before any Agents API message proceeds, even when that server is for another runtime. Omit unsupported definitions with a clear diagnostic so they cannot disable unrelated conversations.

> The existing MCP resolver treats a server with `url` but no transport as SSE. This adapter accepts it and declares Streamable HTTP instead, so an existing URL-only definition is sent to the wrong native transport. Require an explicit Streamable HTTP selection before forwarding.

Log an error and omit each unsupported server, including unsupported tool filters and unresolved headers. Keep supported native connections required and reuse the existing transport-alias mapping.

* fix(agentsapi): make MCP initialization optional

ClawSweeper requested:

> Every enabled supported server becomes required during native initialization, including a shared server unreachable from an OpenAI-hosted environment. That can stop otherwise unrelated Agents API conversations. The earlier review mentioned this availability risk; this is a late line-level finding for its unchanged trigger.

Use the native optional initialization default so conversations can continue when an MCP service is unavailable.

* fix(agentsapi): share MCP transport precedence

Use the existing shared MCP configuration module to resolve explicit transport
before legacy type aliases in both the core transport runtime and Agents API.
Command-bearing definitions remain outside Agents API HTTP forwarding.

ClawSweeper request:
"Late discovery: a valid server with `transport: "streamable-http"`, a URL, and legacy `type: "stdio"` is skipped here, although canonical configuration and the new docs give explicit transport precedence. Compute the effective transport before rejecting a stale type alias; continue to omit command-bearing definitions."

---------

Co-authored-by: Sarah Fortune <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…#160931 shipped

Main has been red since 00e2fb1 (feat: connect Agents API sessions to
HTTP MCP servers, openclaw#160931): it added three callable exports to
src/plugin-sdk/agent-harness-runtime.ts without the surface ratchet update,
so test/scripts/plugin-sdk-surface-report.test.ts failed 2/10 (public exports
4594 > 4591, callable 2698 > 2695). Its parent passes 10/10 and the counts at
00e2fb1 equal current main, so the whole delta is that merged, reviewed
feature.

Raise publicExports 4591 -> 4594 and publicFunctionExports 2695 -> 2698,
exactly that growth with no headroom. Removing the exports would break the
landed feature. @sjf-oa (Sarah Fortune), please review whether these three
exports should stay public or move behind a narrower seam.

Proof: plugin-sdk-surface-report.test.ts 10/10 (was 2 failed / 8 passed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: agentsapi merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants