Skip to content

feat(codex): report per-server MCP startup before input - #1092

Merged
stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/turn-background-352
Nov 20, 2026
Merged

stamp-build[bot] merged 2 commits into
mainfrom
agent/otter/turn-background-352

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Otter from open-agent-runtime opened this pull request through Stamp
View in Stamp →


Codex can send its first model request while an optional MCP server is still listing tools. Project each thread-scoped startup notification as a typed event, expose the latest state by server, and declare the measured behavior on Codex 0.169.0 and 0.170.0. The existing replaying event subscription lets callers wait for the servers their first turn needs.

On Linux, holding a stdio tools/list response for 6.5 seconds let both versions finish a turn without the tool. Both reported independent startup states for two servers before any input. After one failed and the other reported ready, the successful tool was present in the first model request. The native regression also verifies pending HTTP discovery alongside a failed stdio server.

Local validation passed on both native pins. The full check passed with 5,644 unit tests and 19 mock behaviors. An earlier attempt hit the 400 ms Antigravity fixture deadline before its test process wrote its PID.

@stamp-build
stamp-build Bot merged commit 96dd70f into main Nov 20, 2026
25 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/turn-background-352 branch November 20, 2026 20:10
@stamp-build stamp-build Bot mentioned this pull request Nov 21, 2026
stamp-build Bot added a commit that referenced this pull request Nov 21, 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>opened from existing branch <code>agent/cindy/release-0.127.0</code> @ <code>b15d311f509d</code>, which the agent did not push</sup><br><sup><a href="https://stamp.build/review?receipt=prc_73c76ce0b5c49eb86a194fb0d706127f"><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 -->

## OAR 0.127.0

### Behavior changes hosts should know

- **Pi is an optional dependency of `@botiverse/oar`** (#1098). A default install still includes `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent`, so nothing changes unless you opt out. `npm install --omit=optional` (or `pnpm install --no-optional`) leaves both out; note that these flags drop every optional dependency in the tree, not only Pi's. Pi stays in `defaultRuntimes` either way. `@botiverse/oar-cli` keeps both packages as direct dependencies.
  - Without the packages, `installation()` reports `unsupported` with code `dependency_missing` in a normal Node host for every Pi mode. In-process Pi SDK used to report `not_found` here, so hosts that branch on `not_found` should handle the new code.
  - Pi RPC with an explicit `command` now also checks the host packages, because the host process needs them for session lookup, project-package checks and context-overflow detection. Its command check runs first, so a missing or too-old `pi` still reports `not_found` or `version_unsupported`. Default Pi RPC in a single-file or Electron host still reports `unsupported_host` first.
  - The declarations of every entry point except `@botiverse/oar/pi-durable` no longer import Pi, so TypeScript hosts with `skipLibCheck: false` compile without it. `pi-durable` still needs `@earendil-works/pi-ai`.
- **Ending a process through stdin EOF takes one kill grace, not two** (#1097). When OAR closes stdin to end an idle Claude or Codex session, Codex's login process after a completed login, or a Qoder or Qwen session or model list, and the process is still alive after the kill grace (10 s by default, `OAR_KILL_GRACE_MS`), OAR now force-ends the process tree at once. Before, it sent SIGTERM and waited a second grace, so this could take up to 20 s. Processes that already ended after one grace are unchanged: Claude and Codex model, inventory and account queries, DSH, Factory and Pi RPC. A session with an active turn is still stopped at once.
- **Explicit context overflow is `input_too_large` on more paths** (#1093). The generic error-text rules now check for an explicit overflow first ("This model's maximum context length is N tokens. However, ...", "Your input exceeds the context window of this model", "Prompt is too long", with an optional `Internal error: ` prefix) and keep the original reason. A specific native category or provider code still takes precedence.
  - OpenCode 2.2.7 and 2.3.2 report an overflow and other invalid requests with the same JSON-RPC code (`-32603`) and native name (`provider.invalid-request`); an explicit overflow there is now `input_too_large`. On OpenCode, a rejected summary request still reports `kind: "failed"` with `failure: "provider"`.
  - The same rules cover the ACP fallback (every ACP runtime), Cursor, Factory, Grok, Pi in-process, Pi Durable and Morph, Claude's generic invalid-request fallback, and `invalid_request_error` provider bodies on Pi and Codex. An Anthropic-style "prompt is too long" body that used to be `invalid_request` is now `input_too_large`.
  - The runtime matrix gains "Recovery after automatic compaction fails": after a measured failed automatic compaction, Claude, Pi, DSH, OpenCode v2 and threshold-triggered Codex returned to `idle` and completed the next prompt on the same session. The failed turn stays readable from `turn_ended.outcome` and `status().value.lastTurnOutcome`.

### New

- **Codex MCP startup per server** (#1092). From Codex 0.169.0 (executable installs, stable versions), `sessionCapabilities(installation).mcpStartup` is `{ kind: "per_server", firstModelRequest: "may_start_pending" }`: Codex can send the first model request while an MCP server is still listing tools, and that tool is then missing from turn one. A missing declaration means unknown.
  - Native startup reports that carry a thread ID become `mcp_server_startup` events with the server name and `pending`, `ready`, `failed` or `cancelled` (native `starting` is `pending`). This is a new `RuntimeEventBody` variant, so code that switches exhaustively on event kinds needs a case for it.
  - `mcpStartupOf(records, sessionId)` (from `@botiverse/oar` and `@botiverse/oar/observe`, with type `McpStartupStatus`) returns the latest state per server for the root agent.
  - A host that needs a server on turn one can subscribe with `session.events(observer, { cursor: { sessionId: session.id, afterSeq: -1 } })`, which replays startup reports, and wait for its `ready` before the first input. A server that never reports stays unknown, so set your own time limit.

### Tests and CI

- The release workflow's dispatch, tag-push and `release_only` paths all require the commit to be the merge commit of exactly one merged `chore: release vX.Y.Z` pull request (#1095, #1096). `ci.yml` cancels superseded runs per ref (#1091). Tests check a fixture process's identity before cleanup (#1089), and DSH's `lastInput` and `requestsForTurn` share one trailing synthetic-context check (#1090).

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

Co-authored-by: Cindy <[email protected]>
Co-authored-by: xxchan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants