Skip to content

fix(desktop): restore project to sidebar when resuming session from history, show toast on failure#3603

Merged
esengine merged 1 commit into
esengine:main-v2from
CVEngineer66:fix/history-session-restore
Jun 9, 2026
Merged

fix(desktop): restore project to sidebar when resuming session from history, show toast on failure#3603
esengine merged 1 commit into
esengine:main-v2from
CVEngineer66:fix/history-session-restore

Conversation

@CVEngineer66

Copy link
Copy Markdown
Contributor

Bug

Bug 1: Sessions from a removed project cannot restore the project back to the sidebar

After removing project B from the sidebar, its sessions still appear in the history panel. Clicking to open one -- B does not come back to the sidebar. The user thinks nothing happened and clicks again -- still nothing.

Root cause: OpenProjectTab never calls addProject() to write the project back into desktop-projects.json, nor does it notify the frontend to refresh the project tree.

Bug 2: Session-open failure silently falls back to the wrong tab

Clicking a session whose project no longer exists -- the history panel closes, and the session appears on the current active tab (an unrelated project A). The user has no idea what happened.

Root cause: openProjectTab and openGlobalTab swallow all exceptions with catch { return undefined }. The caller passes undefined to resumeSession(path, undefined), which falls back to activeTabId -- loading the data onto the wrong tab with zero feedback.

Fix

File Change
desktop/tabs.go OpenProjectTab now calls addProject() + emitProjectTreeChanged() -- restores the project to the sidebar and refreshes the tree
useController.ts openProjectTab/openGlobalTab no longer use catch { return undefined } -- exceptions propagate to the caller
App.tsx onResumeSession wraps in try-catch: on failure, shows a toast
lib/toast.tsx New ToastProvider + useToast() -- reusable notification system (3 levels, 2.5s auto-dismiss, stackable, click-to-dismiss)

@github-actions github-actions Bot added desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) skills Skill system (internal/skill, internal/tool) agent Core agent loop (internal/agent, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 8, 2026
…istory, add toast notification system

Three fixes for resuming sessions from the history panel:

1. OpenProjectTab now calls addProject() and emitProjectTreeChanged(), so
   opening a session from a previously removed project automatically restores
   it to the sidebar. No more silent switch to the wrong workspace tab.

2. openProjectTab/openGlobalTab no longer swallow exceptions (catch { return
   undefined }). Errors propagate to onResumeSession which shows a user-facing
   toast instead of silently falling back to the current tab.

3. A reusable ToastProvider + useToast() hook (info/warn/error levels, 2.5s
   auto-dismiss, stackable, click-to-dismiss) is introduced. Used here for
   session-open failures and available to other contributors for notifications.
@CVEngineer66 CVEngineer66 force-pushed the fix/history-session-restore branch from 8a5c159 to 8b20184 Compare June 9, 2026 02:48

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff: the fix is correct, focused, and CI is green. Approving for merge.

@esengine esengine merged commit c8007a6 into esengine:main-v2 Jun 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) skills Skill system (internal/skill, internal/tool) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants