Repository navigation
Description
What happens
With OpenCode 2, a background-work note (OpenCode's synthetic <shell> report) that arrives just as the model finishes its answer is delivered as a steer into the same execution. The model replies to it ("the server I used has stopped"), that reply becomes the run's last assistant message, and the timeline folds the real answer, often screenshots or file paths, into "Worked for …". On mobile the thread then shows only the reply to the note.
If the same note arrives a moment later, after the execution ended, it wakes the session, T3 opens a new run with a notification row, and the answer stays visible. So whether the answer is hidden comes down to timing.
Steps to reproduce (0.1.10-nightly.20261115.4736, OpenCode 2.3.0)
- In an OpenCode thread, have the agent start a background server, stop it in a way that lets it exit on its own (a stop file,
docker stop), keep working for ~10 s, then give its final answer. - The server's note is admitted while the execution is still running (we've seen it 16 ms after the answer finished), and OpenCode promotes it at the step boundary after the final text, in the same execution.
- The model answers the note. The thread shows that reply; the answer is folded.
Seen 2/2 with GPT-5.6 Sol (touch stop; sleep 10) and 1/1 with a scripted backend, plus in real use. With a 7–8 s pause the note landed just after the run instead and opened a new run, as described above.
Cause (main e65a790, same in 4736)
packages/provider-opencode/src/server/v2/adapter.ts:3369: asession.inbox.deliveredfor a report in the active turn only deletes the report and emits nothing. A note that wakes an idle session goes throughofferWake/backgroundWorkNotificationand gets a notification row and its own run.apps/web/src/components/chat/MessagesTimeline.logic.ts:deriveTerminalAssistantMessageIdskeeps one terminal assistant message per run andderiveTurnFoldsfolds by run, so even a notification row inside the same run wouldn't split the fold. Only an assistant message withphase: "final_answer"survives (retainedAssistantReplyEntryIds, line 771). Mobile has the same rule (finalAnswerIdsinapps/mobile/src/lib/threadActivity.ts).
We replayed the thread items through 4736's own timeline logic: without a change the answer folds in every tool-visibility mode on web and mobile; a same-run notification row alone doesn't help; the row plus final_answer on the answer shows answer, row and reply.
Possible fixes (either)
- Adapter: when a report is delivered into the active turn and the turn's newest item is a completed assistant message, emit the same
backgroundWorkNotificationitem a wake gets, in that run, and re-emit the message withphase: "final_answer"so the existing retention rule keeps it. Small, OpenCode only. - Clients: treat a
notificationitem inside a run like a steer inderiveTurnFolds(start a segment there) and keep each segment's last assistant message visible, on web and mobile. Covers any provider that injects notices into a running turn.
We run option 1 locally as a server preload and can share it.
Activity