fix(opencode): revert from the first removed assistant message - #212
Conversation
OpenCode rollback used the last retained message and omitted the required id when removing all turns. Target the first removed assistant message and read back the native revert boundary, including when multiple assistant messages share a preceding user message. OpenCode keeps reverted history until the next prompt. Adapted from pingdotgg#9924. Made with Grok 4.6 High in Grok Build via Orca.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis update corrects OpenCode rollback handling by targeting the assistant message being removed and reading the transcript only through OpenCode’s native revert boundary. Focused coverage documents zero-through-three-turn rollback behavior, repeated rollbacks, shared user boundaries, and empty threads. Confidence Score: 5/5Safe to merge. No outstanding issues require follow-up. Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
|
This is Leo's agent. Independent integration diagnosis against actual main b9b6d23 and PR head 493d2cb finds exactly one conflict, in docs/internals/providers.md. Preserve both adjacent paragraphs: main's bounded OpenCode discovery and serialized inventory description, followed by this PR's first-removed-assistant rollback and native revert-boundary description. These describe separate behavior; neither should be discarded. No implementation file conflicts in the merge-tree result. Existing rollback code acceptance remains provisional until this integration is pushed, focused adapter tests are rerun, and fresh exact-head Greptile and required Repository checks pass. Worker delivery and repair execution remain unverified because the authorized Orca CLI is unavailable. |
…oundary # Conflicts: # apps/server/src/provider/Layers/OpenCodeAdapter.test.ts # docs/internals/providers.md
Problem
OpenCode rollback used the last retained assistant message and omitted the required id when removing every turn. Native revert is inclusive of the targeted message, and OpenCode keeps reverted history until the next prompt, so the adapter could leave extra turns or fail the revert.
Adaptation
Target the first removed assistant message, always send its id to
session.revert, and read the native revert boundary back fromsession.get.readThreadstops atsession.revert.messageIDinstead of slicing the local transcript. OpenCode Go stays on Mastra.Upstream
Adapted from pingdotgg/t3code#9924.
Scope
apps/server/src/provider/Layers/OpenCodeAdapter.tsdocs/internals/providers.mdIndependent of child-session abort (#210) and CLI probes (#205).
Verification
vp test run apps/server/src/provider/Layers/OpenCodeAdapter.test.ts— 33 tests passed, including zero through three requested turns, consecutive rollbacks, a shared user-message boundary, and an empty thread.No live OpenCode CLI or browser pass: this is adapter protocol behavior covered by the recorded mock.
Made with Grok 4.6 High in Grok Build via Orca.