Bug
When an LLM stream is interrupted after tool-input-start but before tool-call or step-finish arrives, the assistant message is left in an inconsistent state:
assistantMessage.error is set correctly
- Tool parts are correctly marked
error / Tool execution aborted / interrupted
- But
assistantMessage.finish is never updated — it retains whatever value it had before the interruption (often undefined in real sessions, or the initial fixture value)
This causes downstream consumers (continuation loops, session exports, UI) to misinterpret the aborted message — either treating it as still in-progress (no finish) or as successfully completed (stale finish value).
Root cause
In packages/opencode/src/session/processor.ts, the halt() function handles terminal errors. The ContextOverflowError + non-auto-compaction branch already sets finish = "error" (line 929), but the general terminal branch that handles all other errors (abort, provider failure, etc.) only sets error without setting finish.
Expected behavior
An assistant message that terminates via halt() should always have finish set to "error", consistent with the existing ContextOverflowError path.
Bug
When an LLM stream is interrupted after
tool-input-startbut beforetool-callorstep-finisharrives, the assistant message is left in an inconsistent state:assistantMessage.erroris set correctlyerror/Tool execution aborted/interruptedassistantMessage.finishis never updated — it retains whatever value it had before the interruption (oftenundefinedin real sessions, or the initial fixture value)This causes downstream consumers (continuation loops, session exports, UI) to misinterpret the aborted message — either treating it as still in-progress (no finish) or as successfully completed (stale finish value).
Root cause
In
packages/opencode/src/session/processor.ts, thehalt()function handles terminal errors. TheContextOverflowError+ non-auto-compaction branch already setsfinish = "error"(line 929), but the general terminal branch that handles all other errors (abort, provider failure, etc.) only setserrorwithout settingfinish.Expected behavior
An assistant message that terminates via
halt()should always havefinishset to"error", consistent with the existingContextOverflowErrorpath.