Skip to content

test(process): verify fixture process identity before cleanup - #1089

Merged
stamp-build[bot] merged 3 commits into
mainfrom
agent/otter/test-process-identity
Nov 20, 2026
Merged

stamp-build[bot] merged 3 commits into
mainfrom
agent/otter/test-process-identity

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 →


Windows CI caught a PID being reassigned between a Pi RPC reader exiting and the test checking for a leak. The old cleanup helpers could also send a signal to the new owner. The cancellation and orphan fixtures used the same helpers. Windows Pi RPC failure

The test helpers now require the original OS creation time alongside the PID. Each fixture records the identity in its child or while starting the child. The liveness check treats a different creation time as an exit. Cleanup checks that identity before signaling. On Windows it holds a process handle through the comparison and termination. An OS observation error fails the test.

A regression test gives a live child’s PID two different start times. Cleanup with the stale identity leaves that child running. Cleanup with the matching identity terminates it. The migration covers both the ordinary Vitest suite and the native vendor fixtures.

On Linux, CI=1 pnpm run check passed with 5,635 unit tests and 19 mock behavior cases. The native runs passed all 17 Pi RPC tests, six Codex abort tests and four Kimi login tests selected for this change. The Windows CI job exercises the handle-based check on a real Windows process.

@stamp-build

stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

The shell now records a process identity without starting Node. Linux uses shell builtins to read procfs field 22. macOS runs /bin/ps with the C locale and preserves the internal spacing of its start time. The deadlines are unchanged.

I checked these callers:

  • ACP terminal release and priority release.
  • Held pipes after immediate exit and after stdin EOF, the unread extra pipe, runWithHolder, the EPERM timeout and the 300 ms kill fallback.
  • The late writer at 0.3 s, extra-pipe readers and the held-pipe ownership subprocess.
  • The Claude host-death shell and Cursor’s detached child. Both publish their identity files with a rename.

The native stuck-tool test asserts both that SIGSTOP succeeded and that the same host is still present. The process-tree tests now use fixture start times for liveness, while product table values are used only for product operations. The Codex abort fixture scans for every matching process, confirms ownership and start time, then signals by identity. A regression starts duplicate markers and a separate control. The sharing resource probe excludes the process-table reader explicitly, and the ACP fault probe records the actual child at spawn.

On Linux, 42 focused tests, six native Codex cases and the native Claude stuck-tool case passed. A native Kimi 2.6.3 ACP process initialized, exited on the injected signal, and rejected a second crash attempt. Both shell reporters matched the fixture reader under dash and bash with an empty executable search path. That control exercised both procfs and the ps code path on Linux. The hosted jobs cover macOS and Windows.

Full Linux validation at 5297a8f passed type checking, lint, 5,636 unit tests and 19 mock behavior cases.


Otter commented through Stamp · server open-agent-runtime · reviewed head 5297a8f
View in Stamp →

@stamp-build
stamp-build Bot merged commit 3694e9f into main Nov 20, 2026
48 of 49 checks passed
@stamp-build
stamp-build Bot deleted the agent/otter/test-process-identity branch November 20, 2026 18:57
@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