Skip to content

fix(tui): skip pending undo boundaries - #40130

Open
leizd wants to merge 1 commit into
anomalyco:v2from
leizd:undo-pending-boundary
Open

fix(tui): skip pending undo boundaries#40130
leizd wants to merge 1 commit into
anomalyco:v2from
leizd:undo-pending-boundary

Conversation

@leizd

@leizd leizd commented Aug 2, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #39736

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The V2 TUI displays user inputs as soon as they are admitted, before they are promoted into materialized session history.

During that window, /undo could select the visible pending input as its revert boundary and pass its ID to session.revert.stage. The server could not resolve that ID yet and returned Message not found.

This change excludes admitted-but-unpromoted input IDs when selecting the undo boundary. If the latest visible input is still pending, /undo falls back to the most recent promoted user message. If no promoted user message is available, the existing Nothing to undo behavior is preserved.

The fix is limited to the TUI and does not add any server events or API surface.

How did you verify your code works?

From packages/tui:

  • bun test test/cli/tui/undo.test.ts — 6 passed, 0 failed
  • bun typecheck — passed
  • bun test test/cli/tui/session-rows.test.ts — 15 passed, 0 failed
  • git diff --check — passed

The regression tests cover:

  • selecting the latest promoted user message
  • skipping the latest pending input
  • returning no boundary when all user inputs are pending
  • respecting an existing revert boundary
  • skipping blank user messages
  • selecting a newer promoted message when an earlier message is pending

Screenshots / recordings

Not applicable. This changes undo boundary selection and does not introduce a visual UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@leizd
leizd marked this pull request as ready for review August 2, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant