Skip to content

fix(web): show thread undo notice in the sidebar - #12972

Merged
juliusmarminge merged 6 commits into
mainfrom
thread-undo-sidebar-notice
Sep 22, 2026
Merged

juliusmarminge merged 6 commits into
mainfrom
thread-undo-sidebar-notice

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Thread actions currently stack success toasts over the workspace. Replace them with one compact, rounded notice at the bottom of the sidebar showing the action, thread count, and configured undo shortcut. Consecutive actions of the same kind undo together, and the notice expires five seconds after the latest action.

The notice uses the shared Alert container and InlineButton text action. The shared footer covers both sidebar layouts on web and desktop. The chat route owns the undo shortcut so it also works without an open chat and receives the complete keyboard context. Stale actions disappear immediately, restore failures still report errors, and the existing keybinding guidance matches the new behavior. Mobile uses separate actions and has no corresponding undo toast.

Verification: 139 focused undo and keybinding tests passed; web typecheck passed; targeted lint completed with existing warnings. Verified settle and grouped Undo in the Browser panel against disposable state. The whole-change audit found no remaining code blockers. Current-head CI passed, and CodeRabbit and Macroscope correctness/UI reviews report no actionable issues. Macroscope automatic approval returned neutral because it recommends human review for this behavior change. All five review threads are resolved. The matching captures use base 76cc9b0 and the PR implementation at 1280 × 800.

Before, stacked toasts:

Before: stacked thread undo toasts

After, sidebar notice:

After: compact thread undo notice

Grouped settle and Undo, slowed for readability:

Grouped settle and Undo recording

Implemented with GPT-6 in the Codex harness.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 22, 2026
@juliusmarminge
juliusmarminge marked this pull request as ready for review September 22, 2026 01:09
@github-actions

ghost commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.5 KiB −12 B (−0.1%) 15.1 KiB ✅
Codex Thread snapshot wire 7.0 KiB 7.0 KiB +2 B (+0.0%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.5 KiB 6.5 KiB −14 B (−0.2%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 56.3 KiB 56.3 KiB 0 B (0.0%) 66.4 KiB ✅
Codex Live turn messages 10 10 0 (0.0%) 21 ✅
Claude Total thread wire 13.5 KiB 13.5 KiB +1 B (+0.0%) 15.1 KiB ✅
Claude Thread snapshot wire 7.1 KiB 7.1 KiB 0 B (0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.4 KiB 6.4 KiB +1 B (+0.0%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: 76cc9b0 · PR result: 0649299 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 114.0 KiB
  • Claude decoded thread snapshot: 114.7 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@macroscopeapp

This comment has been minimized.

@macroscopeapp

This comment has been minimized.

@macroscopeapp

This comment has been minimized.

@macroscopeapp

ghost commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — The PR replaces toast-based undo with a new shared sidebar notice, grouped restoration behavior, and revised batch-action handling. These changes affect several existing production paths and introduce a stateful undo manager, so the runtime behavior warrants focused review.

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

@macroscopeapp

This comment has been minimized.

@macroscopeapp

This comment has been minimized.

@macroscopeapp

This comment has been minimized.

@macroscopeapp

ghost commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

UI consistency review found one violation: SidebarThreadUndoNotice overrides the shared Alert primitive’s radius, padding, and base colors instead of using a primitive variant. An inline review comment was added.

Posted via Macroscope — UI Consistency

@macroscopeapp

ghost commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

The UI consistency finding is recorded inline on SidebarThreadUndoNotice.tsx.

Posted via Macroscope — UI Consistency

@macroscopeapp

ghost commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

All clear

Posted via Macroscope — UI Consistency

@coderabbitai

ghost commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 318331a7-3b92-4a1b-b440-f8147ec996c8

📥 Commits

Reviewing files that changed from the base of the PR and between 76cc9b0 and 0649299.

📒 Files selected for processing (14)
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/Sidebar.tsx
  • apps/web/src/components/sidebar/SidebarChrome.tsx
  • apps/web/src/components/sidebar/SidebarThreadUndoNotice.tsx
  • apps/web/src/components/ui/alert.tsx
  • apps/web/src/hooks/showThreadUndoNotice.test.ts
  • apps/web/src/hooks/showThreadUndoNotice.ts
  • apps/web/src/hooks/showUndoToast.test.ts
  • apps/web/src/hooks/showUndoToast.ts
  • apps/web/src/hooks/threadUndo.ts
  • apps/web/src/hooks/useThreadActions.ts
  • apps/web/src/hooks/useThreadActions.undo.test.ts
  • apps/web/src/routes/_chat.tsx
  • docs/user/keybindings.md
💤 Files with no reviewable changes (3)
  • apps/web/src/hooks/showUndoToast.test.ts
  • apps/web/src/hooks/showUndoToast.ts
  • apps/web/src/components/ChatView.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change replaces thread undo toasts with a shared, grouped undo notice. Thread actions publish notices, the sidebar renders them, and the chat route handles the undo shortcut with focus and picker guards.

Changes

Thread undo notices

Layer / File(s) Summary
Undo state and lifecycle
apps/web/src/hooks/showThreadUndoNotice.ts, apps/web/src/hooks/threadUndo.ts, apps/web/src/hooks/showThreadUndoNotice.test.ts, apps/web/src/hooks/showUndoToast.ts, apps/web/src/hooks/showUndoToast.test.ts
Grouped claims now share a Zustand notice, expire after five seconds, and execute eligible restores concurrently. The previous toast module and tests were removed. Tests cover stale claims, expiry, ordering, and restore failures.
Thread action integration
apps/web/src/hooks/useThreadActions.ts, apps/web/src/components/Sidebar.tsx, apps/web/src/hooks/useThreadActions.undo.test.ts
Archive, unpin, settle, and snooze publish shared notices. Settlement and snooze no longer accept undoToast options. Bulk snooze reports failures only. Tests now inspect notice state instead of toast actions.
Sidebar notice and shortcut handling
apps/web/src/components/sidebar/SidebarThreadUndoNotice.tsx, apps/web/src/components/sidebar/SidebarChrome.tsx, apps/web/src/components/ui/alert.tsx, apps/web/src/routes/_chat.tsx, apps/web/src/components/ChatView.tsx, docs/user/keybindings.md
The sidebar footer renders a shortcut-aware undo notice. The chat route handles thread.undo and ignores repeated events or an open model picker. ChatView no longer handles the shortcut. Documentation describes grouped actions and the five-second notice window.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ThreadAction
  participant ThreadUndo
  participant SidebarThreadUndoNotice
  participant undoLatestThreadAction

  User->>ThreadAction: archive, unpin, settle, or snooze
  ThreadAction->>ThreadUndo: claim action
  ThreadUndo->>SidebarThreadUndoNotice: publish grouped notice
  User->>SidebarThreadUndoNotice: click Undo
  SidebarThreadUndoNotice->>undoLatestThreadAction: start latest group
  undoLatestThreadAction->>ThreadUndo: consume eligible claims
  ThreadUndo-->>ThreadAction: restore actions
Loading

Suggested reviewers: saphid, t3dotgg, maria-rcks

Merge Risk: ⚪ Minimal · up to 06492

No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 10 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: adding a thread undo notice to the web sidebar.
Description check ✅ Passed The description clearly explains the changes, rationale, UI behavior, screenshots, recording, testing, and review status. It does not reproduce the template headings or checklist, but it contains the …
Full details: Docstring Coverage

Explanation

Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 10 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@juliusmarminge

ghost commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

Reviewed the CodeRabbit docstring coverage warning. This repository does not enforce a docstring percentage; its AGENTS.md asks comments to explain usage and non-obvious constraints rather than narrating code. The undo helpers already document shared ownership, grouping, claim consumption, and expiry. No additional docstring churn is needed. The current-head CodeRabbit review reports no actionable findings.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant