GeezerVison is showing github.com — fix(server): point Claude resume cursor at reverted transcript by maslinedwin · Pull Request #7198 · pingdotgg/t3code
Conversation
maslinedwin
commented
Aug 16, 2026
•
edited by macroscopeapp
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #6127
What changed
Revert already restored files and trimmed the visible timeline, but the next Claude turn still saw the discarded prompts. rollbackThread left lastAssistantUuid on the reverted leaf, updateResumeCursor wrote that leaf back as resumeSessionAt, and the SDK query was started with resume only.
After rollback the adapter now:
- recomputes
lastAssistantUuid from the last retained parent assistant uuid (or clears it when nothing remains)
- persists that cursor, with
pinResumeSessionAt set only for the post-revert resume
- passes
resumeSessionAt to the SDK on the next start, and recreates the live query on the next sendTurn, so the model resumes at the retained transcript
Ordinary resume is unchanged: a cursor that still carries resumeSessionAt without the pin still starts with options.resumeSessionAt === undefined, which is the stale-checkpoint guard.
Verification
CI=true vp test run apps/server/src/provider/Layers/ClaudeAdapter.test.ts # 71 passed
CI=true vp test run apps/server/src/provider/Layers/ProviderService.test.ts # 29 passed
Model: grok-4. Harness: T3 Code / Grok Build.
Note Medium Risk
Changes conversation rollback and SDK resume semantics in the Claude provider path; behavior is well-covered by new tests but affects core thread continuity after revert.
Overview
Fixes a bug where conversation rollback trimmed the UI timeline but the next Claude turn still resumed from discarded transcript state.
Claude adapter: rollbackThread now recomputes lastAssistantUuid from retained turns (per-turn lastAssistantUuid), sets pinResumeSessionAt on the resume cursor, and defers replacing the live SDK query until the next sendTurn via replaceQueryAfterRollback. That restart passes resume + resumeSessionAt only when a checkpoint remains; otherwise it starts a fresh sessionId. Late frames from the old query are ignored while the query is stale. Recreated queries carry current model/permission options from stored queryOptions. Normal resume still omits resumeSessionAt unless pinResumeSessionAt is set.
Provider service: After rollback, session bindings are upserted from listSessions so persisted state matches the new cursor.
Tests extend the Claude adapter harness (fresh query per createQuery) and add rollback/resume coverage.
Reviewed by Cursor Bugbot for commit d0c6b93. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix Claude resume cursor to point at the last retained assistant turn after rollback
- After
rollbackThread, the adapter now pins the resume cursor to the lastAssistantUuid of the last retained completed turn, so subsequent sendTurn/startSession calls resume at the correct checkpoint.
- Introduces
replaceQueryAfterRollback in ClaudeAdapter.ts, which shuts down the old prompt queue and query, then either resumes at the pinned assistant uuid or starts a fresh session when no checkpoint remains.
- Mid-session model and permission mode are preserved across rollback-induced query replacement via new
queryOptions and currentPermissionMode fields on ClaudeSessionContext.
- Late SDK messages and assistant frames from a discarded post-rollback stream are ignored via the new
isStaleRollbackQuery predicate, preventing stale frames from corrupting session state.
ProviderService.rollbackConversation now upserts the updated session binding (including the new resume cursor) into the directory after rollback.
- Behavioral Change: the first
sendTurn after a rollback triggers a query restart rather than continuing on the old stream.
Macroscope summarized d0c6b93.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Pascaltib and effektsvk reacted with thumbs up emoji
Revert restored files and the timeline, but Claude still resumed at the
reverted leaf. Recompute lastAssistantUuid from retained turns, pin
resumeSessionAt only for that post-rollback resume, and persist the
updated cursor so the next start does not keep the discarded transcript.
coderabbitai
Bot
commented
Aug 16, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Important
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 16be542a-a7a2-453e-975e-097920e3f7cf
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Needs human review
This bug fix introduces significant new state management logic for Claude rollback handling, including a new query replacement mechanism (~80 lines), multiple new state flags, and changes to event handling across the adapter. The cross-cutting nature of these session lifecycle changes warrants human review despite comprehensive test coverage.
You can customize Macroscope's approvability policy. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
A late assistant event from the old query could overwrite the pinned
resume cursor before the replacement query started. Freeze that cursor
until the new query is installed, and always replace the live query
after rollback even when no assistant uuid remains.
replaceQueryAfterRollback rebuilt the SDK query from start-session
options, so a mid-session setModel or setPermissionMode was dropped
when sendTurn skipped an unchanged model or omitted interactionMode.
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 high effort and found 1 potential issue.

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0034972. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Claude rejects setPermissionMode(bypassPermissions) unless the query
was created with allowDangerouslySkipPermissions. Preserve that flag
from the session's base mode after a plan rollback.
This was referenced Aug 17, 2026
|
Note: GPT-6 on behalf of shivam (@shivamhwp).
Partial rollback loses the retained history after session recovery. Complete two turns, save the resume cursor, stop and restart the session with that cursor, then roll back one turn. startSession initializes context.turns to [], so lastRetainedAssistantUuid(context.turns) returns undefined. Rollback clears the resume session and the next query starts with a new sessionId, discarding the first turn as well as the reverted second turn.
The retained checkpoint must survive session teardown or be resolved from durable native history before rollback. An empty in-memory turn list on a recovered session does not mean the requested target is the beginning of the conversation. If the target cannot be resolved, fail before changing the workspace or timeline rather than reporting a successful partial revert with a blank provider conversation.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Superseded by #11338 (fix: restore provider history and prompts when rewinding), which landed broader cross-provider rewind history restore including Claude. Closing this Claude resume-cursor-only approach as wash leftover hygiene — reopen if anything unique still needs merging.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:L
100-499 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
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.
|