shell() doesn't await SessionRevert.cleanup() #7625

Closed
opened 2026-02-16 18:07:46 -05:00 by yindo · 1 comment
Owner

Originally created by @noamzbr on GitHub (Jan 26, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

In session/prompt.ts, the shell() function calls SessionRevert.cleanup(session) without await, while prompt() correctly awaits it. This causes a race condition where operations immediately after shell() see stale revert state.
Fix: Add await at line 1352:

if (session.revert) {
  await SessionRevert.cleanup(session)  // missing await
}

Plugins

No response

OpenCode version

v1.1.31

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

MacOs 15.7.3

Terminal

Ghostty

Originally created by @noamzbr on GitHub (Jan 26, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description In `session/prompt.ts`, the `shell()` function calls `SessionRevert.cleanup(session)` without `await`, while `prompt()` correctly awaits it. This causes a race condition where operations immediately after shell() see stale revert state. Fix: Add `await` at line 1352: ```typescript if (session.revert) { await SessionRevert.cleanup(session) // missing await } ``` ### Plugins _No response_ ### OpenCode version v1.1.31 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System MacOs 15.7.3 ### Terminal Ghostty
yindo added the bug label 2026-02-16 18:07:46 -05:00
yindo closed this issue 2026-02-16 18:07:46 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 26, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10287: Critical bug revert undo messages - Files revert to old/stale state instead of message's previous state
  • #10589: [CRITICAL] Snapshot .nothrow() causes silent data loss — /undo and /redo revert files to stale content (Windows) - Related race condition with missing awaits in snapshot tracking
  • #7775: Unrevert from subdirectory overwrites files in other directories with stale versions - Related stale revert state issue

All three issues share the same root cause: race conditions or missing awaits causing stale revert state, where operations after session cleanup see old state instead of current state.

Feel free to ignore if your specific case addresses a different aspect of this issue.

@github-actions[bot] commented on GitHub (Jan 26, 2026): This issue might be a duplicate of existing issues. Please check: - #10287: Critical bug revert undo messages - Files revert to old/stale state instead of message's previous state - #10589: [CRITICAL] Snapshot `.nothrow()` causes silent data loss — `/undo` and `/redo` revert files to stale content (Windows) - Related race condition with missing awaits in snapshot tracking - #7775: Unrevert from subdirectory overwrites files in other directories with stale versions - Related stale revert state issue All three issues share the same root cause: race conditions or missing awaits causing stale revert state, where operations after session cleanup see old state instead of current state. Feel free to ignore if your specific case addresses a different aspect of this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7625