Skip to content

fix(desktop): replay pending prompts on tab switch to preserve plan m…#4286

Merged
SivanCola merged 2 commits into
esengine:main-v2from
myipanta:hotfix/4275-plan-options-disappear-on-tab-switch
Jun 13, 2026
Merged

fix(desktop): replay pending prompts on tab switch to preserve plan m…#4286
SivanCola merged 2 commits into
esengine:main-v2from
myipanta:hotfix/4275-plan-options-disappear-on-tab-switch

Conversation

@myipanta

Copy link
Copy Markdown

…odal (#4275)

When switching back to a plan-mode tab, the 3-button modal (revise/execute/exit) was lost because ReplayPendingPrompts() was only called on initial mount, not on tab change. The backend still held the pending exit_plan_mode approval event but the frontend never re-emitted it.

Root cause: ReplayPendingPrompts() was only in the mount-effect, never triggered when activeTabId changes.

Fix: add a useEffect that calls app.ReplayPendingPrompts() on every activeTabId change, so switching back to a plan-mode session rebuilds the approval modal.

…odal (esengine#4275)

When switching back to a plan-mode tab, the 3-button modal
(revise/execute/exit) was lost because ReplayPendingPrompts() was
only called on initial mount, not on tab change. The backend still
held the pending exit_plan_mode approval event but the frontend
never re-emitted it.

Root cause: ReplayPendingPrompts() was only in the mount-effect,
never triggered when activeTabId changes.

Fix: add a useEffect that calls app.ReplayPendingPrompts() on every
activeTabId change, so switching back to a plan-mode session
rebuilds the approval modal.
@github-actions github-actions Bot added desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Added a supplemental regression commit fd2967b2 for the tab-switch prompt replay behavior.

What changed:

  • Extracted replayPendingPromptsForActiveTab so the tab-switch replay contract is directly testable.
  • Extended the existing frontend test to verify that no active tab does not replay, an active tab does replay, and replay bridge failures are swallowed instead of breaking the effect.

Verified:

  • pnpm --dir desktop/frontend test passed
  • go test ./internal/control -run TestReplayPendingPrompts -count=1 passed
  • git diff --check HEAD~1..HEAD passed

Note: pnpm --dir desktop/frontend exec tsc --noEmit -p tsconfig.test.json is still blocked in this checkout because the Wails generated module types are absent (desktop/wailsjs/go/main/App).

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved. This fixes the reported tab-switch plan approval loss by replaying pending approval/ask prompts whenever the active tab changes, while preserving the existing mount/reconnect replay path.

Why this solves #4275:

  • The backend already retains the pending exit_plan_mode approval while the run loop waits.
  • ReplayPendingPrompts() re-emits that pending prompt, and desktop tab events carry tabId, so the frontend reducer can rebuild the modal for the correct tab.
  • The supplemental regression now covers the active-tab replay trigger and the failure-swallowing behavior expected from the effect.

Verified:

  • pnpm --dir desktop/frontend test passed
  • go test ./internal/control -run TestReplayPendingPrompts -count=1 passed
  • git diff --check HEAD~1..HEAD passed

@SivanCola SivanCola enabled auto-merge June 13, 2026 15:23
@SivanCola SivanCola merged commit ed07684 into esengine:main-v2 Jun 13, 2026
13 checks passed
@myipanta myipanta deleted the hotfix/4275-plan-options-disappear-on-tab-switch branch June 13, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants