Skip to content

fix(tui): restore skill turns through undo and redo #48484

Closed as not planned
Closed as not planned

Description

@hammershock

Outcome

TUI /undo, the undo shortcut, message Revert, and /redo correctly stage, advance, and clear rollback state for canonical Session V2 turns containing structured $skill mentions. Restored composer input preserves the structured mention when the exact Skill is still available and reports the existing actionable error when it is not.

Governing RFC

RFC-0012, especially “$skill structured mention” and its requirement that undo/history restore rebuild or remove the bound extmark. This is a bug fix restoring accepted behavior, not a new product decision.

In scope

  • Route undo/redo to Session V2 revert APIs when the rollback boundary is a canonical message.
  • Read canonical revert state consistently for command availability and execution.
  • Restore structured skill/file/agent prompt state through the canonical restoration path.
  • Preserve legacy undo/redo behavior for legacy-only turns.
  • Add regression coverage for canonical skill undo/redo routing and prompt restoration.

Out of scope

  • Changing Session V2 revert semantics or durable schemas.
  • Changing Skill catalog admission or snapshot format.
  • Migrating all ordinary TUI prompts from the legacy Session API.
  • Changing Web/Desktop behavior.

Dependencies

None.

Contracts and likely areas

  • packages/tui/src/routes/session/index.tsx
  • packages/tui/src/routes/session/dialog-message.tsx
  • packages/tui/src/util/session-message.ts
  • TUI command/session tests
  • Existing Session V2 revert.stage, revert.clear, and revert.commit contracts remain unchanged.

Acceptance checks

  • Undoing the newest canonical $skill user turn stages its canonical message ID and restores the structured Skill mention in the composer.
  • Repeated undo advances to the preceding user boundary without crossing storage models incorrectly.
  • Redo uses canonical staged state and either advances the boundary or clears it at the end.
  • A canonical Skill no longer available in the active catalog produces the existing actionable error and does not stage a revert.
  • Legacy-only turns retain existing undo/redo behavior.
  • Failures are surfaced instead of becoming successful no-ops.

Verification

  • Package-local TUI unit tests and typecheck.
  • Relevant Core Session V2 revert tests.
  • Mac real-device TUI: create a temporary Session, submit a $skill turn, exercise message Revert, /undo, repeated undo, and /redo; capture screenshot/log evidence.
  • mywindows/WSL2 real-device TUI through opencode-rexd: repeat the same temporary Session scenario against the same commit; capture screenshot/log evidence.

Risks and compatibility

  • Incorrect V1/V2 routing could delete or hide the wrong transcript boundary; tests must cover mixed legacy/canonical timelines and repeated undo/redo.
  • Composer reconstruction must never expose embedded Skill instruction bodies.
  • No generated API/SDK artifacts are expected.

Activity

  1. hammershock commented on Sep 11, 2026

    @hammershock
    Author

    Claimed for implementation on branch skill-undo, based on eead763fdf5fb91f383561b9df85330b3b43f6e9. Worktree: ~/workspace/opencode-worktrees/skill-undo.

  2. github-actions commented on Sep 11, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This issue does not use one of the required issue templates (Bug Report, Feature Request, or Question). It appears to use an internal RFC/spec format instead.
    • A Bug Report template requires a Description field with real content, reproduction steps, environment info, expected vs. actual behavior.
    • A Feature Request template requires a verification checkbox, description of the problem/need, and a title starting with [FEATURE]:.
    • A Question template requires the Question field with real content.
    • The title uses a commit message format (fix(tui): ...) rather than a descriptive issue title.

    Please edit this issue to use one of the standard templates and address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. hammershock commented on Sep 11, 2026

    @hammershock
    Author

    Opened in the wrong repository by mistake; closing immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions