Repository navigation
docs(resources): measure shared native session lifecycles - #512
Merged
Merged
Conversation
This was referenced Oct 29, 2026
stamp-build Bot
pushed a commit
that referenced
this pull request
Oct 29, 2026
abort ends the active turn; it does not promise that processes the turn started have stopped. Codex keeps unified-exec commands across turns on purpose and grok's terminals outlive cancel, while kimi, opencode and antigravity stopped the measured command within 2 s. dispose() stops them. Evidence: experiments/runtime-resources-2026-10-28.md (#512). Co-Authored-By: Claude Opus 5.5 <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Oct 29, 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_bfe130ef99d42a6b6641fbe368499e39"><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 --> Adds "What `abort` stops" to `docs/spec/runtime-matrix.md` and points the `Session.abort` contract comment at it. `abort` ends the active turn; it never promised that processes the turn started had stopped, but nothing said so. #512 measured it on Linux (2026-10-28) with a command that starts a parent and a child process: - codex 0.165.0 keeps unified-exec commands across turns on purpose, in OAR sessions as well as a shared app-server; the command ran until it exited by itself (about 45 s), and OAR's 10 s fallback does not apply once codex has ended the turn. `dispose()` stops it; native `thread/backgroundTerminals/terminate` and `thread/archive` also do, and OAR does not call them yet. - grok 1.0.70: native cancel and close leave the terminals grok created through the host; OAR's ACP session releases every hosted terminal on `dispose()`. - kimi 2.3.3, opencode 1.19.5 and 2.2.0, antigravity 1.4.3 stopped the command within 2 s. - claude, qwen, qoder, pi, cursor were not measured. Docs and one comment; no behavior change. `CI=1 pnpm run check` passed (one `tests/acp/acp-process.test.ts` 500 ms timeout under load average ~20 on the first run; that file then passed three times). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Cindy <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Merged
stamp-build Bot
added a commit
that referenced
this pull request
Oct 29, 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_b7f19bc105fc79567d3816dade60a274"><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 --> ## Breaking changes ### Claude: permission launch arguments are checked (#513) `launchArgs` may now carry `--permission-mode` (see New). Two arguments that could only make a session wait for an answer nobody sends are refused before launch with `UnsupportedOptionError("launchArgs")`: `--permission-prompt-tool` (OAR has no interface for answering permission requests), and `--permission-prompts` with any value other than `none`. Combining `--permission-mode` with `--dangerously-skip-permissions` is refused too, as is a `--permission-mode` without a value or with a value other than the four below (for example `bypassPermissions`: omit the mode to keep the bypass). ### TypeScript: new union members Exhaustive `switch` statements over these types need a new case: - `LoginUnsupportedReason` gains `browser_suppression_unavailable` (#504). - `RefusableSessionOption` gains `goals`; `ControlAction` and `RequestBody` gain `goal_set`, `goal_read` and `goal_clear`; `RuntimeEventBody` gains `goal_changed` (#516). ## Behavior changes ### `orient()` for Qwen and Kimi (#504, #505) - Qwen's `authStatus` is `localOnly`, so it now runs at local depth. When Qwen's credentials live only in project settings, a workspace `.env` or `--openai-api-key`, it reports `logged_out`, and at `models` depth `orient` then skips the catalog (`skipped` / `logged_out`) where 0.75.0 read it. Call `qwenRuntime.listModels()` directly for a specific workspace. - Kimi's `auth` is now `skipped` / `depth` at local depth instead of `unsupported`. At account and models depth `orient` starts `kimi acp` for the status check (up to 20 s by default) and skips account usage and models when Kimi reports logged out. ### Codex `goal_changed` without opting in (#516) OAR projects Codex's own `thread/goal/updated` and `thread/goal/cleared` notifications whatever `SessionOptions.goals` is. A user whose Codex configuration already enables goals produces `goal_changed` events in sessions that did not set `goals: true`; such sessions still have no `goal` member. Handle unknown event kinds without throwing. ### Login status contract (#504) `authStatus` never starts a login and never returns a secret, but a native status query may now contact its service or start a short-lived process (Kimi's ACP check); it was previously described as read only and cheap. `oar login --status` covers Kimi and Qwen too. ### New dependencies (#505) `@botiverse/oar` now depends on `dotenv` and `strip-json-comments` (loaded only by Qwen's status reader). ## New ### Kimi login, status and logout (#504) `kimiRuntime.login` relays Kimi's native device code (`kimi login`, with `KimiLoginOptions.region`: `"mainland-cn"` or `"global"`; omitted, Kimi resolves the region itself). `openBrowser: false` places a private no-op browser helper first on the login child's PATH and removes it afterwards; where that cannot be guaranteed the login returns `unsupported` / `browser_suppression_unavailable` before launch. `authStatus` checks readiness through ACP `authenticate` without creating a session (cached credentials, not proof of remote validity; not declared `localOnly`). `logout` uses ACP `logout` and re-reads the status. Login and logout need Kimi 2.3.3 or later; older builds, or a build without ACP logout, answer `unsupported` / `version_unsupported`. Native side effects: a failed or cancelled Kimi login can still change stored credentials (re-read `authStatus`; OAR does not roll back), and a successful login writes Kimi's managed model configuration. ### Qwen: login status and provider configuration (#505, #507) - `qwenRuntime.authStatus` is a local-only, presence-only reader over the session environment, user and system settings, user `.env` files, and Google ADC or legacy Qwen OAuth file existence. Any configured source answers `unknown` with the source kind (never a value); none answers `logged_out` with setup guidance and a note that project settings, a workspace `.env` or launch arguments may still supply credentials. `AuthStatus` `logged_out` gains an optional `detail`. - `createQwenProviderAuth(installation, { cwd?, env?, timeoutMs? })` is async and resolves a `QwenProviderAuth` with `listProviders()` and `connect({ providerId, apiKey?, baseUrl?, protocol?, wireApi?, modelIds?, scope? })` over Qwen's own ACP methods `qwen/providers/list` and `qwen/providers/connect`, which in Qwen 0.26.2 apply the same install plan as its `/auth` command. A non-positive `timeoutMs` throws `RangeError`; failures throw `QwenProviderAuthError` (`kind`, `method`, `code`). New exports: `createQwenProviderAuth`, `QwenProviderAuthError` and the types `QwenProvider`, `QwenProviderAuth`, `QwenProviderAuthOptions`, `QwenProviderAuthErrorKind`, `QwenProviderConnectOptions`, `QwenProviderConnectResult`. The key travels only on ACP stdin; errors keep the ACP code and drop native text. `existingConfig` is Qwen's settings-file metadata (no environment, `.env` or `security.auth.apiKey`; depends on `cwd`), not login status. Success means the configuration was written, not that the provider accepts the key; a timeout leaves the write outcome unknown and is never retried. There is no OAuth (Qwen's free tier ended on 2026-04-15) and no logout. ### Claude: noninteractive permission modes (#513) `launchArgs: ["--permission-mode", "dontAsk"]` (also `default`, `acceptEdits`, `plan`) makes OAR omit its default bypass and add `--permission-prompts none`, so requests needing approval are denied locally instead of waiting. Without a mode, the default bypass is unchanged. **On resume, give the mode again**: OAR does not store `launchArgs`, and omitting it restores the bypass. The `--permission-mode=plan` form works too. Claude's own `system/init` frame reports the mode in effect; in `plan` mode, Bash decisions consult a model classifier, and no mode is an OS sandbox. ### Codex: native goals, opt-in (#516) `SessionOptions.goals: true` enables Codex's goal feature for the session. It adds model-visible goal tools, so OAR never enables it by default; OAR confirms it through `config/read` and rejects the open with an `Error` when Codex does not. The session then has `goal`: `set({ objective, status?, tokenBudget? })`, `read()` and `clear()` are recorded controls, and `goal_changed { goal: GoalSnapshot | null }` comes only from Codex's own replies (recorded as frames) and `thread/goal/updated` / `thread/goal/cleared`. An active goal can make Codex start turns by itself; a completed turn never completes a goal, and OAR runs no continuation loop. Other runtimes refuse `goals: true` (`false` is accepted). Give it again on resume. New exports: `GoalControl`, `AdapterGoalControl`, `GoalSnapshot`, `GoalSetOptions`, `GoalStatus`, `KnownGoalStatus`; custom runtimes built on the kernel may supply `goal`. ## Fixes - Codex: any failure before a session is returned now stops the app-server and waits for it to exit before rejecting, also on an already initialized home (#502). - Codex 0.165.0 reports an unknown model as `codexErrorInfo: "modelNotFound"`; it maps to `model_unavailable` without inventing an HTTP status (#503). ## Docs - What `abort` stops: it ends the turn, not necessarily the processes the turn started. Codex keeps commands across turns on purpose and Grok's terminals outlive a cancel; `dispose()` stops them where OAR owns the process (not a borrowed Pi Durable harness) (#514). - Research: Claude permission modes (#506), native goals (#511), per-session process resources and shared-session lifecycles (#512), Antigravity steering and `agy` CLI versus ACP (#517, OAR stays on ACP). - Pi in process and over RPC needs `systemPrompt` and `appendSystemPrompt` again on resume (Pi stores neither); Pi Durable keeps its saved append instructions (#507). - The package README lists who has login, status and logout now (#521). - Runtime version checks for October 28, including Cursor SDK 1.2.0 verified compatible (the peer stays `@cursor/sdk` 1.1.0) and resuming a 1.0.40 agent under 1.1.0 (#508). Co-authored-by: Cindy <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
stamp-build Bot
added a commit
that referenced
this pull request
Oct 29, 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_9607c79c5a0192088a9a64a3f7384c13"><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 --> Adds "Shared runtime processes" to the Placement section of `docs/design/system.md`, with a matching liveness statement. #512 measured that sharing saves memory for runtimes whose own server holds many sessions (ten Codex sessions after one turn: about 1,974 MiB as ten app-servers, 218 MiB as ten threads on one; the ACP agents used between about half and an eighth of their isolated RSS; one OpenCode version used more CPU shared). xxchan asked for a shared/isolated choice covering Codex and ACP, then for sharing by default (#core:2a8c938a). Direction: once a runtime version meets the evidence gate, its sessions share a process by default. A host that needs a stop independent of the runtime, or a crash or leak confined to one session, chooses isolated placement on the runtime instance it opens sessions from (default instances are module level, so their sessions join one pool per host process). Session members stay the same; what `dispose`, the abort fallback and `resources()` guarantee differs by placement and is declared. Five rules: 1. Share only when process-level settings match (executable and arguments, environment overlay, home and configuration directories); per-session protocol state does not split the pool where evidence shows it stays per session. 2. The fallback releases the session instead of killing the process: OAR records a release (its own fact, like an exit); a release after the turn's accepted abort or dispose reads `aborted`, as an exit does in isolated placement; no native outcome is invented, later frames are still recorded, later controls are refused. Shared dispose records the same release. 3. Ending a session stops only what it started, through the runtime's per-session cleanup addressed by runtime ids, never the OS process tree. Failed cleanup is recorded, never reported as stopped. The native session is released where the runtime can, otherwise declared. Codex `thread/archive` is not used, because a resume would need unarchive, which OAR never does. 4. One fault ends every session in the pool, each with its own exit record; a shared process is not restarted or replaced while sessions run in it. 5. A runtime version shares only with evidence on each platform: concurrency; isolation of messages, cwd, MCP servers and child-session attribution; cancellation that leaves peers running; per-session cleanup; resuming a loaded session; failure cases; and lower memory without higher CPU. No runtime meets this yet (the 2026-10-28 report is Linux only and has no failure cases), so today every runtime stays one process per session. Claude, Qwen, Qoder and Pi RPC are always isolated. `liveness.md` records that a release settles waiting folds as an exit does; the record stream spec gains the record when sharing ships. Two subagent review passes. The first found blocking problems in the earlier text (archive as cleanup contradicting "OAR never unarchives"; "failed and detached" inventing an outcome; overstated ACP ratios and contract claims; a gate weaker than the report's own boundary); all are fixed. The second confirmed the fixes and its remaining points are applied. Design text only; implementation tasks follow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Cindy <[email protected]> Co-authored-by: Claude Opus 5.5 <[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.
Shared native sessions can substantially reduce process RSS, but turn cancellation does not prove that tool processes stopped. Add reproducible Linux measurements and lifecycle probes covering isolated Codex/Claude/Kimi/Qwen/Qoder sessions and shared Codex/Kimi/Grok/OpenCode/Antigravity sessions, using only local model providers.
The report separates Codex interrupt, native command termination and archive/unarchive behavior; records Grok's need for session-owned host terminal disposal; and preserves failed assertions and fixture mistakes. It includes all 43 resource cohorts, repeated Codex interruption cases, ACP cwd/MCP/message isolation controls, and the limits of RSS and startup-window sampling. No product process policy or public API changes.
Validation:
CI=1 pnpm run checkpassed (2,219 unit tests and 19 mock behavior cases). Native probes ran on the versions recorded in the report; final script smoke checks passed for Codex interruption and Grok shared resources. Codex's original two-second tool-stop expectation intentionally fails without explicit cleanup, with evidence retained and explained.