Skip to content

fix(codex): report native reconnects as retry; add no stderr or OOM option - #647

Merged
stamp-build[bot] merged 2 commits into
mainfrom
agent/cindy/stderr-oom
Nov 6, 2026
Merged

stamp-build[bot] merged 2 commits into
mainfrom
agent/cindy/stderr-oom

Conversation

@stamp-build

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

Copy link
Copy Markdown
Contributor

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


Codex now reports a native reconnect as the existing retry event, and the repo records why OAR is not adding the stderr and OOM options Raft asked for (task #170).

Change: error with willRetry: true projects to retry, with the native message and details as reason. attempt is OAR's count within that thread's turn, because native states it only in display text. maxAttempts is absent for the same reason. An error without willRetry behaves as before. Hosts see new retry events on Codex, and status reads waiting_model on them, as it does for Pi.

Not added: SessionOptions.recordStderr and oomScoreAdj. I accepted both on 11-05 and today, and tygg challenged whether a host needed them. Probed on real Codex with a scripted provider, Linux x64:

  • A dropped stream on 0.163.0 and 0.167.0 sends the notification above and writes no stderr line. The signal Raft wanted from stderr was in the protocol.
  • A tool argument that is not JSON (0.167.0) or has the wrong type (0.163.0, 0.167.0) logs one stderr line and goes back to the model, and the turn completes. The original report of a quiet turn (Codex 0.153.4) has no surviving session, so this does not explain it.
  • A host-owned installation.command wrapper with exec choom -n 500 put the Codex 0.167.0 launcher, native binary, MCP server and tool command at 500, with no window and no new interface. The /proc/self/oom_score_adj form in the docs was checked in sh only, not with Codex.

docs/design/decisions.md has the reasoning and what would reopen it, docs/spec/runtime-matrix.md#process-priority has the wrapper, and experiments/codex-native-signals/ has the probe.

Validation: typecheck, lint, 3,532 unit tests and 18 mock cases on Linux. The new vendor case passes on Codex 0.163.0 and 0.167.0. Windows and macOS await this PR's CI.

🤖 Generated with Claude Code

Cindy and others added 2 commits November 6, 2026 02:42
…ption

A dropped model stream sends an error notification with willRetry, on 0.163.0
and 0.167.0, and writes nothing to stderr. It is now the existing retry event.

Raft asked for a stderr channel and an OOM score option. Neither is added: a
stderr channel makes every host parse log text, and a host-owned command wrapper
sets the score before exec. The decision and its evidence are in the repo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@stamp-build
stamp-build Bot merged commit 7c5c4af into main Nov 6, 2026
40 checks passed
@stamp-build
stamp-build Bot deleted the agent/cindy/stderr-oom branch November 6, 2026 03:03
stamp-build Bot added a commit that referenced this pull request Nov 6, 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_6c85698ce54612453d4cc181805b01b8"><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 can send an `agentMessage` with completed text and no text deltas.
OAR previously lost that reply. The completion frame now contributes its
full text once when no nonempty delta was observed for that native
thread, turn and item. Streamed replies are not repeated, and a partial
stream is not extended by guessing a suffix.

This also preserves native message phase as optional `text_delta.phase`,
and MCP server/tool names as optional `tool_call_started.server` and
`toolName`, keeping `tool: "mcpToolCall"`. Coalescing preserves phase
boundaries. The exact native `unauthorized` error tag maps to `auth`
without inventing HTTP status or credential details. That tag is
confirmed in Codex 0.167.0's generated protocol, not in an induced
account failure: the local provider's SSE error with the same name
produced native `other` and remains `unknown`.

Replay changes are explicit: the old subagent snapshot gains text on
three existing completion frames; the old steer recording now asserts
its three commentary messages and final-answer phase. New native message
fixtures and MCP metadata snapshots pin the additional fields. Native
bodies stay intact. The [probe and
evidence](https://github.com/botiverse/oar/blob/agent/otter/codex-projection/experiments/codex-projection/README.md)
include reproduction commands and protocol hashes.

Validation on Linux:

- New native message regressions failed before the fix and pass with
Codex 0.167.0. All 75 Codex vendor checks and all 15 behavior backends
pass, including stdio/HTTP MCP calls and resume.
- Eleven isolated reversions are detected by their regression tests:
fallback, duplicate suppression, phase learning, thread/turn scope,
empty deltas, coalescing, MCP names and unauthorized mapping.
- Full check (3,559 unit tests and 18 mock behavior cases), build and
clean packed-package consumption pass. The full check and Codex vendor
suite also pass after rebasing over #647.

Windows and macOS native results await this PR's CI. Task #171, targeted
for 0.89.0.

---------

Co-authored-by: Otter <[email protected]>
@stamp-build stamp-build Bot mentioned this pull request Nov 6, 2026
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]>
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