Skip to content

fix(codex): keep sessions open on a refused name and start in the session directory - #627

Merged
stamp-build[bot] merged 1 commit into
mainfrom
agent/cindy/codex-name-cwd
Nov 5, 2026
Merged

stamp-build[bot] merged 1 commit into
mainfrom
agent/cindy/codex-name-cwd

Conversation

@stamp-build

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

Copy link
Copy Markdown
Contributor

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


Two Codex fixes Raft needs to move Codex onto OAR (task #166).

  • A refused thread name no longer fails the open. The name is display only, and older app-servers lack thread/name/set, so every start on them failed. Codex's error is now recorded as a thread/name/set/error frame with no events and the session opens. A lost connection while naming still fails.
  • The app-server starts in SessionOptions.cwd. It ran in the host's directory, so stdio MCP servers and a relative CODEX_HOME resolved there.

Behaviour change: a session directory that does not exist now fails the open with Codex session directory does not exist. Codex 0.163.0 accepted that open before. Without the new message, the spawn reports ENOENT with the executable's name.

Validation: unit regressions for the recorded refusal, the lost connection, the spawn directory and the missing directory. A native vendor case on Codex 0.163.0 opens and prompts with a CODEX_HOME relative to the session directory. The native name refusal was not exercised, because I have no app-server without the method; the unit fixture replies -32601.

pnpm run check passed typecheck and lint; in the full suite, tests/process-resources.test.ts failed once under load and passed when run alone, and it does not touch this change.

Source: #oar-raft:3a629875 items 3 and 7.

🤖 Generated with Claude Code

@stamp-build
stamp-build Bot merged commit 5e6658d into main Nov 5, 2026
37 checks passed
@stamp-build
stamp-build Bot deleted the agent/cindy/codex-name-cwd branch November 5, 2026 09:41
stamp-build Bot added a commit that referenced this pull request Nov 5, 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_b6cea2eb70db20fefc1fe4212bbebdaf"><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 -->

Patch release: a host can use its own, newer Pi executable, Pi sessions recover from a refused prompt, and two Codex startup problems are fixed.

## Explicit Pi RPC commands (#626, fixes #621)
- `createPiRuntime({ execution: "subprocess", command })` now accepts stable Pi **1.4.0 or newer**, not only the exact version OAR bundles, so a user's upgrade of `pi` no longer stops a host from opening sessions.
- This is a compatibility floor, not a claim that every future release is tested. Native controls passed on explicit 1.4.0 and 1.5.0 on Linux x64; older explicit versions are unverified on macOS and Windows.
- A missing, unparsable or older version throws `RuntimeFailureError` with `failure: "invalid_request"`, naming the actual and required versions. It was a plain `Error` before.
- The default path without `command` still requires OAR's exact bundled Pi.

## Pi SDK and RPC recovery (#617)
- A prompt Pi refuses before starting no longer strands queued input: the refusal is recorded and the queue drains.
- A cancellation requested for a refused prompt no longer ends the next run.
- On RPC, an abort during the terminal statistics window no longer kills a healthy child about 10 seconds later.
- On SDK, disposing during pending admission now answers `disposed`, and a late failure cannot settle a later run started by an extension.

## Codex startup (#627)
- A refused thread name no longer fails the open. Older app-servers lack `thread/name/set`, so every start with a `name` failed on them. Codex's error is now recorded as a `thread/name/set/error` frame with no events; a lost connection still fails.
- The app-server now starts in `SessionOptions.cwd` rather than the host's directory, so stdio MCP servers and a relative `CODEX_HOME` resolve there.
- **Behaviour change:** a session directory that does not exist now fails the open with `Codex session directory does not exist`. Codex 0.163.0 accepted that open before.

## Documented limits
- Synchronous next prompt from a `turn_ended` observer stays unsupported on Pi SDK and RPC: status can read `idle` while `prompt` returns `busy`. Submit after the observer returns. The reasoning and what would reopen it are in `docs/design/decisions.md`.
- Extension-handled input can leave status provisionally `running` with no native run; the gate itself still accepts the next input.

🤖 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 5, 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_04ba216a4e248f6de33c6afee827ef5f"><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 -->

`codex-session-name.vendor.test.ts` from #627 fails on Windows while removing its session directory (`EBUSY: resource busy or locked, rmdir`): the app-server now runs in that directory, and Windows holds it briefly after the process exits. This is on main, so it can fail the release gate. Test only: retry the removal.

Passes locally on Linux; Windows is checked by this PR's CI. Not established: whether the delay is only the handle closing or something else outliving the process.

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

Co-authored-by: Cindy <[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