Skip to content

fix: new session inherits settings from active tab (#4019 & #4088)#4087

Closed
JesonChou wants to merge 1 commit into
esengine:main-v2from
JesonChou:fix/4019-new-session-defaults
Closed

fix: new session inherits settings from active tab (#4019 & #4088)#4087
JesonChou wants to merge 1 commit into
esengine:main-v2from
JesonChou:fix/4019-new-session-defaults

Conversation

@JesonChou

@JesonChou JesonChou commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4019 and #4088 — clicking "New Session" (or the "+" tab button) in the desktop app created a blank tab with hardcoded defaults instead of carrying over the current session's model, effort, collaboration mode, and tool-approval posture.

Problem

When a user had model=deepseek-v4-pro, effort=max, and YOLO enabled in the current tab, clicking "New Session" would create a blank tab that did not inherit any of those settings:

Setting Before (broken) After (fixed)
Model deepseek-v4-flash (fallback default) Inherited from active tab
Effort auto Inherited from active tab
Mode / YOLO normal + ask Inherited from active tab
Disabled MCP empty map Inherited from active tab

Root Cause

EnsureBlankTab() in desktop/tabs.go created the WorkspaceTab struct with hardcoded defaults and zero-value fields:

mode:             "normal",              // hardcoded
toolApprovalMode: control.ToolApprovalAsk, // hardcoded
// model and effort left as zero values

No settings were carried over from the currently active tab. Additionally, Fork() was missing toolApprovalMode from its carry-over set — every forked session silently reverted to "ask" approval.

Changes

desktop/tabs.goEnsureBlankTab (main fix)

  • Inherit model, effort, mode, toolApprovalMode, disabledMCP, and mcpOrder from the active tab before constructing the blank WorkspaceTab. Falls back to the previous hardcoded defaults only when no active tab exists (first launch).
  • Fallback path (reusing a previously-indexed blank topic) now builds the tab inline instead of delegating to OpenProjectTab / OpenGlobalTab, which had their own hardcoded defaults. Both code paths share the same inherited variables, so the reuse path is no longer a gap.

desktop/app.goFork

  • Added toolApprovalMode to the carry-over set (model, effort, mode, disabledMCP, and mcpOrder were already inherited).

Affected code paths

Action Before After
Click "+" on tab bar Hardcoded defaults Inherits active tab settings
Click "New Session" button Hardcoded defaults Inherits active tab settings
Fork session Loses toolApprovalMode Carries all settings
Reuse indexed blank topic Delegated → hardcoded defaults Inline → proper inheritance

Verification

  • go build ./... passes.
  • Three rounds of code review addressed — the initial implementation, an external review identifying a bypass path and MCP asymmetry, and a final symptom-by-symptom verification against the issue's reproduction steps.
  • No new dependencies, no public API changes, mutex discipline unchanged.

EnsureBlankTab now inherits model, effort, mode, toolApprovalMode,
disabledMCP, and mcpOrder from the currently active tab when creating
a blank session.  Previously model and effort were left empty (falling
back to config defaults), mode was hardcoded to normal, and
toolApprovalMode was hardcoded to ask.

The indexed-topic fallback path (which used to delegate to
OpenProjectTab/OpenGlobalTab and therefore bypass inheritance) now
builds the tab inline so it receives the same inherited settings.

Fork also now carries toolApprovalMode (the only setting missing from
its carry-over set), so forked sessions preserve the same approval
posture as the source.

Result: clicking + on the tab bar, or forking a session, keeps the
same model, effort, collaboration mode, tool-approval posture, and
MCP state that the user already configured.
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 12, 2026
@JesonChou JesonChou changed the title fix: new session inherits settings from active tab (#4019) fix: new session inherits settings from active tab (#4019 & #4088) Jun 12, 2026
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.

[Bug]: 新会话没有使用默认模型

1 participant