fix(agent): reset planner session on tab switch to prevent cross-session contamination#4934
Closed
liaoyl830 wants to merge 1 commit into
Closed
fix(agent): reset planner session on tab switch to prevent cross-session contamination#4934liaoyl830 wants to merge 1 commit into
liaoyl830 wants to merge 1 commit into
Conversation
…ion contamination (esengine#4926) When using dual-model Plan+Execute mode, switching between tabs could cause Tab A's planner output to leak into Tab B's executor handoff. The planner session history was not cleared when activating a different tab, allowing stale plans from a previous conversation to contaminate the new active tab. Fix: Make Controller.ResetPlannerSession() public and call it at every tab activation path in the desktop layer: - SetActiveTab: when user switches between tabs - openTopicTabWithActivation: when reusing an existing tab (same session) - CloseTab: when the active tab changes to the next tab after closing This is a minimal, defensive fix (Solution B from the issue) that ensures each tab's planner history stays scoped to that tab's conversation. Test: Added TestResetPlannerSessionClearsPlannerHistory to verify the public ResetPlannerSession method correctly clears planner context.
Collaborator
|
Thanks @liaoyl830. I reviewed this tab-switch reset direction while consolidating the PE handoff work into #4938. I did not adopt the production reset behavior because latest main-v2 passes the planner output directly through the active Coordinator rather than through a project-level handoff buffer, and resetting planner state during tab activation could race with in-flight planning. The #4926 isolation concern should be handled separately if it is still reproducible on the current base. Your investigation and proposed fix are credited in #4938 under Repository Contributor Credits. Closing this PR in favor of the current integration path. |
Collaborator
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.
Summary
修复 #4926: Plan-Execute dual-model 跨会话计划污染
问题: 当使用双模型 Plan+Execute 模式时,同一项目下的多个标签页会发生跨会话污染。Tab A 的 Planner 输出可能被路由到 Tab B 的 Executor。
根因: 切换标签页时没有重置 planner session,导致 Coordinator 的 plannerSess 中的旧状态污染新的会话。
修复: 将
Controller.ResetPlannerSession()导出为公开方法,并在桌面层的每个标签页激活路径中调用:SetActiveTab: 用户在标签页间切换openTopicTabWithActivation: 复用现有标签页CloseTab: 关闭标签页后切换到下一个Changes
internal/control/controller.go- 导出ResetPlannerSession()方法desktop/tabs.go- 在4个标签页激活点调用ResetPlannerSession()internal/control/controller_test.go- 添加测试验证Verification
go test ./internal/agent/...passesgo test ./internal/control/...passes (包括新测试)go vet ./...cleangofmt -w .cleanFixes #4926
Cache impact
Cache-impact: none — 仅添加了方法调用,不改变系统提示或缓存前缀。
Cache-guard: N/A