fix: replay pending prompts after stale-turn reconcile (#4474)#4522
Open
CVEngineer66 wants to merge 2 commits into
Open
fix: replay pending prompts after stale-turn reconcile (#4474)#4522CVEngineer66 wants to merge 2 commits into
CVEngineer66 wants to merge 2 commits into
Conversation
added 2 commits
June 15, 2026 19:26
…ayout Root cause (esengine#4459): configuring custom models on Windows triggered 40% CPU usage from three compounding issues: - ModelPicker re-filtered all refs on every keystroke (no debounce) - ProviderEditor reparsed modelNames on every input change (no memo) - ModelSwitcher called getBoundingClientRect() in render path Fixes: - allRefs(s) → useMemo([s.providers]) in ModelsSection - providerAccessGroups call → useMemo([s.providers, t]) in ProvidersSection - modelNames split/trim/filter → useMemo([models]) - ModelChips extracted as standalone memo component - reload/apply/backgroundApply → useCallback - uniqueStrings O(n²) → Set-based O(n) - ModelPicker + ProviderModelDraftPicker search → 150ms debounce - ModelSwitcher getBoundingClientRect → useEffect + ResizeObserver
reconcileTabRuntime (triggered by the 30s stale-turn watchdog) dispatches backend_status which can clear the frontend's approval/ask state. Without a subsequent ReplayPendingPrompts call, the modal disappears and the turn appears stuck. Previously only the tab-switch path (activeTabId useEffect) called ReplayPendingPrompts (esengine#4286). This fix adds it to reconcileTabRuntime as well, covering the stale-turn case. Also adds a replay-pending-prompts test suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4474
问题
Plan 模式下,AI 完成规划后弹出执行/修订/退出窗口。如果用户切到其他会话,30s 后 stale-turn watchdog 触发
reconcileTabRuntime,dispatchbackend_status到前端,这行代码清除了approval状态:approval modal 消失,但后端 controller 仍在阻塞等待用户审批。用户回来时看不到窗口,只能手动点 stop。
PR #4286 修复了 tab 切换时调用
ReplayPendingPrompts,但未覆盖 stale-turn reconcile 路径。修复
在
reconcileTabRuntime的backend_statusdispatch 之后也调用replayPendingPromptsForActiveTab(tabId),确保 approval modal 在任意路径下都能恢复。测试
新增
replay-pending-prompts.test.ts,6 个 case: