Repository navigation
Description
Summary
A live production turn failed with:
session.execution.failed
error: { type: "unknown", message: "reasoning start before end: rs_0b8a8fd5e8c6a27e016a564fcbe6b481918eb0f7408aa4d6d7:0" }
The LLM event publisher enforces at most one open reasoning fragment (fragments("reasoning", ..., single = true) in packages/core/src/session/runner/publish-llm-event.ts). The OpenAI Responses adapter emitted a reasoning-start while a prior reasoning fragment was still open, and the publisher terminated the entire execution with an untyped defect.
Evidence
Session ses_09f05df32ffewmX7otmzvMPbKb (next channel), 2026-07-14:
15:03:40 session.step.started openai/gpt-5.6-sol, variant high
15:03:40-15:03:52 two reasoning parts durably started and ended
15:03:52 session.execution.failed unknown: reasoning start before end: rs_...:0
The turn had very high context pressure (~365k cached input tokens); auto-compaction ran on a later turn. The raw provider stream was not retained, so whether OpenAI emitted overlapping reasoning summary parts or the adapter derived overlapping normalized fragment ids is not determinable after the fact (adjacent to the diagnostics gap in #36766).
Where
packages/llm/src/protocols/openai-responses.tskeys reasoning fragments as${itemID}:${summaryIndex}, opening:0atoutput_item.addedand additional fragments per summary part. Some interleaving (for example a second reasoning item added before the first item's open fragment concludes) can producereasoning-startwhile another fragment is open.packages/core/src/session/runner/publish-llm-event.tsresponds to that withEffect.die, so one malformed fragment boundary fails the whole execution asunknowninstead of a typed provider error.
Suggested Direction
- Adapter invariant: the OpenAI Responses lifecycle should always emit
reasoning-endfor the open fragment before starting the next one. Audit multi-item and multi-summary-part transitions. - Publisher degradation: on an overlapping
reasoning-start, close the open fragment (preserving its accumulated text) and continue, or fail with a typedprovider.invalid-outputerror instead of dying asunknown. A reasoning boundary defect should not be indistinguishable from an internal crash. - Regression test: publisher receiving
reasoning-start(a),reasoning-start(b)withoutreasoning-end(a)must not produce an untyped execution failure.
Activity
opencode-agent commentedon Aug 28, 2026
Addressed by #45789. OpenAI Responses now closes the previous reasoning fragment before opening a new summary part, normalizes missing and delayed item boundaries, and turns genuinely overlapping distinct reasoning items into typed invalid-provider-output failures rather than internal defects. Focused lifecycle regressions cover the reported start-before-end sequence. Closing as resolved on the v2 branch.