GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(opencode): revert from the first removed assistant message by maria-rcks · Pull Request #9924 · pingdotgg/t3code

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Sep 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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 its reverted history until the next prompt.

verified with all 108 opencode adapter tests, server typecheck, and scoped lint and formatting checks. the existing mock follows native inclusive revert semantics, including shared user-message boundaries and consecutive rollbacks.

opencode adapter: 108 tests passed on the final head

fixes #2789.

implemented with gpt-6-astra in codex.


Note

Medium Risk
Changes rollback/read semantics for OpenCode threads and adds a session.get on every readThread; callers that assumed pre-revert thread shape after rollback may see fewer turns.

Overview
Fixes OpenCode thread rollback so it matches native revert semantics instead of slicing messages locally or reverting to the last kept assistant turn.

readThread now loads session metadata and stops listing assistant turns at session.revert.messageID, because OpenCode keeps reverted messages in the transcript until the next prompt.

rollbackThread derives the revert target from the current snapshot: the assistant turn at index length - numTurns (the first turn being removed). It always calls session.revert with that message ID, then re-reads the thread so a boundary that lands on the preceding user message is reflected. When there is nothing to revert, it returns the snapshot without calling revert.

Tests extend the runtime mock to expose revert.messageID on session.get and simulate inclusive revert behavior, with broader coverage for numTurns, consecutive rollbacks, and shared user-message boundaries.

Reviewed by Cursor Bugbot for commit 0c7358f. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix OpenCodeAdapter rollback to revert from first removed assistant message

  • Updates the OpenCode runtime test double to model native revert as a persisted session boundary reported by session.get, instead of deleting messages immediately
  • Adds test cases covering zero through three requested turns, repeated rollback/readback, a shared user-message boundary, and an empty thread
  • Fixture now includes user messages and assistant parts so the mock can determine the native revert boundary
  • Risk: session.revert in the mock now requires a message ID and fails without one; calls without parts no longer truncate the mock message list directly

Macroscope summarized 0c7358f.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@maria-rcks
fix(opencode): revert from the first removed assistant message
1e5f04c
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 5, 2026
cursor[bot]
cursor Bot reviewed Sep 5, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1e5f04c. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/server/src/provider/Layers/OpenCodeAdapter.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@macroscopeapp

macroscopeapp Bot commented Sep 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 0c7358f

Macroscope's review found this PR approvable — This is a focused OpenCode rollback bug fix that preserves existing APIs while correcting native revert-boundary handling and returning the actual retained turns. The production change is confined to the adapter and is covered by detailed rollback tests.

You can add or adjust custom eligibility rules. Learn more.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maria-rcks
fix(opencode): honor existing native revert boundaries
433ff2a
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 5, 2026
View reviewed changes
@maria-rcks
fix(opencode): return the actual native rollback snapshot
0c7358f
@macroscopeapp
macroscopeapp Bot dismissed their stale review September 5, 2026 05:39

Dismissing prior approval to re-evaluate 0c7358f

macroscopeapp[bot]
macroscopeapp Bot approved these changes Sep 5, 2026
View reviewed changes
@maria-rcks
maria-rcks merged commit 4ca7146 into pingdotgg:main Sep 5, 2026
24 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@patroza patroza mentioned this pull request Sep 5, 2026
merge: sync upstream through f8b4c464b4 (classic-merge) patroza/t3code#453
Merged
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 5, 2026
@github-actions
nightly: 0.0.39-nightly.20260905.1290
0df0f7d
## What's Changed
* fix(web): align tool disclosure chevrons with expanded state by @maria-rcks in pingdotgg/t3code#9935
* fix(antigravity): distinguish session initialization auth failures by @maria-rcks in pingdotgg/t3code#9919
* fix(cursor): cache successful model discovery between refreshes by @maria-rcks in pingdotgg/t3code#9918
* fix(opencode): revert from the first removed assistant message by @maria-rcks in pingdotgg/t3code#9924
* fix(web): resume imported custom-provider threads by @juliusmarminge in pingdotgg/t3code#10184
* test(web): cancel pending highlight fixture frames during cleanup by @juliusmarminge in pingdotgg/t3code#10188


**Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260905.1289...v0.0.39-nightly.20260905.1290

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.39-nightly.20260905.1290
@rynfar rynfar mentioned this pull request Sep 6, 2026
fix(opencode): retain the correct history after rollback pylon-code/pylon#292
Merged
This was referenced Sep 10, 2026
fix(server): bound OpenCode CLI probes and serialize inventory opencoredev/akeru-bot#205
Merged
fix(server): stop OpenCode child sessions and route their approvals opencoredev/akeru-bot#210
Merged
fix(opencode): revert from the first removed assistant message opencoredev/akeru-bot#212
Merged
leoisadev1 added a commit to opencoredev/akeru-bot that referenced this pull request Sep 13, 2026
@leoisadev1
fix(opencode): revert from the first removed assistant message (#212)
60f601f
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.
@Nurozen Nurozen mentioned this pull request Oct 8, 2026
fix: integrate upstream checkpoint d0f855bfa91b Nurozen/lecturn#115
Merged
henrik092 pushed a commit to henrik092/t3code that referenced this pull request Nov 2, 2026
@maria-rcks
fix(opencode): revert from the first removed assistant message (pingd…
4b7510e
…otgg#9924)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: session.revert fails with 400 'Expected object, got undefined' when rolling back all assistant turns

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@maria-rcks
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.