Repository navigation
feat(session): mcpServers on grok, kimi, opencode, antigravity and pi - #181
Merged
Merged
Conversation
Second PR for #170. The ACP runtimes send SessionOptions.mcpServers as ACP `mcpServers` on session/new, session/load and session/resume (stdio env and http headers as {name, value} lists), refusing an http entry where initialize declares no mcpCapabilities.http, checking names before the agent starts and redacting a failed open's error. pi loads its built-in MCP extension with no mcp.json of its own plus one that registers the entries (pi.registerMcpServer), binds the session's extensions so they connect and emits session_shutdown before dispose; env and header values are escaped so pi reads them literally. cursor still refuses: its agent runs on Cursor's servers and only a paid run could show it calling the tool. Evidence: the real grok 1.0.46, kimi 2.1.1, opencode 1.18.30 and agy_acp_server 1.3.0 CLIs, and the bundled pi SDK, against aimock (no login, no tokens): the model calls a stdio and an http echo server on open and on a resume in a new process, the provider receives what only those servers write, a name clash runs the session's server and keeps the user's others, and no record holds a credential. Docs per runtime page and the runtime matrix. Refs #170 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…CP credentials opencode refuses no session option any more: its prompt path (#179) passes mcpServers to the ACP open beside OPENCODE_CONFIG_CONTENT, and an MCP list with an empty or repeated name fails before the prompts are prepared. #179's "prompt and MCP together are refused" regressions now check that both reach the open; the opencode-aimock vendor test runs a replaced and an appended prompt with both echo servers in one session. antigravity refuses an mcpServers entry with a non-empty env or headers (UnsupportedOptionError on mcpServers, before the server starts): agy_acp_server 1.3.0 writes those values in plain text into its conversation database, which outlives the session. Entries without them attach as before; unit and vendor tests cover both. Refs #170 Co-Authored-By: Claude Opus 5.5 <[email protected]>
xxchan
force-pushed
the
session-mcp-servers-acp
branch
from
October 7, 2026 07:15
43633b1 to
07ea1f3
Compare
Merged
xxchan
added a commit
that referenced
this pull request
Oct 7, 2026
Release OAR and CLI 0.32.0. This PR changes only the two package version fields. **New** - `SessionOptions.mcpServers` on grok, kimi, opencode, antigravity and pi (#181, part 2 of #170; claude and codex shipped in 0.31.0): - grok, kimi, opencode, antigravity: ACP `mcpServers` on `session/new` / `session/load` / `session/resume`. An http entry is refused when `initialize` declares no `mcpCapabilities.http` (all four declare it). No agent keeps the servers across a resume: give them again. - antigravity refuses an entry with `env` or `headers` values: its server would store them in plain text in its conversation database, where they outlive the session. Entries without credentials attach. - pi: pi's own MCP extension, with servers registered for the session (`registerMcpServer`) and tools exposed directly; `$` and `!` in values are escaped so they arrive literally. Names must match `[A-Za-z0-9_-]` and not collide after pi's normalisation. - opencode: works together with the prompt options from 0.31.0. - cursor still refuses it, with the reason: no live run yet shows Cursor's agent calling the tool. - Name-clash and environment behavior per runtime are in the runtime matrix and each runtime page. Validation: all 13 checks passed on #181's final head (`07ea1f3`); MCP vendor tests ran the real grok, kimi, opencode, antigravity CLIs (locally, `OAR_TEST`-gated) and the bundled pi SDK (CI) against aimock with stdio and http echo servers, on open and after resume, asserting no record holds a credential. After this PR passes CI and merges, tag its exact squash commit as `v0.32.0` to trigger npm trusted publishing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 5, 2026
<!-- stamp:review:v1 --> <sup><img src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp" width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_1025b24e737c1c426b25b5c1e0529365"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> Pi extensions can handle input without starting a model turn. SDK previously kept that input busy, RPC could admit another prompt while the fold stayed running, and accepted queue dispatches could disappear during extension processing. Native handling now resolves only its own input and preserves independently started runs. Native callbacks and original RPC replies supply `input_handled { requestId, inputId? }`. Refused queue dispatches supply request-correlated `input_dropped`, without retrying hooks. Pi prompt records add `admission: "native"`; queue acceptance and `carries` dispatch preserve one logical submission. Shared status, conversation and wait helpers track admission separately from native activity. SDK queue draining waits for the owning native prompt promise, including deferred settlement actions. Independent runs arm a native idle wait while active. Fast and slow settlement hooks retain A → EXT → B order. Non-custom message, tool or turn events also prove a run whose `agent_start` preceded subscription. Idle custom notices remain native frames without occupying a run or inventing completion, including notices flushed by failed preparation. Preflight cancellation is consumed once and ends at the handled/refused receipt. EXT starting after that receipt needs its own abort; the RPC deadline starts when cancellation is delivered. Accepted withdrawal resolves input-scoped waits with `aborted` across runtimes, including native queues. Valid dispatch refusal resolves those waits with `failed`; provisional direct rejection and standalone compaction resolve `awaitIdle` with null. Public type changes belong in the minor release after 0.88.0: `PromptRun` adds `kind: "handled"`; only input-scoped waits widen to `TurnOutcome | InputHandled`; `input_dropped.inputId` becomes optional alongside its request reference. CLI JSON prints the handling disposition. Pi Durable and ordinary terminal-observer submission restrictions are unchanged. Retained limits are documented: a handled queued command can launch detached EXT after the next input wins native admission; RPC can lose either EXT or the held input according to that race. Extension errors remain observable. Duplicate accepted input IDs and synthetic mixed-child admission logs are also outside this repair. Rebased the approved `83b217d7` onto `37b27726`. Product and test patches are unchanged. The only manual conflict was the `turn_active` source list in record-stream.md, which now retains both the newly merged DSH sources and Pi admission receipts. Validation on Linux x64 for this rebase: - Final head `0b570c74`, base `37b27726`: full check (3,484 tests and 18 mock behavior cases), build, and Kimi behavior pass. - The same product/test patch on preceding base `98f498fc`: all 16 behavior backends, full Pi 1.5.0 vendor suites (119 SDK / 113 RPC), build and clean packed-consumer installation pass. The subsequent base change only adds PR #637's Kimi account-usage classification, covered by the final check and Kimi rerun. - Earlier approved head `83b217d7`: all 36 cross-platform CI checks passed, along with 19 focused RPC 1.4.0 cases and the recorded mutation controls. These remain historical evidence. All 39 CI checks for final head `0b570c74` now pass, including Windows and macOS (run 42078076588). The system-prompt fixture canonicalizes cwd and clears temporary-directory overrides inside its path-query child, because libuv restores a missing Windows TEMP at spawn. Existing replay snapshots and expected prompt content are unchanged. No deadline or assertion was relaxed. [Evidence, reproduction and release notes](https://github.com/botiverse/oar/blob/0b570c74dc1274906130bc97bce188ce85369462/experiments/pi-input-handled/README.md). Task #173; stream-json/Cursor held-queue work remains task #161. The independently identified bootstrap-run delayed-admission case is tracked in task #181. 0.88.0 is published and the release merge pause has been lifted. --------- Co-authored-by: Otter <[email protected]>
Merged
stamp-build Bot
added a commit
that referenced
this pull request
Nov 6, 2026
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_54f421873fe7cccec5ccf5a973fd55d4"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> Pi extensions can handle input without starting a turn, and helpers now say so. Codex reports reconnects and no longer loses replies that arrive without text deltas. ## Pi: input handled without a turn (#640) An extension can handle input without a model turn. SDK used to stay busy, RPC could admit another prompt while status read running, and accepted queue dispatches could disappear during extension processing. Native handling now resolves only its own input and keeps independently started runs. **Public type changes:** - `promptAndWait` adds `kind: "handled"`. Exhaustive `PromptRun.kind` switches must handle it, and code that reads `outcome` after excluding only `rejected` must also exclude `handled`. Handling is not a success outcome and carries no text. - Input-scoped `awaitTurnEnd` and `turnEndAfter` widen to `TurnOutcome | InputHandled`. Unscoped next-turn waits are unchanged. - New event `input_handled { requestId, inputId? }`. `input_dropped.inputId` is now optional, because a request reference can identify an input with no logical id. - Pi prompt records add `admission: "native"`, and `SessionView.statusState` is available on every runtime. - The CLI's JSON output for handled input is `{ disposition: ... }`, with no `completed` outcome. **Behaviour changes on every runtime:** - An accepted `withdraw` resolves input-scoped waits with `aborted`, and a rejected dispatch resolves them with `failed`. These waits could stay pending before. - `awaitIdle` resolves with `null` when a provisional prompt is rejected before a turn exists, including `busy`, and after standalone manual compaction. It could stay pending before. **Behaviour changes on Pi:** - An abort accepted during preflight reaches only a run that starts before the handled or refused receipt. An extension run starting after `handled` needs its own abort after `turn_active`; SDK used to cancel it through a stale marker. - SDK holds queued input until its prompt promise finishes, so settlement hooks keep the A, EXT, B order. A run that started before OAR subscribed still ends when later native run events provide evidence; with no evidence at all, no turn end is produced. Idle custom messages no longer count as a run. **Known limits, in `docs/runtimes/pi.md`:** a queued command that launches an extension message and returns can let the next input win the native slot, and the extension message then fails with an `extension_error` frame. RPC has no equivalent barrier, so either the held input or the extension message can lose that race. A prompt during an unobserved run's settlement can still stall (task #181). ## Codex: reconnects are `retry` events (#647) - `error` with `willRetry: true` now produces `retry`, with the native text as `reason`. `attempt` is OAR's count within the turn. Status reads `waiting_model` on it. - **OAR adds no stderr channel or OOM option.** A dropped stream reports itself in the protocol, with no stderr line on Codex 0.163.0 and 0.167.0. A host wanting runtime children killed first can wrap `installation.command`: see [process priority](https://github.com/botiverse/oar/blob/main/docs/spec/runtime-matrix.md#process-priority) and the [decision](https://github.com/botiverse/oar/blob/main/docs/design/decisions.md#no-stderr-channel-or-process-priority-option-2026-11-06). ## Codex: completed messages and native metadata (#648) - An `agentMessage` with completed text and no text deltas lost its reply. Its `item/completed` frame now gives the full text once. Streamed replies are not repeated, and a partial stream is not extended. - `text_delta` gains optional `phase` when native reports it. `tool_call_started` gains optional `server` and `toolName` for MCP calls; `tool` stays `mcpToolCall`. - `codexErrorInfo: "unauthorized"` now classifies as `auth`. This follows the generated 0.167.0 protocol; no account failure reproduced it. ## Evidence and tests - The daily check now covers the DSH CLI; DSH 0.2.2-rc.1 passes with local providers, and the CI pin stays 0.2.1-rc.5 (#644). - Qoder 1.1.83 passes inference, file tools and resume with a Free account and a DeepSeek pay-as-you-go key. First-party models are unverified (#644). - Windows CI keeps watchdog startup diagnostics (#645) and retries one more directory removal (#643). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Nov 16, 2026
<!-- stamp:review:v1 --> <sup><img src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp" width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_810843d6b7a7c94704a6264df859ca31"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> A `session_start` extension can finish its bootstrap model request and wait in an `agent_settled` hook before OAR subscribes. OAR then appears idle and submits a new prompt into Pi's deferred list; if the hook starts compaction, the prompt loses its native receipt and remains pending in SDK mode. Subscribe the SDK controller before binding extensions, retaining the real bootstrap start and end. Direct prompts now refuse busy in this window, queued input waits through settlement and compaction, and completed or aborted bootstrap runs do not own the next input. Model validation and credential registration still precede binding. RPC is explicitly not fixed: native 1.5.0 binds before subscribing and exposes no correlated deferred-refusal receipt. The measured input rejects at OAR's existing 30-second transport deadline, then the child exits. Native 1.5.2 has the same ordering by source inspection only. The runtime page and [reproducible report](https://github.com/botiverse/oar/blob/181541f860929ad3268e70d427f2dd65a3efc344/experiments/pi-bootstrap-admission/README.md) document this boundary and retain selected original records; no error is reassigned to an unrelated input. Validation: `CI=1 pnpm run check` passed 4,371 tests and 18 mock behavior checks; build passed. Native SDK/RPC vendor suites passed 124/115 tests and each public behavior suite passed 17 cases with two capability skips. All three new native regressions failed on the original product files and passed with the fix. The initial fixture failures are retained in the report; cross-platform CI is pending. Scope: #core:#181. Please review the SDK fix and confirm leaving RPC's native visibility gap as the documented upstream follow-up. Co-authored-by: Otter <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second PR for #170, on top of #178 (the contract plus claude and codex) and rebased onto #179 (opencode prompts).
mcpServersnow works on grok, kimi, opencode, antigravity and pi. Antigravity refuses entries that carry credentials. Cursor still refuses the option, because only a paid run against Cursor's backend could show its agent calling the tool.ACP: grok, kimi, opencode, antigravity
mcpServersonsession/new,session/loadandsession/resume(shared/acp/mcp-servers.ts), where oar used to send[]. Stdio is{name, command, args, env: [{name, value}]}and http is{type: "http", name, url, headers: [...]}.args,envandheadersare always sent, because opencode reads them without checking.UnsupportedOptionErroronmcpServerswheninitializedoesn't declaremcpCapabilities.http. All four agents declare it.--plugin-dirlaunch flag also works, but it isn't used: the ACP param does the job, and launch flags belong to ACP runtimes: use per-session launch flags for options ACP doesn't carry, instead of refusing #171.use_toolmeta-tool, named<server>__<tool>mcp__<server>__<tool><server>_<tool>call_mcp_tool; servers start at the first promptAntigravity refuses entries with credentials. The server saves the session's entries in plain text,
envand header values included, in$GEMINI_HOME/antigravity-acp/conversations/<id>.db(mode 0600). That file outlives the session, and the host can't see it. So an entry with a non-emptyenvorheadersis refused withUnsupportedOptionErroronmcpServersbefore the server starts. Entries without credentials attach as usual (refuseAntigravityMcpCredentials).opencode prompts together with MCP: opencode no longer declares any refused option. Its prompt path from #179 passes
mcpServersto the ACP open next toOPENCODE_CONFIG_CONTENT. #179's two "prompt and MCP together are refused" regression tests now check that both reach the open. The opencode-aimock vendor test runs a replaced prompt, an appended prompt and both echo servers in one session: every agent request carries both prompts, and both echoes arrive.Already there before this PR: grok's
_x.ai/mcp/servers_updated, which oar records verbatim, includes theenvvalues of stdio servers from the user's ownconfig.toml. Values passed throughmcpServersnever show up there. Tracked separately (#182).pi
createMcpExtension) is loaded with nomcp.jsonof its own, plus one inline extension that callspi.registerMcpServer(runtimes/pi/mcp.ts). This is how the pi CLI itself connects servers.@earendil-works/pi-mcp's client as custom tools: pi keeps its own tool naming, rendering, reconnects and lifecycle, and no new dependency is needed.exposure: "direct"). pi's default exposure needs the codemode extension, which oar doesn't load.session_startand closes them onsession_shutdown, and oar's opener emitted neither before. A session given servers now callsbindExtensions({}), and emitssession_shutdownbefore dispose, so stdio servers exit (measured). One side effect: in such a session the user's own extensions also receivesession_start. Emitting these events for every session is tracked separately (fix(pi): emit session_start / session_shutdown for every session, not only those with mcpServers #183).envor header value starting with!as a shell command and expands$NAME. oar escapes every$and!so the value arrives literally; a unit test round-trips values through pi's own resolver.SessionOptions.env, then the entry's ownenvon top.[A-Za-z0-9_-], and it would mergea-banda_binto one tool namespace. Both cases are refused before the session opens. A name another extension already registered makes the open fail, rather than running without the server.mcp.json, and it still doesn't, so there is no clash with it.cursor (still refused)
The refusal reason now says why. Cursor's agent runs on Cursor's servers. Against a hand-written stand-in for that backend (not in the repo), the SDK started the server at the first
sendand ran atools/callwhen the backend asked for it.The missing evidence is a live run that shows Cursor's real agent choosing the tool, and the
tool_calldeltas oar records for that call. Getting it would take a login and paid tokens, so it wasn't done. cursor.md lists what such a run has to show.Evidence
sea-trial/vendor/mcp-servers-acp.vendor.test.tsruns the real grok, kimi, opencode and agy_acp_server CLIs.sea-trial/vendor/mcp-servers-pi.vendor.test.tsruns the bundled pi SDK. Both use aimock, with no logins and no tokens.echo:<text> via=<transport> token=<credential fingerprint>, which only the echo server writes.echoanduserechoagainst the session'secho, with each echo's fingerprint showing which server answered. They also check that no record contains a credential.sea-trial/harness/aimock-acp.tspoints each ACP CLI at aimock from a fresh home. antigravity uses the public Gemini API with a dummy key andGOOGLE_GEMINI_BASE_URL, and the test proxy hands its role-modeltool results to aimock asuser(geminiToolResultsAsUser).OAR_TEST-gated and were run locally on all four (OAR_TEST=<rt>-aimock; antigravity also needsOAR_ANTIGRAVITY_BIN), because CI has no ACP aimock backend.tests/acp/acp-session-mcp-servers.test.tscovers the ACP wire shape on new and resume, the http refusal, name checks, the redacted open error and antigravity's credential refusal, against the fake ACP agent.tests/pi/pi-mcp-servers.test.tscovers the pi config mapping and escaping.pi-mcp-echo, recorded withpnpm sea-trial:record pi-aimock mcp-echo -.vendor/support/echo-mcp.ts. Prompts now match on the current turn's user messages, because kimi follows the prompt with a<system-reminder>. I re-ran the claude-aimock and codex-aimock MCP vendor tests and they pass.Docs: the runtime matrix (refusals and channels), the contract comment, both READMEs, and a "Session MCP servers" section on each of the grok, kimi, opencode, antigravity, pi and cursor pages.
CI=1 pnpm run checkis green. The pi-aimock behavior suite and vendor suite pass, and so do the MCP vendor tests on all seven aimock backends.🤖 Generated with Claude Code